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

reseting build numbers in bamboo

lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2011

Is there currently any way to reset build numbers in Bamboo?

When we move from one build system to another, we want to be able to set the build number to 85 since its currently 84 in the other build system.

10 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
James Dumay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2011

Please do not modify your Bamboo instances database in this way without the help of Atlassian Support as we do not guarentee to any degree that it will work. If you make a mistake changing these numbers there are a number of things that might break and we can't support you.

We believe the management of version numbers is a good feature for Bamboo to have so we have raised a feature request for it. If this is something you would find useful please vote on the issue to let us know :)

EDIT: Ticket to vote for is https://jira.atlassian.com/browse/BAM-10282

lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 29, 2011

James how do I vote on it? What is the feature request number?

Also

I was thinking of creating a global variable that was the build number and then changing that number via db modifications incrementing every build. This doesnt change any of the off the shelf functionality so this could work.

Your suggestion of incrementing the build number in a build script does not persist this build number.

So if we incremented the build number from 6 to 7, where would the 7 be saved so next time we can increment by one to 8?

This is a big issue for us and stopping us from moving forward to using bamboo for all builds.

It seems like bamboo is only setup for CI builds and not total build management.

James Dumay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2011

Sorry Lance, I provided the wrong link!

The idea in that ticket would be to provide a Plan or Global variable that represents your version or schema number and then have a Task that increments that number whenever the build runs.

0 votes
Oleg Efimov September 14, 2017
0 votes
eirikwahl April 2, 2013

Use the plugin described at http://blogs.atlassian.com/2012/08/bamboo-maven-version-update-plugin and use this to increment a global variable, and use that as a replacement for the build number. This workaround works fine for our similar issue.

0 votes
lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2012

The approach I said above that came from Atlassian assumes that you delete/ expire all build results first if you want to reset.

0 votes
lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2012

Officially.. here is the approach that came from atlassian support

In order to reset build numbers, you need to # delete/expire all existing build results for your specific build # run this SQL query and find the FULL_KEY's related to the build that you want to change:
{code}
select * from build;
{code}
# using the results gathered from the previous query, run this SQL query to make sure that you don't have any build results in the buildresultsummary table (replace 'PROJ1-PLAN1','PROJ1-PLAN1-JOB1','PROJ1-PLAN1-JOB2' with the results from previous query):
{code}
select * from buildresultsummary where build_key in ('PROJ1-PLAN1','PROJ1-PLAN1-JOB1','PROJ1-PLAN1-JOB2');
{code}
# If the previous select returns nothing, means all your build results for that specific build are gone. Shut down your Bamboo server and run this SQL to update the build numbering (replace 'PROJ1-PLAN1','PROJ1-PLAN1-JOB1','PROJ1-PLAN1-JOB2' with your results from original select query):
{code}
update build set FIRST_BUILD_NUMBER=0, LATEST_BUILD_NUMBER=0, NEXT_BUILD_NUMBER=1 where FULL_KEY in ('PROJ1-PLAN1','PROJ1-PLAN1-JOB1','PROJ1-PLAN1-JOB2');
{code}

Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2012

The above instruction miss one point:

You need also delete all the content from plan_vcs_history where build_key matches plan/jobs you reset build numbers for. If you don't do that change detection won't work properly.

0 votes
Ken Wood
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

I too have just use a perl script with mysql library to directly set the value of the NEXT_BUILD_NUMBER in the database. I know this is not a 'supported' practice, but it works fine, been doing if for several years. Our standard is for the first build number of any new build to be "1001", so if we didn't have a way to set the build number, every build would start with the Bamboo default of '1'.

Here is example for Babmoo 2.5, we haven't moved up to Bamboo 3.3.x, will be doing that in the next few months.

#!/bin/perl

use strict;

use DBI;

my $dbtype = "DBI:mysql";
my $host = "myDBbox";
my $user = "myUSER";
my $password = "myPASSWORD";
my $dbase = "bamboodb";

my $dbh;
my $qhandle;

my %project_to_id;

$dbh = DBI->connect("${dbtype}:${dbase}:${host}",$user,$password);
if (! $dbh) {
die ("database connection failed - $DBI::errstr\n");
}

$qhandle = $dbh -> prepare("update BUILD set NEXT_BUILD_NUMBER=? where BUILDKEY=?") || die "prepare select: $DBI::errstr\n";
$qhandle -> execute($ARGV[0],$ARGV[1]) || die "execute select: $DBI::errstr\n";
$qhandle -> finish();

$dbh->disconnect();

0 votes
Ron Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

I only edited the NEXT_BUILD_NUMBER (for a particular build) to 1. Then just kicked off the build.

lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 9, 2012

I just tried to set the NEXT_BUILD_NUMBER to 1 and the build would not start. Appears to be some invisible constraints that are checked.

I had 4 distinct apps that I need to tie to the same build number

app 1 was at build 5

app 2 was at 32

app3 was at 14

app 4 was at 9

I set the next_build_number to 35 and I was ok. I dont see how you can set it to 1 unless you also set the related unknown other area to 1 as well. I think there are logs, etc that are tied to this build number

This is a crappy design that does not let us manage the build number. The build number should be for the customer to control and not some form of identity column in a database for Atlassian.

All build systems except Bamboo allow this.

0 votes
Ron Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

Although not our normal practice, I have had to reset build numbers. The workaround is to directly edit the database which is rather simple to do.

lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

Hi Ron, I tried that with the latest_build_number and next_build_number in the build table and that didnt work.

How do you do this?

0 votes
James Dumay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

Hi Lance,

Its not possible to reset the Bamboo build number. You would have to indepentently manage this number yourself (such as incrementing the number in a build script instead of relying on the build number from Bamboo).

Thanks

James

lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2011

can I create a build number global variable in Bamboo and increment that one from within a script? We would need to have a way to remember the last build number for sure.

We are able to reset buildnumbers in Teamcity which is what we currently have. We are moving to Jira, Confluence and perhaps Bamboo if it will work for us.

0 votes
lance_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2011

also we have several applications that we build that we would like to have at the same build number.

Another good reason is when you change your major, minor (release number) you might want to reset the build number to 1

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events