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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to pass jira issue ids to bamboo build plan variable?

I'm looking for a way to integrate linked jira issues into build workflow.
For every bamboo build I can browse linked jira issues in GUI. How can I access this information in build scripts?

I also tried creating release from jira, manually linking issues to release and then triggering build from jira. Unfortunately still I don't see how to gather related ticket keys.

2 answers

We had to create a script in the end as a workaround. We use the ${bamboo.planRepository.revision} variable to give us the related Bitbucket commit. All of our branches in bitbucket contain the linked JIRA ticket number within the commit details returned from the Bitbucket API. Our solution connects to the Bitbucket API and uses the above build variable to return all of the commit details, once returned we grep the response to identify the JIRA ticket number linked with the commit. You'll have to update the <JIRA_ticket_prefix> below to use your project's ticket prefix, in our case this is followed by 4 numbers at the moment, but if you have more you'll have to update the {4} below too.


Once we have the JIRA ticket number returned, we then save it to a file located: /var/lib/bamboo-home/artifacts/variable_injection but again, you can change this to whatever you wish.




# Sign in to Bitbucket and get a token
ACCESS_TOKEN=$(curl -s -X POST -u "$BITBUCKET_CLIENT_ID:$BITBUCKET_CLIENT_SECRET" -d grant_type=password -d username=$BITBUCKET_USERNAME -d password=$BITBUCKET_PASSWORD | jq '.access_token')

# Get the JIRA ticket number from the commit
TICKET=$(curl -s<company_name>/<repo>/commit/$COMMIT?access_token=$ACCESS_TOKEN | jq '.rendered.message.raw' | grep -P '(<JIRA_ticket_prefix>.[0-9]{4})' -o | uniq)

echo "** Found JIRA ticket: $TICKET from commit: $COMMIT"

# Write the feature tag to a file for Bamboo
echo "jiraticket=$TICKET" > "$OUTPUT_DIRECTORY/variable_injection"


Once all of this has finished, you should have a JIRA ticket number stored in a file /var/lib/bamboo-home/artifacts/variable_injection 

Next, you can use the bamboo Inject Variable task to read the file ../../../artifacts/variable_injection which contains your JIRA ticket number and creates a variable of ${bamboo.inject.jiraticket} to then be used elsewhere in your build.


It seems pretty long-winded, but it's the only thing we could think of for the time being as a workaround until Bamboo creates its own JIRA ticket variable.


Hope this helps people,


Hey Dan,

Thanks for sharing.


Answers my query also.




0 votes
Jeyanthan I
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 06, 2020

Hey @Konrad Gancarz ,

If I understand correctly, you wanted to refer the Jira isssue ID in Bamboo builds. I was going to suggest one of the default Bamboo variables for Jira. I then realised there is no variable to collect Issue ID that triggered the build.

Available JIRA variables (as of Bamboo 6.10.4) are as follows:

  • ${bamboo.jira.baseUrl} - The URL of your JIRA application server.
  • ${bamboo.jira.projectKey} - The key of the triggering JIRA application project.
  • ${bamboo.jira.projectName} - The name of the triggering JIRA application project.
  • ${bamboo.jira.username} - The username of the user who triggered the release build.
  • ${bamboo.jira.version} - The release version of the triggering Jira application project.

I have therefore created a feature request on your behalf. Please upvote and comment.

As a workaround, I propose

  1. Create a script Task within the plan.
  2. In the script, make a REST call to Jira to fetch the corresponding Issue ID.

References to REST documentation: 

Hope that helps!


Hi Jey,

How would we make a REST call to Jira to fetch the corresponding issue ID when the details aren't stored in Bamboo? Looking at the Jira REST API docs, we'd need to provide the issue ID in the call?

Please could you give an example?



Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events