Documentation
¶
Index ¶
- Variables
- func FormatHandoffMessage(r *HandoffResult) string
- func HandoffDepth() int
- func HasFacet(facets []ActiveFacet, name string) bool
- func IsBranchHeadFresh(ciCtx *CIContext) bool
- func NeedsDinD(facets []ActiveFacet) bool
- func RecommendSkeleton(facets []ActiveFacet) string
- func RunSubsystem(reg Registry, subsystem string, ctx context.Context, cfg *config.Config, ...) error
- func SkeletonPath(provider, variant string) string
- func ValidSubsystems() []string
- func ValidateSkeleton(graph *ExecutionGraph, variant *SkeletonVariant) (errors []string, warnings []string)
- type ActiveFacet
- type CIContext
- type ExecutionGraph
- type FacetDef
- type GraphNode
- type HandoffDecision
- type HandoffResult
- type Registry
- type RunOptions
- type Runner
- type SkeletonVariant
Constants ¶
This section is empty.
Variables ¶
var FacetRegistry = []FacetDef{ { Name: "validate", Subsystem: "validate", NeedsDinD: false, Predicate: func(c *config.Config) bool { return c.Lint.Level != "" }, }, { Name: "deps", Subsystem: "deps", NeedsDinD: true, Predicate: func(c *config.Config) bool { return c.Dependency.Enabled }, }, { Name: "build", Subsystem: "build", NeedsDinD: true, Predicate: func(c *config.Config) bool { return len(c.Builds) > 0 }, }, { Name: "security", Subsystem: "security", NeedsDinD: true, Predicate: func(c *config.Config) bool { return c.Security.Enabled }, }, { Name: "release", Subsystem: "release", NeedsDinD: false, Predicate: func(c *config.Config) bool { return c.Release.Enabled }, }, { Name: "gitops-reconcile", Subsystem: "reconcile", NeedsDinD: false, Predicate: func(c *config.Config) bool { return c.GitOps.Cluster.Name != "" }, }, { Name: "governance-reconcile", Subsystem: "reconcile", NeedsDinD: false, Predicate: func(c *config.Config) bool { return len(c.Governance.Clusters) > 0 }, }, { Name: "docs", Subsystem: "docs", NeedsDinD: false, Predicate: func(c *config.Config) bool { return c.Docs.Enabled }, }, }
FacetRegistry is the canonical, ordered set of all known facets. Order determines canonical stage ordering.
Functions ¶
func FormatHandoffMessage ¶
func FormatHandoffMessage(r *HandoffResult) string
FormatHandoffMessage returns a human-readable message for the handoff result. Returns empty string when no message is needed.
func HandoffDepth ¶
func HandoffDepth() int
HandoffDepth reads SF_CI_HANDOFF_DEPTH from the environment. Returns 0 when unset or unparseable (original pipeline, not a handoff).
func HasFacet ¶ added in v0.5.0
func HasFacet(facets []ActiveFacet, name string) bool
HasFacet checks if a named facet is in the active set.
func IsBranchHeadFresh ¶
IsBranchHeadFresh returns true if the CI SHA still matches the remote branch HEAD. Shipping actions (release, docs sync, catalog publish) must call this before performing externally visible mutations. Returns true when not in CI or when the branch cannot be resolved (fail-open for local runs).
func NeedsDinD ¶ added in v0.5.0
func NeedsDinD(facets []ActiveFacet) bool
NeedsDinD returns true if any active facet requires Docker-in-Docker.
func RecommendSkeleton ¶ added in v0.5.0
func RecommendSkeleton(facets []ActiveFacet) string
RecommendSkeleton returns the skeleton variant name for the active facets.
func RunSubsystem ¶
func RunSubsystem(reg Registry, subsystem string, ctx context.Context, cfg *config.Config, ciCtx *CIContext, opts RunOptions) error
RunSubsystem dispatches to a subsystem runner by name. Returns a clear error for unknown subsystem names.
func SkeletonPath ¶ added in v0.5.0
SkeletonPath returns the repo-relative path for a skeleton variant.
func ValidSubsystems ¶
func ValidSubsystems() []string
ValidSubsystems returns the list of valid subsystem names.
func ValidateSkeleton ¶ added in v0.5.0
func ValidateSkeleton(graph *ExecutionGraph, variant *SkeletonVariant) (errors []string, warnings []string)
ValidateSkeleton checks if the active execution graph is compatible with a skeleton variant.
Types ¶
type ActiveFacet ¶ added in v0.5.0
ActiveFacet is a facet that passed its predicate.
func DetectActive ¶ added in v0.5.0
func DetectActive(cfg *config.Config) []ActiveFacet
DetectActive evaluates all facets against the effective config. Returns only active facets in canonical order.
type CIContext ¶
type CIContext struct {
Provider string // gitlab, github, gitea, forgejo, jenkins
Event string // push, tag, merge_request, schedule
Branch string // current branch (empty on tags)
Tag string // current tag (empty on branches)
SHA string // full commit SHA
DefaultBranch string // repo default branch name
RepoURL string // repository URL
Workspace string // working directory
PipelineID string // provider pipeline/run ID (for cancel API)
}
CIContext holds normalized CI environment information. Provider skeletons translate forge-native vars into SF_CI_* env vars; CIContext reads those to provide a provider-neutral execution context.
func ResolveContext ¶
func ResolveContext() *CIContext
ResolveContext reads SF_CI_* env vars to build a CIContext. Falls back to git inspection for local (non-CI) runs.
func (*CIContext) IsBranch ¶
IsBranch returns true when the current context is a branch build (not a tag).
type ExecutionGraph ¶ added in v0.5.0
type ExecutionGraph struct {
Nodes []GraphNode
}
ExecutionGraph is the canonical, provider-agnostic execution model. Computed from config. Inspectable. Testable. The portable product.
func BuildGraph ¶ added in v0.5.0
func BuildGraph(cfg *config.Config) *ExecutionGraph
BuildGraph computes the canonical execution graph from effective config. Provider-agnostic. No heuristics — only config presence.
func (*ExecutionGraph) ActiveNodeIDs ¶ added in v0.5.0
func (g *ExecutionGraph) ActiveNodeIDs() []string
ActiveNodeIDs returns the IDs of all active nodes.
func (*ExecutionGraph) NeedsDinD ¶ added in v0.5.0
func (g *ExecutionGraph) NeedsDinD() bool
NeedsDinD returns true if any active node requires Docker-in-Docker.
func (*ExecutionGraph) Render ¶ added in v0.5.0
func (g *ExecutionGraph) Render() string
Render returns a human-readable representation of the graph.
type FacetDef ¶ added in v0.5.0
type FacetDef struct {
Name string // "build", "security", "gitops-reconcile", etc.
Subsystem string // what `ci run <x>` dispatches to
NeedsDinD bool // requires Docker-in-Docker transport
Predicate func(*config.Config) bool // config-driven activation check
}
FacetDef defines a CI facet — a capability that may be active in a repo. Predicates are deterministic: config presence only, no heuristics.
type GraphNode ¶ added in v0.5.0
type GraphNode struct {
ID string // "build", "security", "reconcile"
Subsystem string // what `ci run <x>` dispatches to
Needs []string // explicit dependency IDs (not position-based)
NeedsDinD bool
Active bool // from facet detection
Reason string // why active ("builds configured") or inactive ("no builds")
}
GraphNode represents one unit of work in the execution graph.
type HandoffDecision ¶
type HandoffDecision int
HandoffDecision describes the outcome of a handoff evaluation.
const ( // HandoffNone — no handoff needed (continue mode, or no commit created). HandoffNone HandoffDecision = iota // HandoffRestart — new commit pushed, requesting pipeline restart on repaired revision. HandoffRestart // HandoffSuppressed — handoff would fire, but this pipeline already originated // from a repaired-revision handoff (depth >= 1). One-hop guard prevents infinite loops. HandoffSuppressed // HandoffFail — repair was needed but policy says fail if handoff can't proceed. HandoffFail )
type HandoffResult ¶
type HandoffResult struct {
Decision HandoffDecision
CommitSHA string // SHA of the new commit deps created
Triggered bool // true if a new pipeline was triggered via provider API
Stale bool // true if current pipeline SHA != branch HEAD (should stop shipping)
Depth int // current handoff depth from SF_CI_HANDOFF_DEPTH
}
HandoffResult describes what happened when deps attempted a pipeline handoff.
func EvaluateHandoff ¶
func EvaluateHandoff(ciCtx *CIContext, handoff config.DependencyHandoff, commitSHA string) *HandoffResult
EvaluateHandoff checks whether a dependency commit requires pipeline handoff.
Handoff fires only when ALL of these are true:
- A new commit SHA was created and pushed
- Handoff mode is restart_pipeline
- Handoff depth is 0 (original pipeline, not already a rerun)
When depth >= 1 and a new commit was still created, the decision is HandoffSuppressed — the one-hop guard prevents infinite restart loops.
When handoff is "continue", the decision is always HandoffNone. When handoff is "fail" and depth >= 1, the decision is HandoffFail.
type RunOptions ¶
RunOptions holds runtime options that can be passed from CLI flags or resolved from CI context. This ensures local reproducibility — users can pass --tag v1.2.3 instead of needing CI env vars.
type SkeletonVariant ¶ added in v0.5.0
type SkeletonVariant struct {
Name string // "standard", "lightweight"
Provider string // "gitlab"
Supports []string // facet subsystems this skeleton can run
Content []byte // raw YAML
}
SkeletonVariant holds parsed metadata + content of a skeleton file.
func ParseSkeleton ¶ added in v0.5.0
func ParseSkeleton(name, provider string, data []byte) (*SkeletonVariant, error)
ParseSkeleton extracts metadata from a skeleton file's header comments.