如何跳过基于 Buldkite pipeline.yml 文件中环境变量的构建步骤?
How to skip a build step based on environment variable in Buldkite pipeline.yml file?
我有一个 pipeline.yml 用于 buildkite CI,它是:
steps:
- label: "Test"
command: test.sh
skip: "$BUILDKITE_BRANCH == 'mybranch'"
如果分支名称是 mybranch
,我想跳过构建步骤,但此设置在 buildkite 中似乎不起作用。这一步还是运行。我想知道如何在 skip
条件下使用环境变量。我知道我可以检查 test.sh
脚本中的环境,但我真的不想那样做。
skip
如果有任何值,将导致跳过该步骤。该值旨在指示跳过该步骤的原因,而不是评估为布尔值。
有一种内置方法可以使用 branch configuration 跳过特定分支的步骤:
steps:
- label: "Test"
command: test.sh
branches: "!mybranch"
最近还引入了一种使用更复杂规则的方法,称为 conditionals,尽管它可能比这里要求的要多:
steps:
- label: "Test"
command: test.sh
if: build.branch != "mybranch"
我有一个 pipeline.yml 用于 buildkite CI,它是:
steps:
- label: "Test"
command: test.sh
skip: "$BUILDKITE_BRANCH == 'mybranch'"
如果分支名称是 mybranch
,我想跳过构建步骤,但此设置在 buildkite 中似乎不起作用。这一步还是运行。我想知道如何在 skip
条件下使用环境变量。我知道我可以检查 test.sh
脚本中的环境,但我真的不想那样做。
skip
如果有任何值,将导致跳过该步骤。该值旨在指示跳过该步骤的原因,而不是评估为布尔值。
有一种内置方法可以使用 branch configuration 跳过特定分支的步骤:
steps:
- label: "Test"
command: test.sh
branches: "!mybranch"
最近还引入了一种使用更复杂规则的方法,称为 conditionals,尽管它可能比这里要求的要多:
steps:
- label: "Test"
command: test.sh
if: build.branch != "mybranch"