Help us shape the future of Go! Take the 2026 Go Developer Survey

pipeline

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: AGPL-3.0, AGPL-3.0-only Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const StatePath = ".stagefreight/pipeline.json"

StatePath is the workspace-relative path where pipeline state is persisted.

Variables

This section is empty.

Functions

func UpdateState

func UpdateState(rootDir string, fn func(*State)) error

UpdateState does read-modify-write. The caller mutates individual fields only — never rebuild nested structs wholesale to avoid clobbering prior state written by other subsystems.

func WriteState

func WriteState(rootDir string, st *State) error

WriteState writes pipeline state atomically (tmp + rename). Normalizes Version to 1 on write.

Types

type BuildState

type BuildState struct {
	Attempted      bool   `json:"attempted"`
	Completed      bool   `json:"completed"`
	ProducedImages bool   `json:"produced_images"`
	PublishedCount int    `json:"published_count"`
	ManifestPath   string `json:"manifest_path,omitempty"`
	Reason         string `json:"reason,omitempty"`
}

BuildState records what the build subsystem did.

type CIState

type CIState struct {
	Provider   string `json:"provider"`
	PipelineID string `json:"pipeline_id"`
	Ref        string `json:"ref,omitempty"`
	Branch     string `json:"branch,omitempty"`
	Tag        string `json:"tag,omitempty"`
	SHA        string `json:"sha"`
}

CIState captures the CI environment for this pipeline run.

func InitFromCI

func InitFromCI(ciCtx *ci.CIContext) CIState

InitFromCI populates a CIState from a ci.CIContext.

type ReleaseState

type ReleaseState struct {
	Eligible  bool   `json:"eligible"`
	Attempted bool   `json:"attempted"`
	Completed bool   `json:"completed"`
	Skipped   bool   `json:"skipped"`
	Reason    string `json:"reason,omitempty"`
}

ReleaseState records what the release subsystem did.

type SecurityState

type SecurityState struct {
	Attempted bool   `json:"attempted"`
	Completed bool   `json:"completed"`
	Skipped   bool   `json:"skipped"`
	Reason    string `json:"reason,omitempty"`
}

SecurityState records what the security subsystem did.

type State

type State struct {
	Version  int           `json:"version"`
	CI       CIState       `json:"ci"`
	Build    BuildState    `json:"build"`
	Security SecurityState `json:"security"`
	Release  ReleaseState  `json:"release"`
}

State is the per-run ledger for the current pipeline workspace. Each subsystem records what it did; downstream stages read the ledger instead of probing files.

func ReadState

func ReadState(rootDir string) (*State, error)

ReadState reads pipeline state from the workspace. Returns a zero State (Version: 1) on missing file — missing state is normal when the first subsystem hasn't run yet. Only errors on I/O or parse failures for an existing file.

Jump to

Keyboard shortcuts

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