Repository navigation
Cancel jobs via the REST job cancel endpoint - #1034
Merged
Merged
Conversation
bk job cancel now calls PUT /v2/organizations/{org}/jobs/{job}/cancel
instead of the JobTypeCommandCancel GraphQL mutation. It still cancels
only the given job, keeps the confirmation prompt and --web flag, and
reports running jobs as canceling until their agent stops them.
Amp-Thread-ID: https://ampcode.com/threads/T-01a12dc6-687b-720e-a303-e67227202fa9
Co-authored-by: Amp <[email protected]>
Member
Author
|
@buildsworth-bk review |
go-buildkite v5.22.0 adds JobsService.CancelJobByOrg for the REST job cancel endpoint, so bk job cancel now calls it instead of a local request helper. Behaviour and output are unchanged. Amp-Thread-ID: https://ampcode.com/threads/T-01a12dc6-687b-720e-a303-e67227202fa9 Co-authored-by: Amp <[email protected]>
Member
Author
|
@buildsworth-bk review |
buildsworth-bk-app
Bot
dismissed
their stale review
October 12, 2026 06:57
Superseded by a newer Buildsworth review.
mitchbne
marked this pull request as ready for review
October 12, 2026 06:58
buildsworth-bk-app
Bot
dismissed
their stale review
October 12, 2026 07:01
Superseded by a newer Buildsworth review.
A canceling job doesn't only wait for its agent: Buildkite also finishes the cancellation when the agent is lost, when it's force-canceled, or after an hour in canceling. Say so in the help text and comment. Amp-Thread-ID: https://ampcode.com/threads/T-92eb1268-cb9f-42e4-a2d9-09d72ca6c99d Co-authored-by: Amp <[email protected]>
buildsworth-bk-app
Bot
dismissed
their stale review
October 12, 2026 07:10
Superseded by a newer Buildsworth review.
Amp-Thread-ID: https://ampcode.com/threads/T-56058c3c-45de-456a-aeb3-d8e85ebcdc13 Co-authored-by: Amp <[email protected]>
buildsworth-bk-app
Bot
dismissed
their stale review
October 12, 2026 07:26
Superseded by a newer Buildsworth review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
bk job cancelnow uses the new REST endpointPUT /v2/organizations/{org}/jobs/{job}/cancelinstead of theJobTypeCommandCancelGraphQL mutation. It still cancels only the given job; other jobs in the build keep running (bk build cancelcancels the whole build).The call uses
JobsService.CancelJobByOrgfrom go-buildkite v5.22.0, which this PR bumps to.A running job returns
canceling, so the command printsJob canceling: <url>in that case andJob canceled: <url>otherwise. The job stayscancelinguntil its agent stops it, or until Buildkite finishes the cancellation itself: when the agent is lost (no heartbeat for 3 minutes), when it's force-canceled, or after an hour incanceling. API errors (e.g. 422 "You can only cancel jobs that have started") are surfaced unchanged. The confirmation prompt,--yes,--no-input, and--webbehave as before.Context
Testing
go test ./...)go fmt ./...)Deployment
Release order (per Mitch): REST API ships → go-buildkite release → this PR → CLI release → skills.
JobsService.CancelJobByOrg) is released in v5.22.0 (tagv5.22.0→ bb77c7d), and this PR depends on that exact version.Rollback
Revert this PR to restore the GraphQL mutation. No data or config changes.
@buildsworth-bk approve up to L2