Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you might find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Have everything merged as a transition condition

gkaran June 17, 2019

We are currently in the process of migrating from an old issue tracker we have to Jira (server).

One of the requirements we have from the QA team is that they want to allow a certain transition to only happen when all code of an issue is merged in a certain branch.

 

We also use ScriptRunner, so we can create a scripted condition to check that. The problem is that we cannot find in the documentation anything that can help us in that process.

 

Has anyone any luck accessing associated branches/MRs to an issue using groovy? If yes, could you please point to a doc with the classes that can be used to do that?

1 answer

0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2019

That kinda depends on where your code merge is taking place.

Jira/scriptrunner doesn't directly keep track of your code, so it won't have any classes to inspect that status. Depending on the type of VCS you are using, you may need to either connect via REST API to that VCS or perhaps using command line script.

But generally, the way I think Jira is supposed to interact with your VCS  is by setting up triggers in the Jira workflow such that your VCS will be able to initiate the transition when the merge happens. In this case, you would block/hide that transition from the user and only let the VCS handle it.

gkaran June 18, 2019 edited

Hi Peter,

thank you for your reply. We use Git Integration for Jira that exposes a REST API to fetch the branches and/or commits related to an issue.

They way you describe it (and as I have thought of it but wanted to see if an easier solution can be found), it to make one request to get the list of branches that the commits are included and verify with the VCS whether the branch has been merged.

The last part I cannot avoid I'm afraid, but I wanted to try to avoid the first call to fetch the branches and retrieve them through a manager object or something similar that "Git Integration for Jira" might expose.

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2019

Well, Scriptrunner can interact with other plugins native Java methods.

See https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.html

But you are kind of on your own (unless you can get support or documentation from the Git Integration for Jira guys) to figure out what those APIs are. But it might be possible to decompile their Jar and try to examine the methods and go from there.

gkaran June 18, 2019

Yeap, I am aware that ScriptRunner can interact with other plugins. I'm trying to see whether someone has any experience integrating Jira Git Integration with ScriptRunner though. If noone probably I would have to dig deeper.

Adam Wride
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2019

Hi @gkaran  - 

I'm with BigBrassBand - the vendor supporting the Git Integration for Jira app. Write us at support@bigbrassband.com and we'll see how we can help.

Cheers,

Adam

Suggest an answer

Log in or Sign up to answer