Documentation
¶
Index ¶
- func Cleanup(dir string, ref string, debug bool) error
- func CleanupRefs(dir string, refs []string, debug bool) error
- func RepositoryRoot(dir string, debug bool) (string, error)
- func ResolveBuilds(ctx context.Context, client *buildkite.Client, org, pipeline string, ...) error
- func ValidateExitPolicies(policies []ExitPolicy, watch bool) error
- type BranchBuild
- type ExitPolicy
- type FileChange
- type RunSummaryFailure
- type RunSummaryGetOptions
- type RunSummaryLatestFail
- type RunSummaryResponse
- type RunSummaryRun
- type RunSummaryService
- type RunSummarySuite
- type RunSummaryTests
- type SnapshotOption
- type SnapshotResult
- type SourceContext
- type SummaryFailureDetail
- type SummaryOptions
- type SummaryResult
- type SummaryTestFailure
- type SummaryTestRun
- type SummaryTests
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶
Cleanup deletes the preflight branch from the remote. If the branch no longer exists on the remote, it is treated as success.
func CleanupRefs ¶ added in v3.35.2
CleanupRefs deletes multiple refs from the remote in a single git push. Refs that no longer exist on the remote are silently ignored.
func RepositoryRoot ¶ added in v3.35.0
RepositoryRoot returns the top-level path for the git repository containing dir.
func ResolveBuilds ¶ added in v3.35.2
func ResolveBuilds(ctx context.Context, client *buildkite.Client, org, pipeline string, branches []BranchBuild) error
ResolveBuilds looks up the most recent build for each preflight branch and populates the Build field. Branches with no matching build retain a nil Build.
func ValidateExitPolicies ¶ added in v3.38.0
func ValidateExitPolicies(policies []ExitPolicy, watch bool) error
Types ¶
type BranchBuild ¶ added in v3.35.2
BranchBuild represents a preflight branch and its associated build status.
func ListRemotePreflightBranches ¶ added in v3.35.2
func ListRemotePreflightBranches(dir string, debug bool) ([]BranchBuild, error)
ListRemotePreflightBranches returns all remote branches matching bk/preflight/*.
func LookupRemotePreflightBranch ¶ added in v3.35.2
func LookupRemotePreflightBranch(dir, uuid string, debug bool) (*BranchBuild, error)
LookupRemotePreflightBranch returns the remote bk/preflight/<uuid> branch if it exists, or nil if no such branch is present on the remote.
func (BranchBuild) IsCompleted ¶ added in v3.35.2
func (bb BranchBuild) IsCompleted() bool
IsCompleted returns true if the associated build has reached a terminal state (passed, failed, canceled, etc.), or if no build was found for the branch.
type ExitPolicy ¶ added in v3.38.0
type ExitPolicy int
const ( ExitOnBuildFailing ExitPolicy = iota ExitOnBuildTerminal )
func EffectiveExitPolicy ¶ added in v3.38.0
func EffectiveExitPolicy(policies []ExitPolicy) ExitPolicy
func (*ExitPolicy) UnmarshalText ¶ added in v3.38.0
func (p *ExitPolicy) UnmarshalText(text []byte) error
type FileChange ¶
FileChange represents a single file changed in the snapshot.
func (FileChange) StatusSymbol ¶
func (f FileChange) StatusSymbol() string
StatusSymbol returns a human-readable symbol for the file change status.
type RunSummaryFailure ¶ added in v3.37.0
type RunSummaryFailure struct {
RunID string `json:"run_id"`
SuiteName string `json:"suite_name"`
SuiteSlug string `json:"suite_slug"`
Name string `json:"name"`
Location string `json:"location"`
FailureReason string `json:"failure_reason"`
LatestFail *RunSummaryLatestFail `json:"latest_fail,omitempty"`
}
type RunSummaryGetOptions ¶ added in v3.37.0
type RunSummaryLatestFail ¶ added in v3.37.0
type RunSummaryLatestFail struct {
FailureReason string `json:"failure_reason"`
FailureExpanded []buildkite.FailureExpanded `json:"failure_expanded,omitempty"`
}
type RunSummaryResponse ¶ added in v3.37.0
type RunSummaryResponse struct {
Tests RunSummaryTests `json:"tests"`
}
func (RunSummaryResponse) SummaryResult ¶ added in v3.37.0
func (r RunSummaryResponse) SummaryResult() SummaryResult
type RunSummaryRun ¶ added in v3.37.0
type RunSummaryRun struct {
Suite RunSummarySuite `json:"suite"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
}
type RunSummaryService ¶ added in v3.37.0
type RunSummaryService struct {
// contains filtered or unexported fields
}
func NewRunSummaryService ¶ added in v3.37.0
func NewRunSummaryService(client *buildkite.Client) *RunSummaryService
func (*RunSummaryService) Get ¶ added in v3.37.0
func (s *RunSummaryService) Get(ctx context.Context, org, buildID string, opt *RunSummaryGetOptions) (*RunSummaryResponse, error)
type RunSummarySuite ¶ added in v3.37.0
type RunSummaryTests ¶ added in v3.37.0
type RunSummaryTests struct {
Runs map[string]RunSummaryRun `json:"runs"`
Failures []RunSummaryFailure `json:"failures"`
}
type SnapshotOption ¶
type SnapshotOption func(*snapshotConfig)
SnapshotOption configures Snapshot behavior.
type SnapshotResult ¶
type SnapshotResult struct {
Commit string
Ref string
Branch string
Files []FileChange
}
SnapshotResult holds the output of a successful snapshot operation.
func Snapshot ¶
func Snapshot(dir string, preflightID uuid.UUID, opts ...SnapshotOption) (*SnapshotResult, error)
Snapshot pushes the current working tree state to a remote preflight ref. It always creates a distinct commit on top of HEAD (even when the worktree is clean) without touching the real git index.
func (SnapshotResult) ShortCommit ¶ added in v3.35.0
func (r SnapshotResult) ShortCommit() string
type SourceContext ¶ added in v3.36.0
SourceContext describes the original git state that preflight was created from.
func ResolveSourceContext ¶ added in v3.36.0
func ResolveSourceContext(dir string, debug bool) (SourceContext, error)
ResolveSourceContext returns the current branch name (if any) and HEAD commit.
type SummaryFailureDetail ¶ added in v3.37.0
type SummaryOptions ¶ added in v3.37.0
type SummaryOptions struct {
IncludeFailures bool
}
type SummaryResult ¶ added in v3.37.0
type SummaryResult struct {
Tests SummaryTests `json:"tests"`
}
type SummaryTestFailure ¶ added in v3.37.0
type SummaryTestFailure struct {
RunID string `json:"run_id"`
SuiteName string `json:"suite_name,omitempty"`
SuiteSlug string `json:"suite_slug"`
Name string `json:"name"`
Location string `json:"location"`
Message string `json:"message"`
FailureReason string `json:"failure_reason"`
FailureDetail []SummaryFailureDetail `json:"failure_detail"`
}
type SummaryTestRun ¶ added in v3.37.0
type SummaryTests ¶ added in v3.37.0
type SummaryTests struct {
Runs map[string]SummaryTestRun `json:"runs"`
Failures []SummaryTestFailure `json:"failures"`
}