Using ENVIRONMENT VARIABLE at conditional steps.

steps:
    - when:
        condition: ${CONDITION_BUILD}
        steps:
            - checkout

            ...

In this case I want to pass "true" or "false" via ENVIRONMENT VARIABLE from Dashboard.

  • Guest
  • Apr 4 2019
  • Not planned
  • Attach files
  • Mario Wolff commented
    29 Jul 08:27

    We also request this feature. We discovered changes to our K8S clusters that causes downtimes. Whenever such a change is required, we build a mirror cluster with the change, deploy to both clusters, do integration tests with the new setting and turn the DNS to mirror. Then we stop deployment to the first cluster and remove it. For the next critical change the process starts over.

    Currently we change the config in all projects, but thats gets harder and harder with every new project.

  • Matthew Morrissette commented
    23 Jun 19:33

    I need this because we use forked repositories to manage access control to sensitive secrets as we're a BitBucket organization and can't use context security and we need the ability to vary which build steps run based on the fork (which could be set in environment variables).

  • Nathan Dintenfass commented
    April 04, 2019 21:51

    I'm going to mark this as Not Planned because we don't have a way to do it with Environment Variables, but do know that this kind of dynamism is very much on our mind. We plan to introduce the variables in config I described, and we're also looking at ways to more dynamically set the environment at runtime (for instance, having the ability to run some kind of setup job that would let you dynamically set the config based on the state of your code).

  • Guest commented
    April 04, 2019 18:50

    I have a repo that builds 6 Dockerfiles.
    When I update one of them I'd like to build only this one, without touching the `config.yml`.
    So I thought that setting all 5 dockerfiles to "CONDITION_BUILD_1, _2, ..., _5 = false" and leaving just "CONDITION_BUILD_6 = true" on CircleCI dashboard would be great.
    With this I'd avoid waiting to all the untouched Dockerfiles be built.

  • Nathan Dintenfass commented
    April 04, 2019 18:42

    We can't use Env Vars in this context because those are resolved at runtime, whereas the `when` clause is resolved during configuration processing. We do plan to introduce pipeline-level variables in config that would you set a single variable either inside of config or when triggering your pipeline via the API, which would solve for some cases of wanting to do this. Can you elaborate a bit on what the scenarios are that would cause you do change this value?