Skip to main content
1

Configure Secrets in BuildKite: Create a Trunk API key and add it to BuildKite's secret store named TRUNK_API_TOKEN

The key doesn’t need any permissions.
2

Configure BuildKite to export CI data to Trunk: connecting BuildKite's OTEL data allows us to learn the behavior of your CI jobs

3

Paste a BuildKite API token with the read_builds and read_organizations scopes into Settings → Organization → Buildkite. Use a token from a dedicated BuildKite user.

Give your steps keys

Add a key: to every step you might want skipped. A step without one always runs.

Start with a dry run

Add this step to each pull request pipeline that runs your tests and checks. Trunk records verdicts, and your pipeline is unchanged.
Use the same if: and agents: as your other pull request steps.

Add the plugin to your upload step

When you are ready to skip steps, pipe your pipeline through the filter on its way to upload:
  • Pin an exact release, v0.1.3 or later.
  • Don’t pass --no-interpolation to buildkite-agent pipeline upload.
  • trigger: steps are never skipped. Matrix and parallelism: legs skip together.

Mark steps that must never be skipped

Trunk can’t tell which Buildkite steps are required to merge. Before you turn on enforcement, list them in exclude-keys:
Or set them to Always run in Dynamic CI → your repository → Configuration.
If your pipeline lives in Buildkite’s settings editor, put the plugin on the step itself with mode: step. The step needs a key:. It saves less, because the agent has already started, and a skipped step reports as passed.
If your build tool measures how much of the codebase a change affects, such as a count of affected packages, send it so Trunk runs broad changes. Export it as a JSON list in the upload step’s command, before the filter runs:
  • source: your name for the measure (lowercase letters, digits, ., _, -). Keep it the same on every build.
  • count: a whole number. Send 0 when nothing is affected.
  • all: true in place of count when everything is affected.
Leave the variable unset when your tool computed nothing. A bad entry is dropped with a warning, and the build continues. Ask us to turn the signal on and set each step’s limit.

Troubleshooting

Set debug: true to print what the plugin asked for and the plan it got back.
  • Nothing is skipped. Check the repository is Enforced, the steps have a key:, and Trunk has a couple of days of builds for them.
  • The plan request returns 404. The pipeline’s remote doesn’t match a repository in your Trunk organization with CI data.
  • baseSha is null on a pull request build. Fetch the target branch before the upload step.
Builds without a pull request, such as pushes to your default branch, can be skipped. Force overrides from the browser extension are not available for Buildkite yet.

Next

Turn on enforcement. To stop using Dynamic CI, remove the plugin or set the repository back to Learning. For merge-queue behaviour, see Merge queues.