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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,559,005
Community Members
 
Community Events
184
Community Groups

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

1 vote
Gerhard Forster
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 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:

${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

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

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

Hello Jörg,

 

would you mind sharing the Python Script?

 

Thank you!

Benjamin

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events