engine

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package engine orchestrates a Tekton PipelineRun. It builds the DAG, resolves params and results, evaluates when-expressions, runs `finally` tasks, and drives a Backend. Pure of I/O except via the Backend and the Reporter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetResultsDirProvisioner

func SetResultsDirProvisioner(fn func(parent, taskName string) (string, error))

SetResultsDirProvisioner is called once by the CLI to wire the engine's per-task results dir creation into a workspace.Manager. Tests don't need this — the unit test fake backend ignores the empty path.

Types

type Engine

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

func New

func New(be backend.Backend, rep reporter.Reporter, opts Options) *Engine

func (*Engine) RunPipeline

func (e *Engine) RunPipeline(ctx context.Context, in PipelineInput) (RunResult, error)

type MatrixInfo added in v1.6.0

type MatrixInfo = tektontypes.MatrixInfo

MatrixInfo is re-exported from tektontypes so callers in the engine package can refer to it as engine.MatrixInfo. The single type lives in tektontypes to avoid an engine→tektontypes import cycle when the cluster backend reconstructs it from a TaskRun.

type Options

type Options struct {
	MaxParallel int
	// VolumeResolver materialises a Task's volumes onto host paths just
	// before the task runs. The CLI sets this; tests may leave it nil
	// (volumes are then unsupported in that test).
	VolumeResolver VolumeResolver
	// Refresolver dispatches resolver-backed taskRefs at task-dispatch
	// time. nil-safe: when nil, any PipelineTask whose taskRef.resolver
	// is non-empty will fail with a clear error from lookupTaskSpecLazy.
	// The CLI builds this from --resolver-allow / --resolver-cache-dir /
	// --offline; tests inject a Registry with an inline stub resolver.
	Refresolver *refresolver.Registry
}

type PipelineInput

type PipelineInput struct {
	Bundle     *loader.Bundle
	Name       string                            // pipeline name
	Params     map[string]tektontypes.ParamValue // user-provided params
	Workspaces map[string]string                 // pipeline workspace name → host path
	RunID      string                            // optional; auto-generated if empty
}

PipelineInput names what to run and how.

type RunResult

type RunResult struct {
	Status string // succeeded | failed
	Tasks  map[string]TaskOutcome
	// Reason is the backend-supplied terminal reason. On the cluster
	// backend this is the Tekton condition reason verbatim
	// (PipelineRunTimeout, PipelineValidationFailed, Failed, …); on
	// the docker backend it's empty. Surfaced for diagnostic logging
	// only — the user-visible status enum lives in Status.
	Reason string
	// Message is the backend-supplied terminal message. Same purpose
	// as Reason — surfaced so failure logs can attribute a misclassified
	// run to a specific backend code path.
	Message string
	// Results holds resolved Pipeline.spec.results once the run is
	// terminal. Each value is one of: string, []string, map[string]string.
	// nil or empty when the Pipeline didn't declare spec.results, or when
	// none resolved (every referenced task failed or skipped the result).
	// A dropped entry surfaces as an EvtError on the event stream — on
	// both the docker and the cluster backend.
	Results map[string]any
}

RunResult is the outcome of a pipeline run.

type TaskOutcome

type TaskOutcome struct {
	Status   string
	Message  string
	Results  map[string]string
	Attempt  int           // final attempt number (1-based); 0 = did not run
	Duration time.Duration // duration of the final attempt
	// Matrix, when non-nil, identifies which expansion of a
	// matrix-fanned parent PipelineTask this outcome came from.
	// Threaded into reporter.Event.Matrix at task-start / task-end /
	// task-skip emission.
	Matrix *tektontypes.MatrixInfo
}

type VolumeResolver added in v1.2.0

type VolumeResolver func(taskName string, vs []tektontypes.Volume) (map[string]string, error)

VolumeResolver is the engine's hook for the volumes package. Returns map[volumeName] -> hostPath.

Directories

Path Synopsis
Package dag implements a small directed acyclic graph: build, topological level grouping, cycle detection, descendant traversal.
Package dag implements a small directed acyclic graph: build, topological level grouping, cycle detection, descendant traversal.

Jump to

Keyboard shortcuts

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