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 ComparisonStatus
- type Config
- type DAG
- type ExecutionPlan
- 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 TaskResult
- 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 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
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
Vars map[string]any
// 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 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
TemplateVars map[string]any
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, execCtx *executionContext, 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"`
Results map[string]TaskResult `json:"results,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) Record ¶
func (s *State) Record(result TaskResult)
Record preserves legacy result-only writes by promoting them to v2 snapshots.
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 TaskResult ¶
type TaskResult struct {
TaskID string `json:"task_id"`
TaskName string `json:"task_name"`
Status target.Status `json:"status"`
Timestamp time.Time `json:"timestamp"`
ParamHash string `json:"param_hash"`
}
TaskResult is the legacy per-task result shape kept for backward-compatible state loading.
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.