How to restrict steps to specific agents?

Hi, I can’t find in the documentation how to restrict certain steps to be run by specific agents, and in particular certain OSs.

I have a pipeline that runs on Linux but parts of it also need to run on macOS. How do I specify the steps to run on specific agents?

This seems to be already possible according to this gist, but I can’t find the general documentation for the agents keyword in https://buildkite.com/docs/pipelines.

Hey @jorgecarleitao and welcome! :wave:

That gist looks like what you need! You can find the documentation under the optional attributes that are accepted for the step Command Step | Buildkite Documentation (there is also some more documentation about agent targeting here buildkite-agent start v3 | Buildkite Documentation).

1 Like

Thanks, @jason. I see.

I guess two natural suggestions for the documentation:

  1. who writes pipeline.yml is not the persona that configures agents. Therefore, the documentation about agent selection could (also?) be in the pipeline documentation.
  2. AFAI understood, the agent selection is not an optional argument of command, but an optional argument of the whole step. I would move its content to another place (or a section of its own, as it is a pretty important part of the step configuration.