CircleCI Ideas

Set CIRCLECI_BUILD_NUM in local builds

My request: Don't unset the `CIRCLECI_BUILD_NUM` in a local CircleCI build, please.

 

The local CircleCI build unset's it:

====>> Spin up Environment
Build-agent version 0.0.5763-f6bc418 (2018-05-22T19:06:47+0000)
Starting container [...]
using image [...]

Using build environment variables:
[...]
CIRCLE_BUILD_NUM=

That means you can't reset it with

circleci build --env CIRCLE_BUILD_NUM=manual-1

See also: https://discuss.circleci.com/t/setting-circle-build-num-in-local-builds/16743


We tag our Docker image builds with the `CIRCLECI_BUILD_NUM`. It would be nice that we can test the CircleCI build locally again. It was possible in an older CLI version.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • May 23 2018
  • Taking votes
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    August 09, 2018 02:24

    I could see if being good allowing you to pass any environment variable in. Include via a file would be fantastic, that also allows you to include project and context ones too, simple yaml would be great here.  Then a `--env` option to override any of those or supply any additional ones. 

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    20 Mar 13:43

    The ugly workaround for me was:

    if [[ -z $CIRCLE_BUILD_NUM ]]; then
    echo 'export CIRCLE_BUILD_NUM=xxx' >> $BASH_ENV
    fi
    In the command itself :(