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.
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
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
Thanks
Jörg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.