Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create Epic branch and feature branch within the epic using A4J

Dave Furlani
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.
January 21, 2023

We have Epics in a PMO project and Stories to deliver those epics in a number of system-specific projects (e.g. IOSAPP, WEBAPP, WINAPP).

We also have BitBucket and are using a git flow branching strategy with the preferred hierarchy of Main > Develop > Epic (Epic ID) > Feature (Story ID).

What we'd like to do is:

  1. Trigger A4J when the system-specific Story is transitioned to an In Progress statusCategory
  2. Create an Epic branch in BitBucket (if one does not already exist)
  3. Create a Story branch within that Epic branch

This will make life easier/more consistent for the devs and thus (hopefully) promote the correct use of the workflow.

I can create the Epic branch off Develop with A4J, but I can only seem to create the Story branch off of Develop, and not off the Epic branch. The create branch step seems to only accept branches that exist while creating the A4J rule and not dynamically accept something like {{createdBranch.name}}.

Any suggestions as to how I might achieve the desired outcome?

1 answer

0 votes
Bill Sheboy
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.
January 22, 2023

Hi @Dave Furlani 

This would need to be a global/multi-project scope rule, and as you appear to be on the Premium product plan, the service limits for global rules should not be a problem.

Unfortunately rules cannot trigger on a change to statusCategory yet.  A work-around would be to list all of your possible "from" (not started) and "to" (in progress) status values for the target projects.  Remember to actively maintain this rule when it runs.

For your step 3 (create the story branch within the Epic branch), you may need to experiment to get that working, and as a fallback could use a webrequest to call the REST API for your source control tool to add that branch.

Kind regards,
Bill

Dave Furlani
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.
January 22, 2023

Yes, step 1 was easy done.

Step 2 works once, but fails on subsequent runs because of the error that the branch already exists. The rule breaks at that point and does not progress.

I think we'll need webrequests for step 2 and 3, with a webrequest check in there to see if the Epic level branch already exists. 

Does anyone know how to to check for and create branches with webrequests to BitBucket in A4J? 

Dave Furlani
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.
January 24, 2023

I've been able to use the web request to find the existence of the Epic branch, and if it doesn't exist then I can use the OOTB A4J step Create Branch, because I know where we consistently want that to exist.

The last piece of the puzzle is being able to use the Send web request step to have BitBucket create a branch inside the Epic branch.

Can anyone help with how to including the location in that BB Create Branch web request? https://developer.atlassian.com/cloud/bitbucket/rest/api-group-refs/#api-repositories-workspace-repo-slug-refs-branches-post 

image.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events