execution

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Binary      string
	InitEnabled bool
	PlanEnabled bool
	PlanMode    PlanMode
	Parallelism int
	Env         map[string]string
}

Config is the normalized execution configuration shared by CI generation and local execution.

func ConfigFromProject

func ConfigFromProject(cfg config.Snapshot) Config

ConfigFromProject normalizes execution config from a project config snapshot.

func (Config) BuildRequirements added in v0.10.3

func (c Config) BuildRequirements() pipeline.BuildRequirements

BuildRequirements converts execution-mode choices into pipeline IR requirements. Provider plugins should only add provider/config requirements; runtime execution requirements are derived here.

type DefaultScheduler

type DefaultScheduler struct{}

DefaultScheduler schedules jobs from the pipeline DAG.

func (DefaultScheduler) Schedule

func (DefaultScheduler) Schedule(ir *pipeline.IR) ([]pipeline.JobGroup, error)

type EventSink

type EventSink interface {
	JobStarted(job *pipeline.Job)
	JobFinished(job *pipeline.Job, result *JobResult)
}

EventSink consumes structured execution events.

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor executes a Plan.

func NewExecutor

func NewExecutor(runner JobRunner, opts ...ExecutorOption) *Executor

NewExecutor constructs an Executor.

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, ir *pipeline.IR) (*Result, error)

Execute runs the pipeline IR group-by-group.

type ExecutorOption

type ExecutorOption func(*Executor)

ExecutorOption mutates executor behavior.

func WithEventSink

func WithEventSink(sink EventSink) ExecutorOption

WithEventSink configures an execution event sink.

func WithParallelism

func WithParallelism(parallelism int) ExecutorOption

WithParallelism bounds concurrent jobs inside one execution group.

func WithScheduler

func WithScheduler(s Scheduler) ExecutorOption

WithScheduler overrides the execution scheduler.

type GroupResult

type GroupResult struct {
	Name     string
	JobCount int
}

GroupResult describes one scheduled execution group.

type JobResult

type JobResult struct {
	Name        string
	Status      JobStatus
	StartedAt   time.Time
	FinishedAt  time.Time
	ArtifactIDs []string
	Err         error
}

JobResult is the execution outcome for one job.

type JobRunner

type JobRunner interface {
	Run(ctx context.Context, job *pipeline.Job) error
}

JobRunner executes one job.

type JobStatus

type JobStatus string

JobStatus is the status of an executed job.

const (
	JobStatusSucceeded JobStatus = "succeeded"
	JobStatusFailed    JobStatus = "failed"
	JobStatusSkipped   JobStatus = "skipped"
)

type PlanMode

type PlanMode string

PlanMode controls which plan artifacts TerraCi produces. It does not change dependency ordering or the high-level execution flow.

const (
	PlanModeStandard PlanMode = "standard"
	PlanModeDetailed PlanMode = "detailed"
)

type Result

type Result struct {
	Groups []GroupResult
	Jobs   []*JobResult
}

Result is the aggregate outcome for a run.

func (*Result) Failed

func (r *Result) Failed() *JobResult

Failed returns the first failed job result, if any.

type Scheduler

type Scheduler interface {
	Schedule(ir *pipeline.IR) ([]pipeline.JobGroup, error)
}

Scheduler builds execution groups from a pipeline IR.

Returns an error if the IR is structurally invalid (cycles or duplicate job names) — preventing silent fallback that would run dependent jobs in the wrong order.

type WorkerPool

type WorkerPool interface {
	Run(ctx context.Context, jobs []*pipeline.Job, fn func(context.Context, *pipeline.Job) error) error
}

WorkerPool runs a group of jobs with bounded concurrency.

type Workspace

type Workspace struct {
	// contains filtered or unexported fields
}

Workspace centralizes canonical execution-domain paths.

func NewWorkspace

func NewWorkspace(workDir, serviceDir string) Workspace

NewWorkspace constructs a Workspace from absolute work and service directories.

func (Workspace) ModuleDir

func (w Workspace) ModuleDir(rel string) string

ModuleDir returns the absolute module directory for a relative module path.

func (Workspace) PlanFile

func (w Workspace) PlanFile(rel string) string

PlanFile returns the absolute plan.tfplan path for a module.

func (Workspace) PlanJSONFile

func (w Workspace) PlanJSONFile(rel string) string

PlanJSONFile returns the absolute plan.json path for a module.

func (Workspace) PlanTextFile

func (w Workspace) PlanTextFile(rel string) string

PlanTextFile returns the absolute plan.txt path for a module.

func (Workspace) ServiceDir

func (w Workspace) ServiceDir() string

func (Workspace) ServiceFile

func (w Workspace) ServiceFile(name string) string

ServiceFile returns the absolute path to a file under the service directory.

func (Workspace) WorkDir

func (w Workspace) WorkDir() string

Jump to

Keyboard shortcuts

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