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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

jira-transition get issues form commit

Hello

I would like to trigger a JIRA issue transition using the jira-transition:0.2.2

script:
  - pipe: atlassian/jira-transition:0.2.2
    variables:
      JIRA_BASE_URL: $JIRA_BASE_URL
      JIRA_USER_EMAIL: $JIRA_USER_EMAIL
      JIRA_API_TOKEN: $JIRA_API_TOKEN
      ISSUE: $BITBUCKET_BRANCH
      TRANSITION: "Done"

the problem lies with the parameter ISSUE. In the documentation it is stated that on can specify either: ISSUE: 'ABC-123' or use the variable $BITBUCKET_BRANCH

not sure what the $BITBUCKET_BRANCH variable does?, but it is empty when I run it.

What I would like to achieve is: ISSUE: 'ABC-123, ABC-345, ABC-567, etc'.

So that the transition is done one multiple issues based on the commit. 

The API is setup and the connection with JIRA is done. So the only thing left ist to get the transition on multiple issues working.

Is there a way to get all the Issue keys of the current git hash / pipeline build that is currently running?

Kind Regards

Chris

1 answer

1 accepted

0 votes
Answer accepted

Hi @Chris . Due to the implementation of the current version of the pipe, only one issue key will be extracted from the ISSUE string. So in your case, only the ABC-123 key would be used, all other keys would be ignored. 

@Alexander Zhukov thank you for your reply.

In this case the jira-transition pipe is not the right thing for me. Not sure which use case is covered by just transitioning one issue and hard coding that issue in the bitbucket-pipelines.yml

What I have to look into now is creating a bash script that extracts all git commit messages of a certain git-hash and parses the messages for Jira-Issue-Keys. All extracted issue-keys will then execute a loop that triggers a jira transition for each issue using the JIRA API.

That custom script I need to trigger in the script section of the bitbucket-pipelines.yml.

Maybe this has been done already. Or there are scripts that do exactly this. I have not yet found the right thing online. Any pointers are appreciated.

Hello Chris, 

I'm currently struggling with the same problem you had! Did you manage to solve it?

Hello Ady

No we had to go another way. But we use bitbucket to track our deployments. So we know which issue has been deployed on which environment. 

So what we do is track if the issue has been deployed on the staging environment if so we set the jira status on staging. With the new Jira Automation you can automate such tasks with your own rules.

To detect if an issue has been deployed on the staging environment we use this filter

deploymentEnvironmentName ~ staging AND deploymentEnvironmentName !~ production AND status in ("Resolved") AND development[commits].all > 0

So basically we check if the issue is deployed on staging but not on production, the current status is "resolved" and the issue has commits. If all of this applies, we transition the issue using Jira Automation to "On Staging".

Hope this helps 

Like fjbatresv1 likes this

Hi Chris, 

This was super useful, and we managed to automate transitions on deploy to our pre-preproduction environment with your help!

I had no idea that "deploymentEnvironmentName" was an available variable, so you've saved me a lot of trouble trying to build a custom Pipelines script.

Many thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,232 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you