Documentation
¶
Overview ¶
Package runnerpool provides a runner implementation based on a pool pattern for executing multiple units concurrently.
Index ¶
- func Build(ctx context.Context, l log.Logger, ...) (common.StackRunner, error)
- func FilterDiscoveredUnits(discovered component.Components, units common.Units) component.Components
- func NewRunnerPoolStack(ctx context.Context, l log.Logger, ...) (common.StackRunner, error)
- type Controller
- type ControllerOption
- type Runner
- func (r *Runner) GetStack() *common.Stack
- func (r *Runner) GetUnitFilters() []common.UnitFilter
- func (r *Runner) JSONUnitDeployOrder(_ string) (string, error)
- func (r *Runner) ListStackDependentUnits() map[string][]string
- func (r *Runner) LogUnitDeployOrder(l log.Logger, terraformCommand string) error
- func (r *Runner) Run(ctx context.Context, l log.Logger, opts *options.TerragruntOptions) error
- func (r *Runner) SetParseOptions(parserOptions []hclparse.Option)
- func (r *Runner) SetQueue(q *queue.Queue)
- func (r *Runner) SetReport(report *report.Report)
- func (r *Runner) SetTerragruntConfig(config *config.TerragruntConfig)
- func (r *Runner) SetUnitFilters(filters ...common.UnitFilter)
- func (r *Runner) WithOptions(opts ...common.Option) *Runner
- type UnitRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build( ctx context.Context, l log.Logger, terragruntOptions *options.TerragruntOptions, opts ...common.Option, ) (common.StackRunner, error)
Build stack runner using discovery and queueing mechanisms.
func FilterDiscoveredUnits ¶ added in v0.89.0
func FilterDiscoveredUnits(discovered component.Components, units common.Units) component.Components
FilterDiscoveredUnits removes configs for units flagged as excluded and prunes dependencies that point to excluded units. This keeps the execution queue and any user-facing listings free from units not intended to run.
Inputs:
- discovered: raw discovery results (paths and dependency edges)
- units: resolved units (slice), where exclude rules have already been applied
Behavior:
- A config is included only if there's a corresponding unit and its FlagExcluded is false.
- For each included config, its Dependencies list is filtered to only include included configs.
- The function returns a new slice with shallow-copied entries so the original discovery results remain unchanged.
func NewRunnerPoolStack ¶
func NewRunnerPoolStack(ctx context.Context, l log.Logger, terragruntOptions *options.TerragruntOptions, discovered component.Components, opts ...common.Option) (common.StackRunner, error)
NewRunnerPoolStack creates a new stack from discovered units.
Types ¶
type Controller ¶ added in v0.83.2
type Controller struct {
// contains filtered or unexported fields
}
Controller orchestrates concurrent execution over a DAG.
func NewController ¶ added in v0.83.2
func NewController(q *queue.Queue, units []*common.Unit, opts ...ControllerOption) *Controller
NewController creates a new Controller with the given options and a pre-built queue.
type ControllerOption ¶ added in v0.83.2
type ControllerOption func(*Controller)
ControllerOption is a function that modifies a Controller.
func WithMaxConcurrency ¶
func WithMaxConcurrency(concurrency int) ControllerOption
WithMaxConcurrency sets the concurrency for the Controller.
func WithRunner ¶
func WithRunner(runner UnitRunner) ControllerOption
WithRunner sets the UnitRunner for the Controller.
type Runner ¶
Runner implements the Stack interface for runner pool execution.
func (*Runner) GetUnitFilters ¶ added in v0.89.0
func (r *Runner) GetUnitFilters() []common.UnitFilter
GetUnitFilters returns the unit filters configured for the runner. This is primarily used for testing purposes.
func (*Runner) JSONUnitDeployOrder ¶
JSONUnitDeployOrder returns the order of units to be processed for a given Terraform command in JSON format.
func (*Runner) ListStackDependentUnits ¶
ListStackDependentUnits returns a map of units and their dependent units in the stack.
func (*Runner) LogUnitDeployOrder ¶
LogUnitDeployOrder logs the order of units to be processed for a given Terraform command.
func (*Runner) Run ¶
Run executes the stack according to TerragruntOptions and returns the first error (or a joined error) once execution is finished.
func (*Runner) SetParseOptions ¶
SetParseOptions sets the ParseOptions for the stack.
func (*Runner) SetQueue ¶ added in v0.89.0
SetQueue replaces the runner's queue with a new one. This is useful for filtering the queue after initial discovery.
func (*Runner) SetTerragruntConfig ¶
func (r *Runner) SetTerragruntConfig(config *config.TerragruntConfig)
SetTerragruntConfig sets the config for the stack.
func (*Runner) SetUnitFilters ¶ added in v0.89.0
func (r *Runner) SetUnitFilters(filters ...common.UnitFilter)
SetUnitFilters sets the unit filters for the runner. Filters are deduplicated before appending to prevent duplicate filter application.