Documentation
¶
Index ¶
- Variables
- func ArtifactSummary(artifact *buildkite.Artifact) string
- func DownloadToFile(ctx context.Context, client *buildkite.Client, url, destPath string) error
- func FormatBytes(bytes int64) string
- func IsDownload(ctx context.Context) bool
- func List(ctx context.Context, client *buildkite.Client, ...) ([]buildkite.Artifact, error)
- func ValidateState(state string) error
Constants ¶
This section is empty.
Variables ¶
var AllowedStates = []string{"new", "finished", "error", "deleted", "expired"}
AllowedStates is the closed set of artifact states the Buildkite API accepts as the state filter. Exposed so callers can reference the same list in help text and up-front validation.
See https://buildkite.com/docs/apis/rest-api/artifacts#list-artifacts-for-a-build
Functions ¶
func ArtifactSummary ¶
ArtifactSummary renders a summary of a build artifact
func DownloadToFile ¶ added in v3.55.0
DownloadToFile creates destPath (including any missing parent directories) and streams the artifact at url into it.
func FormatBytes ¶
FormatBytes formats bytes into human-readable format (KB, MB, GB, etc.)
func IsDownload ¶ added in v3.65.0
IsDownload reports whether ctx belongs to an artifact payload request. HTTP redirects preserve this context, so debug logging can omit payload bodies without relying on their URL or content type.
func List ¶ added in v3.55.0
func List(ctx context.Context, client *buildkite.Client, org, pipeline, build, jobUUID string, paths []string, state string) ([]buildkite.Artifact, error)
List fetches all artifacts for a build, or for a specific job when jobUUID is non-empty, paginating through all results.
paths and state are optional server-side filters. Paths are queried separately and results are deduplicated by artifact ID, preserving first-seen order. Wildcard matching is left to the API. state is validated and lower-cased.
func ValidateState ¶ added in v3.55.0
ValidateState rejects state values the Buildkite API won't accept, so a typo like "finshed" surfaces as a validation error instead of silently returning zero artifacts.
An empty string is treated as "no filter" and always accepted. Comparison is case-insensitive so callers can pass user input verbatim.
Types ¶
This section is empty.