Advanced Logic in Config

I’m happy to announce the recent addition of advanced
config-compile-time logic statements to config version 2.1. This is
part of our initiative to give users greater control over the work to
perform.

With logic statements you can combine literal values, pipeline values,
and pipeline parameters in various ways to produce arguments for when
stanzas in workflows and when steps.

A brief example:

my-job:
  steps:
    when:
      condition:
        or:
          - << pipeline.parameters.run-deploy >>
          - equal: [ master, << pipeline.git.branch >> ]
      steps:
        - run: ./deploy

This step will run on master, or if you specify the run-deploy
pipeline parameter via the API to trigger a manual deployment.

Head to the documentation or the configuration cookbook for more
details and examples.

5 Likes

This is a game changer