Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions finish.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ type FinishJobRequest struct {
JobUUID string `json:"-"`
ExitStatus int `json:"exit_status,omitempty"`
Detail string `json:"detail"`
// SignalReason optionally records why the stack terminated the job (for
// example "stack_error"), giving the job a machine-readable failure
// reason alongside the human-readable Detail. Known values match the
// signal reasons documented for retry rules:
// https://buildkite.com/docs/pipelines/configure/retry
SignalReason string `json:"signal_reason,omitempty"`
}

func (c *Client) FinishJob(ctx context.Context, finishJobReq FinishJobRequest, opts ...RequestOption) (http.Header, error) {
Expand Down
14 changes: 8 additions & 6 deletions finish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ func TestFinishJob(t *testing.T) {
}

expectedParams := FinishJobRequest{
ExitStatus: -10,
Detail: "show me the money",
ExitStatus: -10,
Detail: "show me the money",
SignalReason: "stack_error",
}

if diff := cmp.Diff(expectedParams, params); diff != "" {
Expand All @@ -39,10 +40,11 @@ func TestFinishJob(t *testing.T) {
t.Cleanup(func() { server.Close() })

req := FinishJobRequest{
StackKey: "stack-123",
JobUUID: "456",
ExitStatus: -10,
Detail: "show me the money",
StackKey: "stack-123",
JobUUID: "456",
ExitStatus: -10,
Detail: "show me the money",
SignalReason: "stack_error",
}

header, err := client.FinishJob(t.Context(), req)
Expand Down