Documentation
¶
Index ¶
Constants ¶
const ( // DefaultMaxConsecutiveErrors is the number of consecutive polling failures // before the watch loop aborts. DefaultMaxConsecutiveErrors = 10 // DefaultRequestTimeout is the per-request timeout for each polling call. DefaultRequestTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsTerminalBuildState ¶
IsTerminalBuildState returns true if the build state is a terminal state.
func WatchBuild ¶
func WatchBuild( ctx context.Context, client *buildkite.Client, org, pipeline string, buildNumber int, interval time.Duration, onStatus StatusFunc, ) (buildkite.Build, error)
WatchBuild polls a build until it reaches a terminal state (FinishedAt != nil). It calls onStatus after each successful poll so callers can render progress.
Types ¶
type BuildStatus ¶
type BuildStatus struct {
NewlyFailed []buildkite.Job
Running []buildkite.Job
TotalRunning int
Summary JobSummary
Build buildkite.Build
}
BuildStatus is the output of JobTracker.Update().
type FormattedJob ¶
FormattedJob wraps a Buildkite job with watch-specific formatting and classification helpers.
func NewFormattedJob ¶
func NewFormattedJob(j buildkite.Job) FormattedJob
NewFormattedJob wraps a Buildkite job.
func (FormattedJob) DisplayName ¶
func (j FormattedJob) DisplayName() string
DisplayName returns a human-readable name for a job.
func (FormattedJob) Duration ¶
func (j FormattedJob) Duration() time.Duration
Duration returns the elapsed duration for a job.
func (FormattedJob) IsFailed ¶
func (j FormattedJob) IsFailed() bool
func (FormattedJob) IsSoftFailed ¶
func (j FormattedJob) IsSoftFailed() bool
func (FormattedJob) IsTerminalFailureState ¶
func (j FormattedJob) IsTerminalFailureState() bool
type JobSummary ¶
type JobSummary struct {
Passed int
Failed int
SoftFailed int
Running int
Scheduled int
Blocked int
Skipped int
Waiting int
}
JobSummary aggregates job counts by high-level state.
func (JobSummary) String ¶
func (s JobSummary) String() string
String returns a human-readable summary of non-zero job counts.
type JobTracker ¶
type JobTracker struct {
// contains filtered or unexported fields
}
JobTracker tracks job state changes across polls.
func (*JobTracker) AllFailed ¶
func (t *JobTracker) AllFailed() []buildkite.Job
AllFailed returns all failed jobs.
func (*JobTracker) Update ¶
func (t *JobTracker) Update(b buildkite.Build) BuildStatus
Update processes a build and returns the current status with any state changes.
type StatusFunc ¶
StatusFunc is called on each successful poll with the latest build state. Returning an error aborts the watch loop and propagates that error to the caller.