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 ¶
Substitute replaces $(...) references in s using ctx. Returns an error for unknown references.
func SubstituteAllowStepRefs ¶ added in v1.2.0
SubstituteAllowStepRefs is the deferred-tolerant counterpart of Substitute. It leaves placeholders intact when the inner pass legitimately cannot resolve them yet:
- $(step.results.X.path) and $(steps.X.results.Y) — resolved by the docker backend per-step right before each step launches.
- $(params.X) for any X not bound in ctx.Params/ObjectParams — the StepAction inner pass populates only its own scoped params, so an outer task-level $(params.<task-param>) survives to the outer pass.
- $(workspaces.<name>.path), $(context.<name>) without a binding, $(tasks.X.results.Y) without an entry — same deferral rationale; the outer engine.substituteSpec pass has the full Task scope and resolves these moments later.
Strictly malformed refs (a key that doesn't match any known scope shape) still error here, just as they do in plain Substitute.
func SubstituteArgs ¶
SubstituteArgs is like Substitute but operates on a []string and supports $(params.x[*]) and $(tasks.X.results.Y[*]) — the entire arg is replaced by the array's elements. For task-result [*] references, the source string is JSON-decoded into []string before splicing (Tekton's on-disk shape for an array-of-strings result).
func SubstituteArgsAllowStepRefs ¶ added in v1.2.0
SubstituteArgsAllowStepRefs is the AllowStepRefs counterpart of SubstituteArgs. Unknown $(params.x[*]) array refs are LEFT INTACT (deferred) so the outer pass can resolve them under the full Task scope; mirrors the deferral semantics of SubstituteAllowStepRefs for scalar refs.
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
}