Documentation
¶
Overview ¶
Package validator runs semantic checks on a loaded Bundle: refs resolve, the pipeline DAG has no cycles, workspaces are bound, params are present.
Index ¶
- func Validate(b *loader.Bundle, pipelineName string, providedParams map[string]bool) []error
- func ValidateTaskSpec(taskName string, spec tektontypes.TaskSpec) []error
- func ValidateWithOptions(b *loader.Bundle, pipelineName string, providedParams map[string]bool, ...) []error
- type Options
- type UnresolvedRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate checks the named pipeline against the bundle. providedParams names only — values are checked elsewhere. Returns all errors found, not just the first.
func ValidateTaskSpec ¶ added in v1.6.0
func ValidateTaskSpec(taskName string, spec tektontypes.TaskSpec) []error
ValidateTaskSpec runs the per-Task semantic checks the engine needs after a resolver returns bytes (or after stepTemplate merge). It is a subset of the full Validate: only invariants that are intrinsic to a single TaskSpec (steps non-empty, timeout parses, onError values allowed, volumes well-formed). Pipeline-level checks (workspaces bound, params bound) are NOT here — those belong to Validate.
This mirrors what the v1 admission webhook would reject. Phase 1 of resolvers calls this on resolver outputs to reject bytes that wouldn't pass a real Tekton install.
func ValidateWithOptions ¶ added in v1.6.0
func ValidateWithOptions(b *loader.Bundle, pipelineName string, providedParams map[string]bool, opts Options) []error
ValidateWithOptions is Validate plus resolver-aware checks driven by Options. The shared check pipeline runs unchanged; resolver checks run after, on the same pl.Spec.Tasks ∪ pl.Spec.Finally walk.
Types ¶
type Options ¶ added in v1.6.0
type Options struct {
// Offline rejects any resolver-backed ref that isn't already in
// the cache. The actual cache-presence check is delegated to
// CacheCheck (nil means "always miss").
Offline bool
// RegisteredResolvers is the allow-list of resolver names that
// dispatch in direct mode. Default empty means "no restriction"
// — every non-empty resolver name is accepted (useful in tests).
// Phase 1's CLI populates this from --resolver-allow.
RegisteredResolvers []string
// RemoteResolverEnabled short-circuits the direct-mode allow-list
// check: when true, an arbitrary resolver name is accepted because
// the remote cluster's controller knows it. Phase 5 flips this on
// when --remote-resolver-context is set.
RemoteResolverEnabled bool
// CacheCheck answers "is this resolver request in the cache?"
// for the --offline pre-flight. nil means "no cache wired" —
// every offline check fails. Phase 6 wires the on-disk cache.
CacheCheck func(UnresolvedRef) bool
}
Options carries optional knobs for resolver-aware validation. Zero value is fine; ValidateWithOptions(b, name, params, Options{}) is equivalent to Validate(b, name, params).
type UnresolvedRef ¶ added in v1.6.0
type UnresolvedRef struct {
Pipeline string
PipelineTask string
Kind string
Resolver string
Params map[string]string
}
UnresolvedRef is the validator's view of a resolver-backed ref (mirrors loader.UnresolvedRef but lives here so the CacheCheck callback shape is stable).