diff --git a/finish.go b/finish.go index b66bf30..80b6306 100644 --- a/finish.go +++ b/finish.go @@ -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) { diff --git a/finish_test.go b/finish_test.go index cfb7e7a..f78cea5 100644 --- a/finish_test.go +++ b/finish_test.go @@ -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 != "" { @@ -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)