Documentation
¶
Index ¶
- func NormalizeParamsForState(source, params, sourceBecome, become map[string]any) map[string]any
- func ParamHash(params map[string]any) string
- func StateParamHash(source, params, sourceBecome, become map[string]any) string
- func StateParamSummary(source, params, sourceBecome, become map[string]any) any
- func SummarizeParams(params map[string]any) any
- type BoundTask
- type BoundTaskResult
- type ComparisonStatus
- type Config
- type DAG
- type ExecutionPlan
- type GateRefusal
- type GateViolation
- type PlanTask
- type PlannedTaskState
- type Runner
- func (r *Runner) Apply(ctx context.Context, plan *ExecutionPlan) (err error)
- func (r *Runner) Fetch(ctx context.Context, playbook *action.Playbook) error
- func (r *Runner) Plan(ctx context.Context, playbook *action.Playbook) (*ExecutionPlan, error)
- func (r *Runner) PlannedTaskState(ctx context.Context, plan *ExecutionPlan) ([]PlannedTaskState, error)
- func (r *Runner) Run(ctx context.Context, playbook *action.Playbook) (err error)
- func (r *Runner) Stage(ctx context.Context, plan *ExecutionPlan) (err error)
- type SecretValueAnalysis
- type State
- type TaskComparison
- type TaskSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeParamsForState ¶
func StateParamHash ¶
func StateParamSummary ¶
func SummarizeParams ¶
SummarizeParams produces a redacted, JSON-friendly summary of parameters for state diff output.
Types ¶
type BoundTaskResult ¶
type BoundTaskResult struct {
Name string
Params map[string]any
Become map[string]any
SourceParams map[string]any // pre-secret-resolution copy for state
SourceBecome map[string]any // pre-secret-resolution copy for state
ExecOpts target.ExecutionOptions
}
BoundTaskResult is the output of the consolidated bind pipeline: a fully resolved task ready to execute, plus pre-resolution copies for state hashing.
type ComparisonStatus ¶
type ComparisonStatus string
const ( ComparisonStatusNew ComparisonStatus = "NEW" ComparisonStatusChanged ComparisonStatus = "CHANGED" ComparisonStatusUnchanged ComparisonStatus = "UNCHANGED" ComparisonStatusRemoved ComparisonStatus = "REMOVED" ComparisonStatusStatusOnly ComparisonStatus = "STATUS-ONLY" )
type Config ¶
type Config struct {
DryRun bool
Tags []string
SkipTags []string
Concurrency int
ProjectDir string
ProjectName string
ProjectEnv string
ProjectVars map[string]any
InventoryVars map[string]any
Vars map[string]any // from --var CLI flags
TargetVars map[string]any
TargetName string
// StagePlatform overrides live target discovery only while assembling a bundle.
StagePlatform *target.Platform
Phase string // "plan", "fetch", "stage", "apply" (empty = all)
SkipFetch bool
Renderer output.Renderer
Secrets *secrets.Resolver
SecretsConfig config.SecretsConfig
StatePath string
ModuleRegistry target.ModuleRegistry
BundleOutputDir string
BundlePlugins []plugins.LoadedPlugin
AllowPlaintextSecretsInBundle bool
Lockfile *action.Lockfile
Version string
Commit string
BuildDate string
}
Config holds the options that control runner behavior.
type DAG ¶
type DAG struct {
// contains filtered or unexported fields
}
DAG is a directed acyclic graph of tasks for dependency-ordered execution.
func BuildDAG ¶
BuildDAG constructs a DAG from the given tasks. DependsOn values are resolved by canonical dependency refs prepared during planning. Returns an error if a dependency references an unknown task ref or if there is a cycle.
func (*DAG) DependencyIDs ¶
DependencyIDs resolves a task's dependency refs to stable task IDs.
func (*DAG) TopologicalOrder ¶
TopologicalOrder returns tasks in dependency-first execution order.
type ExecutionPlan ¶
type ExecutionPlan struct {
PlaybookName string
Tasks []*PlanTask
// contains filtered or unexported fields
}
ExecutionPlan is the result of the Plan phase: a flat, ordered list of tasks with all variables resolved.
func (*ExecutionPlan) DAG ¶
func (p *ExecutionPlan) DAG() (*DAG, error)
DAG returns the plan's validated dependency graph, rebuilding it only for hand-constructed test plans or older callers that did not come from Plan().
type GateRefusal ¶
type GateRefusal struct {
RuntimeKind target.RuntimeKind
Violations []GateViolation
}
GateRefusal is the typed error returned when the apply-start support gate refuses a run. The gate runs after Info() resolves the runtime kind and facts are gathered, before task 1: every task that will actually run is validated against the support matrix, and the whole run is refused with every violation listed. It is when-aware (when-false tasks are excluded) and ignore_errors-exempt (those tasks keep fail-and-continue at execution time). Per-task apply-time errors remain only for environment prerequisites the matrix cannot know.
func (*GateRefusal) Error ¶
func (g *GateRefusal) Error() string
Error renders the refusal: a summary line naming the runtime, then one line per violation.
func (*GateRefusal) Event ¶
func (g *GateRefusal) Event(targetName string) output.SupportGateEvent
Event builds the run-log event for this refusal.
type GateViolation ¶
GateViolation is one task-level support-matrix violation collected by the apply-start gate.
type PlanTask ¶
type PlanTask struct {
ID string // unique ID, e.g. "task-0", "task-1"
Name string
Ref string
ActionPath string // human-readable parent path, e.g. "Apply machine baseline/Configure computer name"
Module string
Params map[string]any
Become map[string]any
Scope *template.Scope
DependsOn []string
When string
Tags []string
IgnoreErrors bool
}
PlanTask is a single task entry in the execution plan.
type PlannedTaskState ¶
type PlannedTaskState struct {
TaskKey string
TaskName string
Module string
DependsOn []string
TaskHash string
ParamHash string
ParamSummary any
}
func BuildPlannedTaskState ¶
func BuildPlannedTaskState(ctx context.Context, plan *ExecutionPlan, rt *template.RuntimeContext, resolver *secrets.Resolver) ([]PlannedTaskState, error)
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner orchestrates the Plan→Fetch→Stage→Apply pipeline.
func (*Runner) PlannedTaskState ¶
func (r *Runner) PlannedTaskState(ctx context.Context, plan *ExecutionPlan) ([]PlannedTaskState, error)
PlannedTaskState renders the current plan with execution-time target context so state comparisons use the same task names and params that apply records.
type SecretValueAnalysis ¶
func AnalyzeSecretValues ¶
func AnalyzeSecretValues(value any) SecretValueAnalysis
type State ¶
type State struct {
Version int `json:"version,omitempty"`
LastApplied time.Time `json:"last_applied"`
Tasks map[string]TaskSnapshot `json:"tasks,omitempty"`
}
State holds persisted runner state written to disk after each apply.
func LoadState ¶
LoadState reads a state file from path. If the file does not exist, an empty State is returned (not an error).
func (*State) RecordTask ¶
func (s *State) RecordTask(snapshot TaskSnapshot)
RecordTask stores a v2 snapshot in the state, keyed by stable task key.
type TaskComparison ¶
type TaskComparison struct {
Status ComparisonStatus
TaskKey string
TaskName string
Module string
RecordedStatus target.Status
RecordedSummary any
PlannedSummary any
}
func ComparePlannedTasks ¶
func ComparePlannedTasks(planned []PlannedTaskState, state *State) []TaskComparison
type TaskSnapshot ¶
type TaskSnapshot struct {
TaskKey string `json:"task_key"`
TaskName string `json:"task_name"`
Module string `json:"module,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
TaskHash string `json:"task_hash,omitempty"`
ParamHash string `json:"param_hash,omitempty"`
ParamSummary any `json:"param_summary,omitempty"`
Status target.Status `json:"status"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
TaskSnapshot is the v2 persisted state model used for comparison and audit.