Automatic add Bamboo Build Number as Release to Jira Issues

Jörg Lang April 1, 2020

A Bamboo Build is related to a Jira Issue.

how can I automatically add the Build number of the build, to the Jira Issue as a fix version?

we are not doing any manual release management, but I want to be able to create nearly automatically a release notes in confluence to show the issues which are handeld in the release.

1 answer

1 vote
Gerhard Forster
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 14, 2020

Hello Jörg,

Thanks for your very interesting question. The issue breaks down in basically 3 topics.

The first one is retrieving a Bamboo build number. That's an esy one, as for this there exists the pre-defined and build-specific variable bamboo.buildNumber which you would call e.g. from within a Bamboo Script task like so:


Find all existing Bamboo variables and details about build- and deployment-specific, global, plan and custom variables in the KB Bamboo variable.

The above mentioned variable is typically used for deployment release versioning as illustrated in e.g. Naming versions for deployment releases.

Since you say that your release note creation process should be nearly automatic, possibly you want to automatize your release versioning too. And if so, the above KB should be of great help.

Now, what you aim to achieve is somewhat different. We believe that you want to use a build number so to automatically create a Jira issue like FIX-<build number>. Creating a Jira issue being linked to a Bamboo build is managed by

  • either specifying a Jira issue key in a Bamboo build comment or label
  • or by setting the same in a code commit message.

That's outlined here: Linking Jira application issues to a build. And that leads us in two directions:

(-- 1 --) Per commit, which may automatically trigger the respective build in Bamboo, you can add something like FIX-<build number> in the commit message. That said a Bamboo Script task could do the following (the below is just an example, so you can, of course, add whatever you find useful in your commit message):

git add .
git commit -m "FIX-${bamboo.buildNumber}"
git push

( -- 2 --) Using a build comment or label is not so straight forward, but possible. For this, Bamboo's REST API can be utilized. Find here our Bamboo REST API Tutorial.

For adding a comment, e.g. per CURL and from within a Bamboo Script task, please use the POST method and the below REST endpoint.


It actually spefifies a comment of format <projectKey>-<buildKey>-<buildNumber>, so it should contain "two or more uppercase letters followed by a hyphen and the issue number" as it's reqired for a Jira issue. It will actually contain more, namely two blocks of letters separated by hyphen, then another hyphen and the build number so a numeric value only. Possibly that is even better as it's a more precise format.

Use of build label is managable by POST using the below endpoint


That's the same format as for comment. So the above stated equally accounts.

Either way, (1) or (2) from above should get you to where you want.

Please quote this message with "Accept answer" if it was of help for you and if not, just share your doubt or any further ask with us, preferably in this same thread.

Thanks and cheers,

Jörg Lang April 14, 2020

Thanks for the idea Gerhard.

i have already create a python script which

  • fetches the linkes issues of the build
  • creates a project version
  • Add‘s the version to the issues



Gerhard Forster
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 14, 2020

Sound great, Jörg. So seems to be solved for you. Awesome!

Just let me add to this, as per the attached Bamboo REST API Tutorial, there do exist also REST endpoints for your first mentioned point. One is this


which, using the GET method, represents a latest build result query for all existing plans visible for all users.

And something similar exists for Bamboo deployments too. Just in case you want or need to try that out later.

With this, take care and stay healthy!

Cheers, Gerhard

voisard July 9, 2021

Hello Jörg,


would you mind sharing the Python Script?


Thank you!


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events