Conditional priority on a pipeline step

Is it possible to conditionally set the priority of a step? For example, I’d like to set the priority of a step to 1 if BUILDKITE_BRANCH is equal to master, otherwise set it to 0.

E.g. something like:

- label: "example step"
  priority: if branch == master then 1 else 0

I can’t find anything in the docs to suggest this is or is not possible.

Thanks!

Hi @austin-artificial and welcome to Buildkite! :wave:

You can’t tell a step to flip its priority on the fly with a one-liner in YAML—at least not today. You’ll need to either define separate steps with different priorities and conditions (Defining Steps) or use a dynamic pipeline script that checks BUILDKITE_BRANCH and sets the priority accordingly before sending the final pipeline config. It’s not as tidy as a single if/else, but it does the trick!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.