preflight

package
v3.35.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(dir string, ref string, debug bool) error

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

func CleanupRefs(dir string, refs []string, debug bool) error

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

func RepositoryRoot(dir string, debug bool) (string, error)

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.

Types

type BranchBuild added in v3.35.2

type BranchBuild struct {
	Branch string
	Ref    string
	Build  *buildkite.Build
}

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 FileChange

type FileChange struct {
	Status string // e.g. "M", "A", "D", "R"
	Path   string
}

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 SnapshotOption

type SnapshotOption func(*snapshotConfig)

SnapshotOption configures Snapshot behavior.

func WithDebug

func WithDebug() SnapshotOption

WithDebug enables verbose git output on failure.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL