lifecycle

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveRunList

func ActiveRunList(runs []ActiveRun) string

ActiveRunList renders classified runs for an operator-facing refusal.

func ActiveRuns

func ActiveRuns(p *paths.Paths) ([]*db.Run, error)

ActiveRuns returns all pending/running pipeline runs from the local state DB.

func ExecutingRunList

func ExecutingRunList(runs []ActiveRun) string

ExecutingRunList renders the subset that is mid-step.

func RunList

func RunList(runs []*db.Run) string

func ShortSHA

func ShortSHA(sha string) string

Types

type ActiveRun

type ActiveRun struct {
	Run      *db.Run
	Activity Activity
	// Step is the step the run is executing or parked on, empty when the run
	// has no step to point at.
	Step types.StepName
}

ActiveRun pairs an active run with what the daemon is doing with it.

func ClassifyActiveRuns

func ClassifyActiveRuns(p *paths.Paths, daemonRunning func() bool) ([]ActiveRun, error)

ClassifyActiveRuns returns every pending/running run in the local state DB annotated with its Activity. daemonRunning reports whether a daemon is serving this NS_HOME; when no daemon is, nothing can be mid-step, because startup recovery is what reconciles the rows a dead daemon left behind. It is consulted only once at least one active run exists, so the common no-active-runs path never pays for a daemon health probe, and a nil daemonRunning fails closed to "a daemon is serving this root".

Classification is deliberately asymmetric: a run is reported as parked or idle only on positive evidence, and anything else a live daemon still owns counts as executing. A run between two steps has neither a running step nor a gate marker, and guessing "safe" there is what a destructive lifecycle command must never do.

func ExecutingRuns

func ExecutingRuns(runs []ActiveRun) []ActiveRun

ExecutingRuns filters to the runs a daemon stop would kill mid-step.

type Activity

type Activity string

Activity describes what is actually happening to an active run. Stopping the daemon means something different for each: a parked or idle run survives it, because startup recovery resumes a parked gate and an idle row was never in flight, but a run executing a step loses that step and fails with its pipeline commits stranded in the local gate repository.

const (
	// ActivityExecuting means a daemon is running a step for this run now.
	ActivityExecuting Activity = "executing"
	// ActivityParked means the run is blocked at a gate awaiting the agent.
	ActivityParked Activity = "parked"
	// ActivityIdle means no daemon is driving the run: it is a row left over
	// from a daemon that is no longer running. There is no run queue, so a
	// live daemon never has an idle run.
	ActivityIdle Activity = "idle"
)

Jump to

Keyboard shortcuts

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