I have a pipeline.yml for buildkite CI which is:
steps:
- label: "Test"
command: test.sh
skip: "$BUILDKITE_BRANCH == 'mybranch'"
I want to skip the build step if the branch name is mybranch
but this setting doesn't seem to work in buildkite. This step is still run. I wonder how I can use environment variable in skip
condition. I know I can check the environment inside test.sh
script but I don't really want to do that.
skip
will cause the step to skipped if it has any value. The value is intended to indicate why the step was skipped, and is not evaluated as a boolean.
There is a built-in way to skip steps for specific branches using branch configuration instead:
steps:
- label: "Test"
command: test.sh
branches: "!mybranch"
There is also a recently introduced way to use more complex rules called conditionals, although it might be more than is required here:
steps:
- label: "Test"
command: test.sh
if: build.branch != "mybranch"