Automate Transition of Jira Issue based on GitLab code merge on different branches

Junaid Shahzad March 24, 2022

Hi,

I have created a workflow like  below 

- To-Do

- Progress

- Deployed-QA

- Deployed-Production

what i want if

I do a merge  in GitLab repository in QA branch its should change/transit the status of ticket/issue to Deployed-QA.

I do a merge  in GitLab repository in Production branch its should change/transit  the status of ticket/issue to  Deployed-Production.

 

Thanks in Advance if anyone can help to setup this type of trigger or config in jira and GitLab. I am using Jira managed cloud. 

1 answer

1 accepted

2 votes
Answer accepted
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2022

Hi @Junaid Shahzad and welcome to the comunity ;)

first question upfront:
Did you already integrate your gitlab into jira so that development info can be shown in jira issues?

see following links regarding this topic and how to configure:
https://docs.gitlab.com/ee/integration/jira/development_panel.html

https://support.atlassian.com/jira-software-cloud/docs/view-development-information-for-an-issue/

 

Best
Stefan

Junaid Shahzad March 24, 2022

Thanks for reply, yes i already integrated the Jira when i reference the issue number during any push /merge i can see comments under tickets related that merge/push. below the link i followed to integrate. 

https://docs.gitlab.com/ee/integration/jira/configure.html

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2022

How does your branch structure/flow looks like? are your using a starndard flow (like gitFlow, trunkbased, githubFlow)?

Is your "production" your baseline (like your main-branch)? or does production gets branched from main? and then dev from production? and where is QA branched away from?

Sorry for that load of questions. The better we are aware of the situation the better we could strive for a solution. 

Best
Stefan

Junaid Shahzad March 24, 2022

 branch structure is

qa (for qa env all development work done here  after feature test we merge it to pre-prod branch)

pre-prod (replica of production but not production it use to deploy on pre-prod env after testing its code merged to master)

master  (its use to deploy on production env and its get merge from pre-prod  no direct push allowed  ) 

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2022

If you are working with pullRequests I would suggest to link both of the branches (QA & pre-prod) into the issue. This is just my personal educated guess how it could work:

  • trigger "PullRequest merged"
  • check condition of branches with smart value:
    • {{pullRequest.sourceBranch}} = QA
    • {{pullRequest.destinationBranch}} = pre-prod
  • action: Transition to required status

 

Afterwards I would created wheter another automation rule for the 2nd condition/status.

Hope this is helpful and could get you closer to a working solution.

Best
Stefan

Junaid Shahzad March 24, 2022

Right now i actually able to achieve some part of it by adding the Triger but through that Triger i only transit status to specific status   but it cant distinguished the branches its only transit to specific status where i added the trigger

https://confluence.atlassian.com/adminjiraserver/configuring-workflow-triggers-938847513.html#Configuringworkflowtriggers-Step1.Create/Editaworkflow

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2022

Hi @Junaid Shahzad 

I‘m afraid the workflow functions are not capeable of checking triggers for different conditions. I was thinking of doing this with jora automation rules. 

Did you try this way?

Best
Stefan

Junaid Shahzad March 25, 2022

@Stefan Salzl thank you so much for your hints and help  i able to achieve this by automation rule 

added 3 rules for 3 branches 

  • trigger "PullRequest merged"
  • check condition of branches with smart value:
    • {{pullRequest.destinationBranch}} = qa
  • action: Transition to deployed-qa  status

 

  • trigger "PullRequest merged"
  • check condition of branches with smart value:
    • {{pullRequest.destinationBranch}} = pre-prod
  • action: Transition to deployed-preprod status

 

  • trigger "PullRequest merged"
  • check condition of branches with smart value:
    • {{pullRequest.destinationBranch}} = master
  • action: Transition to deployed-production status
Like Stefan Salzl likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 25, 2022

AAAAAWESOME!!!! You nailed it 💪🏼💪🏼 Happy you got that working. 

Best
Stefan

Suggest an answer

Log in or Sign up to answer