Automating a workflow transition on Pull Request merge with a branch specifier

alexlatchford December 29, 2016

So for all of our services we develop on feature branches, named after the JIRA issue number. We use git-hooks to inject the branch name (and thus the issue number) into the commit message, this hooks up commits with tickets, great!

We then get our developers to create a pull request from issue-number branch to master for the code review step. We automatically transition to the "Code Review" status on PR creation and transition to "Awaiting Test" on PR merge as we automatically deploy to our TEST environment on merges to master.

Now we release to our LIVE environment off a live branch, so we have a second PR from master -> live whenever we want to deploy. I'm aware I can set the same PR merge trigger to fulfil the automatic transition from "Awaiting Test" to "Resolved" (which to us means deployed to the LIVE environment) but often a single issue may have more than 1 PR so quite often we end up transitioning to "Awaiting Test" then straight to "Resolved" as we merge to issue-number, feature branches into master.

Now we can solve this issue if we have a conditional validator on the target branch for both transitions but I cannot see this anywhere in the JIRA cloud settings, anyone got any ideas how to achieve this (hopefully without resorting to Smart Commits :/)

Thanks,

Alex

 

PS. This is our workflow.

 

Screen Shot 2016-12-29 at 14.12.27.png

 

1 answer

1 vote
Randy
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.
December 29, 2016

In response to your multiple PR situation, can you address it with the "Unreviewed Code Condition"?

 

image2016-12-29 15:44:23.png

alexlatchford December 29, 2016

Hmm, maybe. I've updated the workflow to include this and will report back after a few tests, thanks for the advice Randy!

alexlatchford December 30, 2016

Nope doesn't work unfortunately, it still triggers all the way through to resolved in the case where there is only 1 pull request.

Looks like this is because of the evented nature of the transition triggers, because it listens to the same event twice, if it handles them in the wrong order it'll correctly transition from "Code Review" -> "Awaiting Test" on the first trigger. It'll then go from "Awaiting Test" -> "Resolved" on the second event, both of which pass the "Unreviewed Code Condition". 

Thanks for your answer it's a step in the right direction and I'll be keeping it in place but it's not the full solution unfortunately :/

Suggest an answer

Log in or Sign up to answer