common

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package common defines minimal runner interfaces to allow multiple implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	Apply(stack StackRunner)
}

Option applies configuration to a StackRunner.

func WithParseOptions

func WithParseOptions(parserOptions []hclparse.Option) Option

WithParseOptions provides custom HCL parser options to both discovery and stack execution.

func WithWorktrees added in v0.95.0

func WithWorktrees(w *worktrees.Worktrees) Option

WithWorktrees provides git worktrees to discovery for git filter expressions.

type ParseOptionsProvider added in v0.87.4

type ParseOptionsProvider interface {
	GetParseOptions() []hclparse.Option
}

ParseOptionsProvider exposes HCL parser options carried by an Option.

type StackRunner

type StackRunner interface {
	// Run executes all units in the stack according to the specified Terraform command and options.
	Run(ctx context.Context, l log.Logger, opts *options.TerragruntOptions, r *report.Report) error
	// LogUnitDeployOrder logs the order in which units will be deployed.
	LogUnitDeployOrder(l log.Logger, isDestroy bool, showAbsPaths bool, experiments experiment.Experiments) error
	// JSONUnitDeployOrder returns the deployment order of units as a JSON string.
	JSONUnitDeployOrder(isDestroy bool, showAbsPaths bool) (string, error)
	// ListStackDependentUnits returns a map of each unit to the list of units that depend on it.
	ListStackDependentUnits() map[string][]string
	// GetStack retrieves the underlying Stack object managed by this runner.
	GetStack() *component.Stack
}

StackRunner is the abstraction for running a stack of units. Implemented by runnerpool.Runner and any alternate runner implementations.

type UnitRunner

type UnitRunner struct {
	Err    error
	Unit   *component.Unit
	Status UnitStatus
}

UnitRunner handles the logic for running a single component.Unit.

func NewUnitRunner

func NewUnitRunner(unit *component.Unit) *UnitRunner

NewUnitRunner creates a UnitRunner from a component.Unit.

func (*UnitRunner) Run

func (runner *UnitRunner) Run(
	ctx context.Context,
	l log.Logger,
	opts *options.TerragruntOptions,
	r *report.Report,
	cfg *runcfg.RunConfig,
	credsGetter *creds.Getter,
) error

Run executes a component.Unit right now.

type UnitStatus

type UnitStatus int

UnitStatus represents the status of a unit during execution.

const (
	Waiting UnitStatus = iota
	Running
	Finished
)

type WorktreeOption added in v0.95.0

type WorktreeOption struct {
	Worktrees *worktrees.Worktrees
}

WorktreeOption carries worktrees through the runner pipeline for git filter expressions.

func (WorktreeOption) Apply added in v0.95.0

func (o WorktreeOption) Apply(stack StackRunner)

Apply is a no-op for runner (worktrees are used in discovery, not runner execution).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL