Documentation
¶
Overview ¶
Package agent talks to the Buildkite Agent API (agent.buildkite.com).
This is deliberately separate from internal/api, which talks to the Test Engine API with a different base URL and a different access token. The Agent API is the service that owns a running job, so it is the only place that can accept a "promised failure" for that job.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PromiseFailure ¶
func PromiseFailure(ctx context.Context, httpClient *http.Client, endpoint string, accessToken string, jobID string, exitStatus int, reason string) error
PromiseFailure tells the Buildkite Agent API that the current job is going to finish with a non-zero exit status, before the job actually exits. This lets the build "cascade" to failing early.
It mirrors the curl the cascade-test pipelines use:
PUT {endpoint}/jobs/{jobID}/promise_failure
Authorization: Token {accessToken}
Content-Type: application/json
{"exit_status": 1, "reason": "..."}
endpoint and accessToken come from the job environment (BUILDKITE_AGENT_ENDPOINT and BUILDKITE_AGENT_ACCESS_TOKEN), which the agent injects into every job.
This call is best-effort by contract: callers should log a failure and carry on, never changing the test run's real exit status because of a promise error.
Types ¶
This section is empty.