Skip to content

Commit

Permalink
Rename pages/pipelines/defining_steps.md to pipeline.yml
Browse files Browse the repository at this point in the history
```
{: codeblock-file="pipeline.yml"}

## Dynamic pipeline templates

If you need the ability to use pipelines from a central catalog, or enforce certain configuration rules, you can either use dynamic pipelines and the [`pipeline upload`](/docs/agent/v3/cli-pipeline#uploading-pipelines) command to make this happen or [write custom plugins](/docs/plugins/writing) and share them across your organization.

To use dynamic pipelines and the pipeline upload command, you'd make a pipeline that looks something like this:

```yml
steps:
  - command: enforce-rules.sh | buildkite-agent pipeline upload
    label: "\:pipeline\: Upload"
```

Each team defines their steps in `team-steps.yml`. Your templating logic is in `enforce-rules.sh`, which can be written in any language that can pass YAML to the pipeline upload.

In `enforce-rules.sh` you can add steps to the YAML, require certain versions of dependencies or plugins, or implement any other logic you can program. Depending on your use case, you might want to get `enforce-rules.sh` from an external catalog instead of committing it to the team repository.

See how [Hasura.io](https://hasura.io) used [dynamic templates and pipelines](https://hasura.io/blog/what-we-learnt-by-migrating-from-circleci-to-buildkite/#dynamic-pipelines) to replace their YAML configuration with Go and some shell scripts.

## Targeting specific agents

To run [command steps](/docs/pipelines/command-step) only on specific agents:

1. In the agent configuration file, [tag the agent](/docs/agent/v3/cli-start#setting-tags)
2. In the pipeline command step, [set the agent property](/docs/agent/v3/cli-start#agent-targeting) in the command step

For example to run commands only on agents running on macOS:

```yaml
steps:
  - command: "script.sh"
    agents:
      os: "macOS"
```
{: codeblock-file="pipeline.yml"}

## Further documentation

You can also upload pipelines from the command line using the `buildkite-agent` command line tool. See the [buildkite-agent pipeline documentation](/docs/agent/v3/cli-pipeline) for a full list of the available parameters.
  • Loading branch information
Juan5212 authored Oct 8, 2024
1 parent 7b9863f commit a435286
Showing 1 changed file with 0 additions and 0 deletions.
File renamed without changes.

0 comments on commit a435286

Please sign in to comment.