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 BuildExprContext(sections []markdown.Section, hasPRStack bool, prsApproved bool, ...) expr.Context
- 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 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
- 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 BuildExprContext ¶ added in v0.16.0
func BuildExprContext(sections []markdown.Section, hasPRStack bool, prsApproved bool, meta *markdown.SpecMeta) expr.Context
BuildExprContext builds the expression context used by both gate evaluation and skip_when evaluation from a spec's sections and metadata. It is the single source of truth for translating spec state into an expr.Context.
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 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 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
// 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 (*ResolvedPipeline) StageByName ¶
func (r *ResolvedPipeline) StageByName(name string) *config.StageConfig
StageByName returns the stage with the given name, or nil if not found.
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.