That’s a good question! Indeed the build number is a constantly increasing number and not designed to be reused in another build.
Fortunately there’s a fairly simple option to overwrite the build number or any default env var exposed by bitrise.io for a single build:
- Trigger the build manually, using the “Start/Schedule a build” button
- Switch to Advanced mode in the popup
- Specify the env var you want to overwrite in “Custom Environment Variables”
You can of course do this via the API as well, more info & the related docs: http://devcenter.bitrise.io/api/build-trigger/#specify-environment-variables
This way, for this single build the BITRISE_BUILD_NUMBER env var will be overwritten with the value you provide.
Of course the build number on the web UI won’t reflect this, as that’s not read from this variable, but any script in the build will get the value you specify.