1. Resources
  2. /
  3. Examples
  4. /
  5. Dynamic Pipeline

Buildkite Dynamic Pipeline Steps Example

This repository is an example Buildkite pipeline that shows how to programmatically generate dynamic steps using a shell script.

See the full Getting Started Guide for step-by-step instructions on how to get this running.

Screenshot of Buildkite dynamic pipeline example

How does it work?

This pipeline starts with a single job that runs:

.buildkite/pipeline.sh | buildkite-agent pipeline upload

The script .buildkite/pipeline.sh does the following:

  • Creates a test step for each subdirectory in specs
  • Adds a deploy step if the build is on the main branch

For non-main branches build it generates:

steps:
  - command: "specs/controllers/test.sh"
    label: "controllers"
  - command: "specs/features/test.sh"
    label: "features"
  - command: "specs/models/test.sh"
    label: "models"

For a main branch build it generates:

steps:
  - command: "specs/controllers/test.sh"
    label: "controllers"
  - command: "specs/features/test.sh"
    label: "features"
  - command: "specs/models/test.sh"
    label: "models"
  - wait
  - command: "echo Deploy!"
    label: ":rocket:"

More ideas

What else could you do? The possibilities are endless. You can use this technique for custom deploy workflows, QA gates, conditional rollbacks, etc.

Tools like Jobsworth use dynamic steps to manage complex deployment logic.

License

See LICENSE.md (MIT)

More examples

Start turning complexity into an advantage

Create an account to get started with a 30-day free trial. No credit card required.

Buildkite Pipelines

Platform

  1. Pipelines
  2. Public pipelines
  3. Test Engine
  4. Package Registries
  5. Mobile Delivery Cloud
  6. Pricing

Hosting options

  1. Self-hosted agents
  2. Mac hosted agents
  3. Linux hosted agents

Resources

  1. Docs
  2. Blog
  3. Changelog
  4. Example pipelines
  5. Plugins
  6. Webinars
  7. Case studies
  8. Events
  9. Migration Services
  10. Comparisons

Company

  1. About
  2. Careers
  3. Press
  4. Brand assets
  5. Contact

Solutions

  1. Replace Jenkins
  2. Workflows for AI/ML
  3. Testing at scale
  4. Monorepo mojo
  5. Bazel orchestration

Legal

  1. Terms of Service
  2. Acceptable Use Policy
  3. Privacy Policy
  4. Subprocessors
  5. Service Level Agreement

Support

  1. System status
  2. Forum
© Buildkite Pty Ltd 2025