Changing the current build number in Bamboo

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

In some Bamboo versions, the UI does not allow customers to edit the next build number. Internally, Bamboo references previous builds from multiple tables, so modifying the build number is non-trivial. While it is possible to increase the build number with the workarounds below, decreasing it is not possible.

Solution

Bamboo 10.0 and later

From Bamboo 10.0, customers can modify the build numbers directly in the application. For more information please check the official documentation page:

Bamboo 5.10 to 9.6

Workaround: Reset the build number

If you need to "reset" the build number to 1, you can do this by cloning the build plan via the Create menu, Clone plan.

(Auto-migrated image: description temporarily unavailable)

After cloning and verifying all is configured correctly delete the old build plan and revise all external links to point to the new one.

Cloning a plan will not clone build result history or plan branches.

Workaround: Increase the build number in the database

The build number can be increased but should never be decreased. There are many tables referencing existing build results and this is too complex for a simple SQL update. If the build number is set to a number used in the past it will cause serious problems.

With that said, increasing the number to a larger value is straightforward. Locate the appropriate build plan to modify by retrieving records in the BUILD and BUILD_NUMBERS tables:

Locate the build plan to modify

1 SELECT * FROM BUILD_NUMBERS JOIN BUILD USING (BUILD_ID) ORDER BY FULL_KEY;

In the example output below there are two entries. These are for the same plan in Bamboo. You'll also see BUILD_TYPE CHAIN_BRANCH which is a branch of the plan. Only increment these if you want them to be the same as the master, but generally these are their own entities.

Example:

BUILD_ID

BUILD_NUMBERS_ID

NEXT_BUILD_NUMBER

BUILD_TYPE

CREATED_DATE

UPDATED_DATE

FULL_KEY

BUILDKEY

TITLE

360449

458753

3

CHAIN

2016-08-04 18:13:37

2016-08-04 18:34:34

RP-RPO

RPO

Remote Plan One

1769473

2064385

1

CHAIN_BRANCH

2016-10-10 21:00:23

2016-10-10 21:00:23

RP-RPO0

RPO0

Test

When you know which build plan to modify you can run this SQL to increase the number.

Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

1 2 3 UPDATE BUILD_NUMBERS SET NEXT_BUILD_NUMBER = 9999 WHERE BUILD_ID in (SELECT BUILD_ID FROM BUILD WHERE FULL_KEY = '<PROJECT KEY>-<PLAN KEY>');

For branch builds the syntax is slightly different. Locate the correct BRANCH_NUMBER by examining the BUILDKEY field in the BUILD table.

1 2 3 UPDATE BUILD_NUMBERS SET NEXT_BUILD_NUMBER = 9999 WHERE BUILD_ID in (SELECT BUILD_ID FROM BUILD WHERE FULL_KEY LIKE '<PROJECT KEY>-<PLAN KEY><BRANCH_NUMBER>%');

Bamboo 5.9 and earlier

Workaround: Reset the build number

If you need to "reset" the build number to 1 this can only be achieved by cloning the build plan via the Create menu, Clone an existing plan.

(Auto-migrated image: description temporarily unavailable)

After cloning and verifying all is configured correctly delete the old build plan and revise all external links to point to the new one.

Cloning a plan will not clone build result history or plan branches.

Workaround: Increase the build number in the database

The build number can be increased but should never be decreased. There are many tables referencing existing build results and this is too complex for a simple SQL update. If the build number is set to a number used in the past it will cause serious problems.

Increasing the number to a larger value is straightforward. Locate the appropriate build plan to modify by retrieving records in the BUILD table:

Locate the build plan to modify

1 SELECT * FROM BUILD ORDER BY FULL_KEY;

In this example there are two entries. These are for a single plan in Bamboo, there's one of BUILD_TYPECHAIN and one of JOB. If there are multiple jobs in a build you will have multiple entries with the JOB BUILD_TYPE. Each of these must be increased to the same number or you'll have problems. You'll also see BUILD_TYPE CHAIN_BRANCH which is a branch of the plan. Only increment these if you want them to be the same as the master, but generally these are their own entities. A BUILD_TYPE of JOB is common to both the main and branch plans.

Example:

build_id

build_type

created_date

updated_date

full_key

buildkey

title

description

first_build_number

latest_build_number

next_build_number

...

393217

CHAIN

2015-07-01 11:13:31.868000

2015-07-01 11:50:22.936000

MORG-SUPSQL

SUPSQL

Support SQL

Test builder for SQL support scripts

1

5

6

...

393218

JOB

2015-07-01 11:13:31.997000

2015-07-01 11:17:57.343000

MORG-SUPSQL-JOB1

JOB1

Default Job

NULL

1

5

6

...

393221

CHAIN_BRANCH

2015-07-01 11:50:40.932000

2015-07-01 11:52:20.094000

MORG-SUPSQL0

SUPSQL0

feature-bamboo-buildnum

Test builder for SQL support scripts

1

8

9

...

393222

JOB

NULL

NULL

MORG-SUPSQL0-JOB1

JOB1

Default Job

NULL

1

8

9

...

When you know which build plan to modify you can run this SQL to increase the number.

Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

1 2 3 4 UPDATE BUILD SET NEXT_BUILD_NUMBER = 9999 WHERE (FULL_KEY LIKE '<PROJECT KEY>-<PLAN KEY>%' OR FULL_KEY LIKE '<PROJECT KEY>-<PLAN KEY>-JOB%') AND MASTER_ID IS NULL;

For branch builds the syntax is slightly different. Locate the correct BRANCH_NUMBER by examining the BUILDKEY field in the BUILD table.

1 2 3 UPDATE BUILD SET NEXT_BUILD_NUMBER = 9999 WHERE FULL_KEY LIKE '<PROJECT KEY>-<PLAN KEY><BRANCH_NUMBER>%';
Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.