Documentation
¶
Overview ¶
Package engine orchestrates the execution of a keepup Flow. Groups are scheduled either as ordered waves (step mode) or topologically from the implicit data DAG (dag mode); both share the same Runner, OutputStore, Expander, and Logger interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine binds a parsed Config to a set of pluggable collaborators.
func New ¶
New constructs an Engine. The config pointer is held by reference; do not mutate it for the lifetime of the Engine.
func (*Engine) Outputs ¶
func (e *Engine) Outputs() OutputStore
Outputs returns the captured outputs (populated after RunFlow completes).
type MemoryOutputStore ¶
type MemoryOutputStore struct {
// contains filtered or unexported fields
}
MemoryOutputStore is the default in-memory implementation.
func NewMemoryOutputStore ¶
func NewMemoryOutputStore() *MemoryOutputStore
NewMemoryOutputStore returns an empty store.
func (*MemoryOutputStore) Set ¶
func (s *MemoryOutputStore) Set(name, value string)
func (*MemoryOutputStore) Snapshot ¶
func (s *MemoryOutputStore) Snapshot() map[string]string
Snapshot returns a copy of the current state for safe iteration.
type Option ¶
type Option func(*Engine)
Option configures an Engine.
func WithDryRun ¶
WithDryRun forces dry-run mode regardless of the config flag.
func WithExpander ¶
WithExpander overrides the default TemplateExpander.
func WithLogger ¶
WithLogger overrides the default no-op Logger.
func WithNoCache ¶ added in v1.7.0
WithNoCache disables cache reads/writes for this run.
func WithOutputStore ¶
func WithOutputStore(s OutputStore) Option
WithOutputStore overrides the default in-memory OutputStore.
func WithProber ¶ added in v1.7.0
WithProber overrides the default ShellProber used for skip-if/require.
type OutputStore ¶
type OutputStore interface {
Get(name string) (string, bool)
Set(name, value string)
Snapshot() map[string]string
}
OutputStore is a goroutine-safe key/value store of group outputs.
type Prober ¶ added in v1.7.0
Prober evaluates a gating predicate. A nil error means the predicate succeeded (exit code 0); a non-nil error means it failed.
Predicates are short shell snippets (e.g. "test -f bin/app"), so they always run through a shell.
type Runner ¶
type Runner interface {
Run(ctx context.Context, g *config.Group, params []string, globalEnv map[string]string) (string, error)
}
Runner executes a single group and returns its captured stdout/stderr as a string.
type ShellProber ¶ added in v1.7.0
type ShellProber struct{}
ShellProber runs predicates through the platform shell. Output is discarded; only the exit status matters.
type ShellRunner ¶
type ShellRunner struct {
// Stdout and Stderr are forwarded for live output; outputs are also captured
// into the returned string. If nil, os.Stdout/os.Stderr are used.
Stdout io.Writer
Stderr io.Writer
}
ShellRunner executes a group via os/exec, optionally through a system shell.
By default (group.Shell == false) it spawns Command directly with Params as argv — no shell interpretation, no injection surface. When group.Shell is true the runner concatenates command+params into a single string and pipes it through the user's preferred shell; that mode is opt-in.
func NewShellRunner ¶
func NewShellRunner() *ShellRunner
NewShellRunner returns a runner wired to the process stdio.
func (*ShellRunner) Run ¶
func (r *ShellRunner) Run(ctx context.Context, g *config.Group, params []string, globalEnv map[string]string) (string, error)
Run honors ctx for cancellation. The returned string is the combined stdout+stderr capture of the child process.
The command and arguments come from user-supplied configuration; that is the point of this tool. gosec G204 is suppressed for the exec call.
type TemplateExpander ¶
type TemplateExpander struct{}
TemplateExpander is the default placeholder substitution.