Debugging Failed Builds
Diagnose and fix failed Buildkite builds.
Load skills: using-buildkite
Workflow
1. Watch the Build
Wait for the build to finish (or start failing):
bk build watch -p pipeline -b my-branch
2. Find Failed Jobs
bk build list -p org/pipeline --branch my-branch --limit 1 -o json | jq '.[0].jobs[] | select(.state == "failed" or .state == "timed_out") | {id, name, web_url}'
3. Read Job Logs
For each failed job, fetch the log and look for errors:
bk job log <job-id> -p org/pipeline -b <build-number> --no-timestamps | tail -n 200
4. Search for Errors
bk job log <job-id> -p org/pipeline -b <build-number> --no-timestamps | grep -i error -C 3
5. Check for Test Failures
If the failed job ran tests, get the test run IDs and hand off to the debugging-failed-tests skill:
ruby scripts/test_runs.rb org/pipeline <build_number>
