We’ve heard your feedback loud and clear – Bitbucket Pipelines needed build numbers, something you can use as a unique numeric identifier in your build and deployment pipeline.
Today I’m happy to announce that we’ve shipped $BITBUCKET_BUILD_NUMBER – an incrementing build number for each build in your repository that is available as an environment variable. All previous builds have been numbered as well, and you’ll see the new number appearing in your Pipelines UI.
Pipeline #23704, reporting for duty!
A few neat things about this feature:
- $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
- 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
- you can increment the build number to a new starting point using our REST API, which is handy if you’re moving from another tool.
Note that this feature doesn’t aim to provide semantic versioning or branch-specific version numbers (i.e. version numbers for humans). You can find other tools out there that will do this for you, like the wonderful semantic-release.
We hope you like this small but important addition to Pipelines.