# How can I overwrite the BITRISE\_BUILD\_NUMBER env var for a single build?

**URL:** https://discuss.bitrise.io/t/how-can-i-overwrite-the-bitrise-build-number-env-var-for-a-single-build/4158
**Category:** Question & Answer
**Created:** [February 15, 2018, 9:19am UTC](https://discuss.bitrise.io/t/how-can-i-overwrite-the-bitrise-build-number-env-var-for-a-single-build/4158 "2018-02-15T09:19:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)
#### Post date: [February 15, 2018, 9:19am UTC](https://discuss.bitrise.io/t/how-can-i-overwrite-the-bitrise-build-number-env-var-for-a-single-build/4158/1 "2018-02-15T09:19:29Z")

</div>

How can I overwrite the BITRISE\_BUILD\_NUMBER env var for a single build?

E.g. if I re-run a specific commit, it’ll run with a new build number, which might be invalid since it won’t line up directly in chronological order. Is it possible to specify a previous build number for the build?

---

<div class="post-metadata">

### Author: ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)
#### Post date: [February 15, 2018, 9:22am UTC](https://discuss.bitrise.io/t/how-can-i-overwrite-the-bitrise-build-number-env-var-for-a-single-build/4158/2 "2018-02-15T09:22:06Z")

</div>

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](http://bitrise.io) for a single build:

1. Trigger the build manually, using the “ **Start/Schedule a build** ” button
2. Switch to **Advanced** mode in the popup
3. Specify the env var you want to overwrite in “ **Custom Environment Variables** ”

 ![28](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/a/ab6c2dcd5c4a3bdbe4d2e1a87ca59d88404154cd.png)

_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](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.
