resolver

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package resolver performs Tekton-style variable substitution:

$(params.name)          – scalar param
$(params.obj.key)       – object param key
$(params.arr[*])        – array param expanded into multiple args (only via SubstituteArgs)
$(tasks.X.results.Y)    – named result from a previously-executed task
$(context.taskRun.name) – synthesized context var

The double-dollar literal `$$` produces a single `$` and is not interpreted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Substitute

func Substitute(s string, ctx Context) (string, error)

Substitute replaces $(...) references in s using ctx. Returns an error for unknown references.

func SubstituteAllowStepRefs added in v1.2.0

func SubstituteAllowStepRefs(s string, ctx Context) (string, error)

SubstituteAllowStepRefs is like Substitute but leaves $(step.results.X.path) and $(steps.<step>.results.<name>) placeholders intact when the context hasn't populated StepResults / CurrentStep. Used by the engine's task-level pass; per-step substitution happens later in the docker backend.

func SubstituteArgs

func SubstituteArgs(args []string, ctx Context) ([]string, error)

SubstituteArgs is like Substitute but operates on a []string and supports $(params.x[*]) — the entire arg is replaced by the array's elements.

func SubstituteArgsAllowStepRefs added in v1.2.0

func SubstituteArgsAllowStepRefs(args []string, ctx Context) ([]string, error)

SubstituteArgsAllowStepRefs is the AllowStepRefs counterpart of SubstituteArgs.

Types

type Context

type Context struct {
	Params       map[string]string            // string params
	ArrayParams  map[string][]string          // array params (only used by SubstituteArgs for [*] expansion)
	ObjectParams map[string]map[string]string // object params
	Results      map[string]map[string]string // task name → result name → value
	ContextVars  map[string]string            // dotted name → value (without "context." prefix)
	// StepResults are the results produced by earlier steps within the same
	// Task. Populated by the docker backend right before each step launches;
	// nil during the engine's task-level substitution pass.
	StepResults map[string]map[string]string
	// CurrentStep is the step being resolved; required to resolve
	// $(step.results.<name>.path) to /tekton/steps/<step>/results/<name>.
	CurrentStep string
}

Jump to

Keyboard shortcuts

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