Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 745
Gupta Avatar asked Sep 17 '11 07:09

Gupta


People also ask

How do I change the Build number on Bamboo?

If you need to "reset" the build number to 1 this can be achieved by cloning the build plan via the Create menu, Clone plan. After cloning and verifying all is configured correctly delete the old build plan and revise all external links to point to the new one.


1 Answers

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! :-)

like image 83
Eirik W Avatar answered Nov 15 '22 01:11

Eirik W