backend

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package backend defines the contract between the engine and an execution substrate (Docker, k3d, ...).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Prepare runs once before any task. Pulls images, creates networks, etc.
	Prepare(ctx context.Context, run RunSpec) error

	// RunTask executes a single TaskInvocation and returns its result.
	// Implementations stream logs through inv.LogSink.
	RunTask(ctx context.Context, inv TaskInvocation) (TaskResult, error)

	// Cleanup runs once after all tasks (success or failure). Removes containers,
	// temporary networks, etc. Workspace cleanup is the engine's responsibility.
	Cleanup(ctx context.Context) error
}

Backend executes Tasks. The engine drives one Backend per run.

type LogSink

type LogSink interface {
	StepLog(taskName, stepName, stream string, line string)
}

LogSink receives streamed step output. Implementations live in the reporter.

type RunSpec

type RunSpec struct {
	RunID      string            // stable per-invocation
	Pipeline   string            // pipeline name (or task name in single-task mode)
	Images     []string          // images to pre-pull
	Workspaces map[string]string // workspace name → host path
}

RunSpec describes the whole run that's about to start.

type StepResult

type StepResult struct {
	Name     string
	Status   StepStatus
	ExitCode int
	Started  time.Time
	Ended    time.Time
}

type StepStatus

type StepStatus string
const (
	StepSucceeded StepStatus = "succeeded"
	StepFailed    StepStatus = "failed"
	StepSkipped   StepStatus = "skipped"
)

type TaskInvocation

type TaskInvocation struct {
	RunID       string
	PipelineRun string
	TaskRunName string                            // <pipelineRun>-<task>
	Task        tektontypes.TaskSpec              // resolved spec — no $(params.x) left
	Params      map[string]tektontypes.ParamValue // already-evaluated params
	Workspaces  map[string]WorkspaceMount         // task-workspace-name → host mount
	ContextVars map[string]string                 // $(context.taskRun.name) etc.
	LogSink     LogSink                           // engine-supplied sink
	ResultsHost string                            // host dir bind-mounted as /tekton/results
}

TaskInvocation is one PipelineTask, fully resolved (params substituted).

type TaskResult

type TaskResult struct {
	Status  TaskStatus
	Started time.Time
	Ended   time.Time
	Steps   []StepResult
	Results map[string]string // result name → value (read from /tekton/results/<name>)
	Err     error             // populated when Status is TaskInfraFailed
}

TaskResult is what RunTask returns.

type TaskStatus

type TaskStatus string
const (
	TaskSucceeded   TaskStatus = "succeeded"
	TaskFailed      TaskStatus = "failed"      // a step exited non-zero
	TaskInfraFailed TaskStatus = "infrafailed" // backend/env error before/around step
	TaskNotRun      TaskStatus = "not-run"     // skipped because a dep failed
	TaskSkipped     TaskStatus = "skipped"     // when expression false
)

type WorkspaceMount

type WorkspaceMount struct {
	HostPath string
	ReadOnly bool
	SubPath  string
}

Directories

Path Synopsis
Package docker implements backend.Backend using a local Docker daemon.
Package docker implements backend.Backend using a local Docker daemon.

Jump to

Keyboard shortcuts

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