Documentation
¶
Overview ¶
Package pipeline implements the spec pipeline stage machine.
Package pipeline implements the spec pipeline stage machine.
Index ¶
- Constants
- func AllGatesPassed(results []GateResult) bool
- func EffectiveStages(resolved *ResolvedPipeline, ctx expr.Context) []config.StageConfig
- func NextEffectiveStage(resolved *ResolvedPipeline, current string, ctx expr.Context) (string, bool)
- func NextStage(pipeline config.PipelineConfig, current string, includeOptional bool) (string, error)
- func PresetInfo(name string) (description string, features []string, stageNames []string, err error)
- func PresetNames() []string
- func Resume(path string, meta *markdown.SpecMeta, previousStage string) error
- func Revert(path string, meta *markdown.SpecMeta, targetStage, reason, user string) error
- func ShouldSkipStage(resolved *ResolvedPipeline, stageName string, ctx expr.Context) (bool, string)
- func SkippedStages(pipeline config.PipelineConfig, from, to string) []string
- func StageHasOwner(pipeline config.PipelineConfig, stageName, role string) bool
- func StageOwner(pipeline config.PipelineConfig, stageName string) string
- func TerminalStages(pipeline config.PipelineConfig) []string
- func ValidateAdvance(pipeline config.PipelineConfig, currentStage, targetStage, userRole string) error
- func ValidateRevert(pipeline config.PipelineConfig, currentStage, targetStage, userRole string) error
- type AdvanceResult
- type EjectResult
- type GateResult
- type PresetConfig
- type ResolvedPipeline
- func (r *ResolvedPipeline) IsValidReversion(from, to string) bool
- func (r *ResolvedPipeline) IsValidTransition(from, to string) bool
- func (r *ResolvedPipeline) NextStage(current string) (string, bool)
- func (r *ResolvedPipeline) PrevStage(current string) (string, bool)
- func (r *ResolvedPipeline) StageByName(name string) *config.StageConfig
- func (r *ResolvedPipeline) StageOwner(name string) string
- type SkipWhenResult
Constants ¶
const (
// StatusBlocked is the escape hatch status.
StatusBlocked = "blocked"
)
Variables ¶
This section is empty.
Functions ¶
func AllGatesPassed ¶
func AllGatesPassed(results []GateResult) bool
AllGatesPassed returns true if all gates passed.
func EffectiveStages ¶
func EffectiveStages(resolved *ResolvedPipeline, ctx expr.Context) []config.StageConfig
EffectiveStages returns the stages that apply to a spec after evaluating skip_when. This is used for determining the actual pipeline path for a spec.
func NextEffectiveStage ¶
func NextEffectiveStage(resolved *ResolvedPipeline, current string, ctx expr.Context) (string, bool)
NextEffectiveStage returns the next stage that isn't skipped.
func NextStage ¶
func NextStage(pipeline config.PipelineConfig, current string, includeOptional bool) (string, error)
NextStage returns the next non-optional stage, or the next stage if includeOptional.
func PresetInfo ¶
func PresetInfo(name string) (description string, features []string, stageNames []string, err error)
PresetInfo returns metadata about a preset for display.
func PresetNames ¶
func PresetNames() []string
PresetNames returns the names of all available presets.
func ShouldSkipStage ¶
ShouldSkipStage checks if a specific stage should be skipped for a spec.
func SkippedStages ¶
func SkippedStages(pipeline config.PipelineConfig, from, to string) []string
SkippedStages returns the stages that would be skipped in a fast-track.
func StageHasOwner ¶
func StageHasOwner(pipeline config.PipelineConfig, stageName, role string) bool
StageHasOwner returns true if the given role is an owner of the stage.
func StageOwner ¶
func StageOwner(pipeline config.PipelineConfig, stageName string) string
StageOwner returns the owner role for a stage as a display string.
func TerminalStages ¶
func TerminalStages(pipeline config.PipelineConfig) []string
TerminalStages returns stages that represent completion. The last required stage and any auto-archive stages are considered terminal. Falls back to "done" and "closed" if nothing else matches.
func ValidateAdvance ¶
func ValidateAdvance(pipeline config.PipelineConfig, currentStage, targetStage, userRole string) error
ValidateAdvance checks if advancing from the current stage is permitted.
func ValidateRevert ¶
func ValidateRevert(pipeline config.PipelineConfig, currentStage, targetStage, userRole string) error
ValidateRevert checks if reverting to a previous stage is permitted.
Types ¶
type AdvanceResult ¶
AdvanceResult contains the result of advancing a spec.
type EjectResult ¶
type EjectResult struct {
PreviousStage string
}
EjectResult contains the result of ejecting a spec.
type GateResult ¶
GateResult represents the result of a gate check.
func EvaluateGates ¶
func EvaluateGates(pipeline config.PipelineConfig, currentStage string, sections []markdown.Section, hasPRStack bool, prsApproved bool, meta *markdown.SpecMeta) []GateResult
EvaluateGates checks all gates for the current stage by building a context from raw parameters.
func EvaluateGatesWithContext ¶
func EvaluateGatesWithContext(pipeline config.PipelineConfig, currentStage string, ctx expr.Context) []GateResult
EvaluateGatesWithContext checks all gates using a pre-built expression context.
func FailedGates ¶
func FailedGates(results []GateResult) []GateResult
FailedGates returns only the gates that did not pass.
type PresetConfig ¶
type PresetConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Features []string `yaml:"features"`
Stages []config.StageConfig `yaml:"stages"`
}
PresetConfig holds a preset pipeline definition.
func LoadPreset ¶
func LoadPreset(name string) (*PresetConfig, error)
LoadPreset returns the preset configuration for the given name.
type ResolvedPipeline ¶
type ResolvedPipeline struct {
// Stages is the final list of stages in order.
Stages []config.StageConfig
// StageIndex maps stage name to index for fast lookup.
StageIndex map[string]int
// PresetName is the preset that was used (empty if none).
PresetName string
// VariantName is the variant that was selected (empty if default).
VariantName string
// SkippedStages lists stages that were removed via Skip config.
SkippedStages []string
}
ResolvedPipeline is a fully resolved pipeline configuration with all presets expanded, stages skipped, and overrides applied.
func Resolve ¶
func Resolve(cfg config.PipelineConfig) (*ResolvedPipeline, error)
Resolve takes a pipeline config and returns a fully resolved pipeline. It handles: 1. Loading the preset (if specified) 2. Removing skipped stages 3. Merging/overriding stages from config
func ResolveForSpec ¶
func ResolveForSpec(cfg config.PipelineConfig, labels []string) (*ResolvedPipeline, error)
ResolveForSpec returns the pipeline variant for a specific spec based on its labels.
func (*ResolvedPipeline) IsValidReversion ¶
func (r *ResolvedPipeline) IsValidReversion(from, to string) bool
IsValidReversion checks if reverting from 'from' to 'to' is valid.
func (*ResolvedPipeline) IsValidTransition ¶
func (r *ResolvedPipeline) IsValidTransition(from, to string) bool
IsValidTransition checks if advancing from 'from' to 'to' is valid.
func (*ResolvedPipeline) NextStage ¶
func (r *ResolvedPipeline) NextStage(current string) (string, bool)
NextStage returns the next stage after the given one.
func (*ResolvedPipeline) PrevStage ¶
func (r *ResolvedPipeline) PrevStage(current string) (string, bool)
PrevStage returns the previous stage before the given one.
func (*ResolvedPipeline) StageByName ¶
func (r *ResolvedPipeline) StageByName(name string) *config.StageConfig
StageByName returns the stage with the given name, or nil if not found.
func (*ResolvedPipeline) StageOwner ¶
func (r *ResolvedPipeline) StageOwner(name string) string
StageOwner returns the owner role for a stage.
type SkipWhenResult ¶
type SkipWhenResult struct {
StageName string
Skipped bool
Reason string // The skip_when expression that matched
}
SkipWhenResult holds the result of evaluating skip_when for a stage.
func EvaluateSkipWhen ¶
func EvaluateSkipWhen(resolved *ResolvedPipeline, ctx expr.Context) []SkipWhenResult
EvaluateSkipWhen evaluates skip_when expressions for all stages given a context. Returns the stages that should be skipped for this spec.