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

Automatic add Bamboo Build Number as Release to Jira Issues Edited

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

0 votes

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:

${bamboo.buildNumber}

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.

/result/{projectKey}-{buildKey}-{buildNumber}/comment

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

/result/{projectKey}-{buildKey}-{buildNumber}/label

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,
Gerhard

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

Thanks

Jörg

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

/result?expand&favourite&label&issueKey&includeAllStates&continuable&buildstate&start-index&max-results

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 7.2 is here!

I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...

553 views 6 7
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