common

package
v0.97.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 12 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 WithReport

func WithReport(r *report.Report) Option

WithReport attaches a report collector to the stack, enabling run summaries and metrics.

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 ReportProvider added in v0.95.0

type ReportProvider interface {
	GetReport() *report.Report
}

ReportProvider exposes the report attached to 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) error
	// LogUnitDeployOrder logs the order in which units will be deployed for the given Terraform command.
	LogUnitDeployOrder(l log.Logger, terraformCommand string) error
	// JSONUnitDeployOrder returns the deployment order of units as a JSON string.
	JSONUnitDeployOrder(terraformCommand string) (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
	// SetReport attaches a report object to the stack for collecting run data and summaries.
	SetReport(r *report.Report)
}

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 NewUnitRunnerFromComponent deprecated added in v0.94.0

func NewUnitRunnerFromComponent(unit *component.Unit) *UnitRunner

Deprecated: use NewUnitRunner

func (*UnitRunner) Run

func (runner *UnitRunner) Run(ctx context.Context, opts *options.TerragruntOptions, r *report.Report) 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