Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket Build Number Confusion

Bitwise DEVS
Contributor
September 20, 2023

We are currently reading this article and already using Bitbucket Build Number feature. However after reading it again makes us a bit confuse.

 

1. If branch develop BUILD NUMBER value is 30 and we merged it to master and triggers a build in pipeline, then will it become 31?

  • $BITBUCKET_BUILD_NUMBER values will be unique across all branches, meaning you can use it as a software build number that won’t clash with builds on other branches

2. If we rerun a pipeline build in master that is now having 31 as its BUILD NUMBER value, will it become 32?

  • rerunning a build will give it a new build number, also avoiding clashes and helping you track reruns better in the list of completed builds

3. Many said that BUILD NUMBER is equal to the current number of build in pipeline unless you did not do something.

Does rerunning a build pipeline will cause it to not get in synch with what is showing in pipeline tab? If yes, then how to see the current BUILD NUMBER value using cURL or RESTful API?

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 21, 2023

Hello @Bitwise DEVS and thank you for reaching out to Community!

Let me go through your questions and address them individually : 

If branch develop BUILD NUMBER value is 30 and we merged it to master and triggers a build in pipeline, then will it become 31?

You're correct, the build number is not tracked based on branches. It's a repository-wide counter that increases every build (doesn't matter to which branch), so each pipeline run will have a unique build number. The variable BITBUCKET_BUILD_NUMBER will be populated with the number of the current build.

If we rerun a pipeline build in master that is now having 31 as its BUILD NUMBER value, will it become 32?

Correct. Each pipeline run will receive a new build number which is +1 to the last pipeline executed in the repository.

 

Many said that BUILD NUMBER is equal to the current number of build in pipeline unless you did not do something.

Does rerunning a build pipeline will cause it to not get in synch with what is showing in pipeline tab? If yes, then how to see the current BUILD NUMBER value using cURL or RESTful API?

The environment variable BITBUCKET_BUILD_NUMBER will always be in sync with what is showing on the pipeline page.

Hope that helps! If you have any follow-up questions feel free to ask.

Thank you, @Bitwise DEVS !

Patrik S

Bitwise DEVS
Contributor
October 27, 2023

Thank you so much for spending a time answering my questions, really appreciate it!

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events