Buildkite Certification

Learn · Dependencies and flow control

Keys and depends_on

A wait is a blunt instrument. If your pipeline builds three services and only one of them needs a deploy step, a barrier makes all three wait for the slowest.

Explicit dependencies fix that. Give a step a key, and other steps can depend on it:

steps:
  - key: build
    command: make build

  - key: test
    depends_on: build
    command: make test

  - key: deploy
    depends_on: test
    command: make deploy

The key is the identifier other steps refer to. A label is for humans and is not a dependency target — this trips people up regularly.

A step can depend on several others:

  - key: release
    depends_on:
      - test
      - lint

Once you use depends_on, the pipeline is a graph rather than a sequence. Steps run as soon as their own dependencies are satisfied, regardless of what else is still going. That is where the real time savings come from: your linting does not wait for your integration suite just because it appears later in the file.

By default a step is skipped if something it depends on fails. When you want it to run anyway — a cleanup step, or a report — say so explicitly with allow_dependency_failure: true.

Check

Write a pipeline with three command steps keyed `build`, `test` and `deploy`. `test` depends on `build`, and `deploy` depends on `test`. Use explicit dependencies, not a wait.

Sign in to answer and record your progress.