Buildkite CLI
The Buildkite CLI (
) provides terminal access to builds, jobs, pipelines, secrets, artifacts, clusters, and packages. Use it to trigger builds, tail logs, manage secrets, and automate CI/CD workflows without leaving the command line.
Quick Start
bash
# Install
brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
# Authenticate
bk configure
# Trigger a build on the current branch
bk build create --pipeline my-app
# Watch it run
bk build watch 42 --pipeline my-app
# View logs for a failed job
bk job log <job-id> --pipeline my-app --build 42
Installation
bash
brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
For binary downloads, shell completion, and verification, see
references/command-reference.md
.
Authentication
Run
to set the organization slug and API access token. This creates
on first run.
bash
bk configure
# Non-interactive (CI/Docker): bk configure --org my-org --token "$BUILDKITE_API_TOKEN" --no-input
Or use keychain-based auth (v3.31+):
Token creation
- Open Buildkite > user avatar > Personal Settings > API Access Tokens
- Select New API Access Token
- Grant scopes: , , , at minimum
- Copy the token and pass it to
For the full
subcommand reference and organization switching (
), see
references/command-reference.md
.
Builds
Manage pipeline builds — create, view, list, cancel, retry, and watch.
Create a build
bash
# Build the current branch and commit (pipeline auto-detected from repo)
bk build create
# Explicit pipeline
bk build create --pipeline my-app
# Build with environment variables and metadata
bk build create -e "FOO=BAR" -e "BAR=BAZ"
bk build create --branch feature/auth --commit abc1234 --env "DEPLOY_ENV=staging"
| Flag | Short | Default | Description |
|---|
| | auto-detected | Pipeline slug; resolved from repo context when omitted |
| | current branch | Git branch to build |
| | HEAD | Git commit SHA |
| | — | Build message |
| | — | Environment variables (repeatable) |
| | — | Load environment variables from a file |
| | — | Build metadata key=value (repeatable) |
View a build
bash
bk build view 42 --pipeline my-app
List builds
bash
# List recent builds for a pipeline
bk build list --pipeline my-app
# List only failed builds
bk build list --pipeline my-app --state failed
| Flag | Short | Default | Description |
|---|
| | — | Pipeline slug (omit for org-wide listing) |
| | — | Filter by state: , , , , , , , , , |
| | | Output format: , |
Watch a build
Stream real-time build progress to the terminal. Blocks until the build completes or is canceled.
bash
bk build watch 42 --pipeline my-app
Cancel a build
bash
bk build cancel 42 --pipeline my-app
The build must be in a
,
, or
state.
Retry a build
bash
bk build retry 42 --pipeline my-app
Build workflow: trigger and watch
Combine
and
for a complete trigger-and-follow workflow:
bash
# Trigger a build and immediately stream progress
bk build create --pipeline my-app --branch main && bk build watch --pipeline my-app
Jobs
Manage individual jobs within a build — view logs, retry failures, cancel running jobs.
View job logs
bash
bk job log <job-id> --pipeline my-app --build 42 --follow
| Flag | Short | Default | Description |
|---|
| | — | Pipeline slug (required) |
| | — | Build number (required) |
| | | Stream logs in real-time |
Retry a job
Each job ID can only be retried once — subsequent retries must use the new job ID returned by the first retry.
bash
bk job retry <job-id> --pipeline my-app --build 42
Cancel a job
bash
bk job cancel <job-id> --pipeline my-app --build 42
Debugging workflow: find failures and read logs
bash
# Find failed builds
bk build list --pipeline my-app --state failed
# View the build to identify which jobs failed
bk build view 42 --pipeline my-app
# Read logs for the failed job
bk job log <job-id> --pipeline my-app --build 42
Pipelines
Manage pipeline configuration — list, create, and update pipelines.
For converting pipelines from other CI systems, see the buildkite-migration skill.
Convert a pipeline from another CI system
Convert a GitHub Actions, Jenkins, CircleCI, Bitbucket, GitLab, Harness, or Bitrise pipeline to Buildkite YAML. No login required — uses a public API.
bash
# Auto-detect vendor from file path and save to .buildkite/pipeline.<vendor>.yml
bk pipeline convert -F .github/workflows/ci.yml
bk pipeline convert -F .circleci/config.yml
bk pipeline convert -F Jenkinsfile
# Specify vendor explicitly (required for gitlab, harness, bitrise)
bk pipeline convert -F .gitlab-ci.yml --vendor gitlab
# Custom output path
bk pipeline convert -F .github/workflows/ci.yml --output .buildkite/pipeline.yml
# Read from stdin
cat .github/workflows/ci.yml | bk pipeline convert --vendor github
| Flag | Short | Default | Description |
|---|
| | — | Path to source pipeline file (required unless using stdin) |
| | auto-detected | Source CI vendor: , , , , , , |
| | .buildkite/pipeline.<vendor>.yml
| Output file path |
| — | | Cancellation timeout in seconds |
List pipelines
Create a pipeline
bash
bk pipeline create --name "My App" --repository "git@github.com:org/my-app.git"
| Flag | Short | Default | Description |
|---|
| | — | Pipeline name (required) |
| | — | Git repository URL (required) |
| | — | Cluster UUID to assign the pipeline to |
| | — | Pipeline description |
For pipeline YAML configuration after creation, see the buildkite-pipelines skill.
Update a pipeline
bash
bk pipeline update my-app --description "Production application pipeline"
Secrets
Manage cluster-scoped secrets for pipelines. Secrets are encrypted and accessible to all agents within a cluster.
For using secrets inside pipeline YAML (
key) and inside job steps (
buildkite-agent secret get
), see the
buildkite-pipelines skill and
buildkite-agent-runtime skill respectively.
Create a secret
bash
bk secret create MY_SECRET --cluster my-cluster --value "$TOKEN"
| Flag | Short | Default | Description |
|---|
| | — | Cluster UUID or slug (required) |
| | — | Secret value (omit for interactive prompt) |
| | — | Human-readable description |
Naming rules:
- Keys must contain only letters, numbers, and underscores
- Keys cannot begin with or (case-insensitive)
- Exception: is allowed
List secrets
bash
bk secret list --cluster my-cluster
Update a secret
bash
bk secret update MY_SECRET --cluster my-cluster --value "$NEW_TOKEN"
Delete a secret
bash
bk secret delete MY_SECRET --cluster my-cluster
Artifacts
Upload and download build artifacts from the terminal.
Download artifacts
bash
bk artifact download "dist/*.tar.gz" --pipeline my-app --build 42
Upload artifacts
bash
bk artifact upload "dist/**/*" --pipeline my-app --build 42 --job <job-id>
For uploading artifacts from within a running job step, use
buildkite-agent artifact upload
— see the
buildkite-agent-runtime skill. For declaring artifact paths in pipeline YAML (
), see the
buildkite-pipelines skill.
Clusters
List and view clusters with
and
. For flags and examples, see
references/command-reference.md
.
For cluster creation, queue management, and infrastructure provisioning, see the buildkite-agent-infrastructure skill.
Packages
List registries with
and push packages with
bk package push <file> --registry <slug>
. For flags and supported formats, see
references/command-reference.md
.
For OIDC-based authentication to package registries (no static credentials), see the buildkite-secure-delivery skill.
Raw API Access
Make direct REST or GraphQL API calls with
(REST) or
bk api --graphql --data '<query>'
(GraphQL). For flags and examples, see
references/command-reference.md
.
For comprehensive REST and GraphQL API documentation (endpoints, mutations, pagination, webhooks), see the buildkite-api skill.
Users
Invite users with
bk user invite user@example.com
. See
references/command-reference.md
for details.
Pipeline Initialization
Scaffold a starter
with
. For pipeline YAML syntax and step types, see the
buildkite-pipelines skill. See
references/command-reference.md
for details.
MCP Server Alternatives
When the Buildkite MCP server is available, agents can use MCP tools for direct access without shell execution. The table below maps CLI commands to their MCP equivalents:
| CLI Command | MCP Tool | Notes |
|---|
| | MCP handles auth automatically |
| | MCP returns structured data |
| | MCP supports the same filters |
| , | MCP supports streaming |
| | |
| | |
| | |
| , | |
| | |
| , | |
bk secret create/list/delete
| — | No MCP equivalent; CLI required |
| — | No MCP equivalent; CLI required |
| — | No MCP equivalent; CLI required |
| — | No MCP equivalent; CLI required |
| — | No MCP equivalent; CLI required |
| — | Use MCP tools for read operations; CLI for custom API calls |
When to use CLI vs MCP: Use MCP tools when available — they handle authentication, pagination, and response parsing automatically. Fall back to the CLI when MCP does not cover the operation (secrets, packages, job retry, build watch) or when the agent needs to execute commands in a Bash workflow.
Common Mistakes
| Mistake | What happens | Fix |
|---|
| Running commands before | Every command fails with authentication errors | Run or first |
| Running in Docker/CI without | Hangs or fails trying to read from TTY or system keychain | Add flag: bk configure --org my-org --token "$TOKEN" --no-input
|
| Omitting on build commands | Command fails or targets the wrong pipeline | Always pass explicitly |
| Retrying a job ID that was already retried | API returns 422 error — each job ID can only be retried once | Use the new job ID returned by the first retry |
| Creating secrets with keys starting with or | Creation fails — reserved prefix | Choose a different key name (exception: ) |
| Passing secret values as literal strings in | Values persist in shell history and process list | Use env var references () or interactive prompts |
| Using on a completed build | API returns error — only , , or builds can be canceled | Check build state with first |
| Expecting to work cross-cluster | Artifacts are cluster-scoped by default | Ensure both pipelines are in the same cluster or configure cross-cluster artifact access |
| Confusing CLI with | runs on local machines to interact with the Buildkite API; runs inside CI job steps | Use from terminal, inside pipeline step commands |
Additional Resources
Reference Files
references/command-reference.md
— Full installation methods, auth subcommands, organization switching, and detailed flags/examples for clusters, packages, API access, users, and pipeline initialization
Further Reading