Buildkite CI/CD
Investigate Buildkite builds, diagnose failures, and answer questions about pipeline status.
Arguments
$ARGUMENTS
Constraints
- Never assume CLI subcommands or flags. If unsure, run
bk <command> --help first.
- The
bk CLI uses -p for pipeline and -b for branch/build-number. Always check --help for the specific command.
- Use
--no-timestamps with bk job log for cleaner output.
- Use
-o json when you need structured data for analysis.
Instructions
1. Parse Input
Determine what the user is asking about:
- Build URL (e.g.,
https://buildkite.com/org/pipeline/builds/123) → extract org, pipeline slug, build number
- Build number → use with current repo's pipeline
- "latest" or no number → use
bk build view without a number (resolves to current branch)
- General question → use
bk build list or bk job list with appropriate filters
2. Identify Pipeline
If not specified, infer from the current git repo. The bk CLI auto-detects pipeline when inside a repo.
If pipeline is ambiguous or bk can't detect it, use -p <pipeline-slug>.
3. Investigate
For build failures:
bk build view <number> -o json — get build state and job list
- Find failed jobs (state:
failed, non-zero exit_status)
bk job log <job-id> -p <pipeline> -b <build-number> --no-timestamps — get failure logs
- Read from the end of logs — errors are usually at the bottom
- For large logs, focus on lines near
exit_status, error, failed, or Error
For general status:
bk build list -p <pipeline> — recent builds
bk build view — latest build on current branch
bk job list -p <pipeline> --state failed — recent failures
4. Diagnose
When analyzing failures:
- Exit status codes:
-1 = agent lost, 255 = forced agent shutdown, 1 = command failure, 17 = docker-compose plugin failure
- Docker build failures: Look for
failed to solve: messages
- Plugin failures: Look for
plugin <name> command hook exited with status
- Infrastructure: Look for agent timeouts, OOM, disk space issues
- Test failures: Look for test framework output (go test, bats, jest, etc.)
5. Report
Provide a concise summary:
- Which step(s) failed
- Root cause (quote the key error lines)
- Suggested fix if apparent
Examples
/bk 91 → investigate build 91
/bk https://buildkite.com/gusto/my-pipe/builds/42 → investigate from URL
/bk latest → check latest build on current branch
/bk why did this fail → latest build, find failures
/bk list failed builds → recent failures for current pipeline
1---2name: bk3description: Use when checking Buildkite CI/CD builds, investigating failures, viewing job logs, or answering questions about pipeline status.4---5
6# Buildkite CI/CD
7
8Investigate Buildkite builds, diagnose failures, and answer questions about pipeline status.
9
10## Arguments
11
12```
13$ARGUMENTS
14```
15
16## Constraints
17
18- **Never assume CLI subcommands or flags.** If unsure, run `bk <command> --help` first.
19- The `bk` CLI uses `-p` for pipeline and `-b` for branch/build-number. Always check `--help` for the specific command.
20- Use `--no-timestamps` with `bk job log` for cleaner output.
21- Use `-o json` when you need structured data for analysis.
22
23## Instructions
24
25### 1. Parse Input
26
27Determine what the user is asking about:
28
29- **Build URL** (e.g., `https://buildkite.com/org/pipeline/builds/123`) → extract org, pipeline slug, build number
30- **Build number** → use with current repo's pipeline
31- **"latest"** or no number → use `bk build view` without a number (resolves to current branch)
32- **General question** → use `bk build list` or `bk job list` with appropriate filters
33
34### 2. Identify Pipeline
35
36If not specified, infer from the current git repo. The `bk` CLI auto-detects pipeline when inside a repo.
37
38If pipeline is ambiguous or `bk` can't detect it, use `-p <pipeline-slug>`.
39
40### 3. Investigate
41
42**For build failures:**
43
441. `bk build view <number> -o json` — get build state and job list
452. Find failed jobs (state: `failed`, non-zero `exit_status`)
463. `bk job log <job-id> -p <pipeline> -b <build-number> --no-timestamps` — get failure logs
474. Read from the end of logs — errors are usually at the bottom
485. For large logs, focus on lines near `exit_status`, `error`, `failed`, or `Error`
49
50**For general status:**
51
52- `bk build list -p <pipeline>` — recent builds
53- `bk build view` — latest build on current branch
54- `bk job list -p <pipeline> --state failed` — recent failures
55
56### 4. Diagnose
57
58When analyzing failures:
59
60- **Exit status codes**: `-1` = agent lost, `255` = forced agent shutdown, `1` = command failure, `17` = docker-compose plugin failure
61- **Docker build failures**: Look for `failed to solve:` messages
62- **Plugin failures**: Look for `plugin <name> command hook exited with status`
63- **Infrastructure**: Look for agent timeouts, OOM, disk space issues
64- **Test failures**: Look for test framework output (go test, bats, jest, etc.)
65
66### 5. Report
67
68Provide a concise summary:
69- Which step(s) failed
70- Root cause (quote the key error lines)
71- Suggested fix if apparent
72
73## Examples
74
75```
76/bk 91 → investigate build 91
77/bk https://buildkite.com/gusto/my-pipe/builds/42 → investigate from URL
78/bk latest → check latest build on current branch
79/bk why did this fail → latest build, find failures
80/bk list failed builds → recent failures for current pipeline
81```