Skip to content

buildkite/dynamic-pipeline-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Buildkite Dynamic Pipeline Steps Example

Build status Add to Buildkite

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

👉 See this example in action: buildkite/dynamic-pipeline-example

See the full Getting Started Guide for step-by-step instructions on how to get this running, or try it yourself:

Add to Buildkite

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)

About

An example pipeline that dynamically generates steps using a shell script.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages