Is it possible to share a single build number between plans of a Bamboo project?
Asked Answered
A

3

9

I am using Atlassian Bamboo as my continuous integration server. For a project, I’ve defined two plans, namely development plan and release plan. Unfortunately, Bamboo uses two separate build numbers for each of these plans. This prevents me from identifying a build in the scope of a project by its build number. Is there any way to share a single build number between all the build plans of a project in Bamboo?

Auraaural answered 17/9, 2011 at 7:14 Comment(0)
R
13

Yes, there is a way (a workaround):

Use the plugin providet at this page: http://blogs.atlassian.com/2012/08/bamboo-maven-version-update-plugin. The plugin is named "Maven version updater for Bamboo variables", but does not require the use of Maven.

Follow the instructions in the above link to install the Bamboo plugin. Define a global variable in Bamboo, named e.g. "globalBuildNumberAutoupdate" with any number as the value (e.g. 1001). Then include a task (in your Bamboo build plan) using the above mentioned plugin, and set setting "Regex for matching Bamboo variables" to ".*Autoupdate", and remember to check "Include global variables when matching and updating".

Now you can use the variable ${bamboo.globalBuildNumberAutoupdate} in your builds (instead of ${bamboo.buildNumber} ).

This works nicely for us, using Atlassian Bamboo version 4.4.0.

Notice that the value for the global variable is "freezed" for the build during the execution of the Bamboo Plan. So all build steps in the same build plan will use the same value for the global variable, and they will use the value that the global variable had when the build was triggered. This also implies that the increased value will be used for the next build. But that's OK for us, as long as the value is increased for all builds.

I hope this helps! :-)

Ranket answered 3/4, 2013 at 12:23 Comment(2)
Thanks Eirik, yes it worked. I changed the correct answer to your new one.Auraaural
The plugin is already at Atlassian Marketplace as Variable tasks for BambooLadylike
A
1

It seems that No. Each plan in Bamboo has its own counter and it is not possible to share a single build number among plans.

Auraaural answered 24/9, 2011 at 15:16 Comment(1)
I guess that this answer was correct at the time it was written, but I have found an answer, using global variables and a Bamboo-plugin! See my answer on this page. :-)Ranket
I
0

Create one plan, for example I am using a name TRUNK (because it corresponds to TRUNK in my SVN). And add stages to it: Release, Debug, Code-Analysis and whatever you want else.

Implication answered 19/9, 2011 at 5:53 Comment(4)
So, I am doing the same. But, how can I share the its build number with other plans on the project?Auraaural
You can try to add plan dependency and use ${bamboo.dependency.parent.0} variable in the child plan. It will be substituted by the PLAN-KEY-NUMBER.Implication
Thanks 4 your answer, but it is a little bit vague. Would you please send me a link in which I could find out what exactly to do?Auraaural
Yes, take a look at confluence.atlassian.com/display/BAMBOO/… and jira.atlassian.com/browse/BAM-5379Implication

© 2022 - 2024 — McMap. All rights reserved.