Documentation
¶
Index ¶
- func ScopeID(meta recipe.NodeMetadata, fallback string, scopeType ScopeType) string
- type CELOptionsProvider
- type DiagnosticsObserver
- type DynamicOutputs
- type ExpressionSegment
- type RenderMode
- type ResolutionContext
- func (rc *ResolutionContext) AddExecution(output map[string]interface{})
- func (rc *ResolutionContext) AddExecutionWithArtifactData(output map[string]interface{}, artifactRefs map[string]recipeartifacts.Ref, ...)
- func (rc *ResolutionContext) AddExecutionWithArtifacts(output map[string]interface{}, artifactRefs map[string]recipeartifacts.Ref)
- func (rc *ResolutionContext) ApplyContextPatch(p coretask.ContextPatch) error
- func (rc *ResolutionContext) EvaluateCEL(expr string) (bool, error)
- func (rc *ResolutionContext) GetGitCommitContext() contextual.GitCommitContext
- func (rc *ResolutionContext) GetLastArtifactRefs() []recipeartifacts.Ref
- func (rc *ResolutionContext) GetLastArtifacts() []jobdb.Artifact
- func (rc *ResolutionContext) GetLastExecution() map[string]interface{}
- func (rc *ResolutionContext) NewChildContext(scopeType ScopeType, metadata recipe.NodeMetadata, fallback string, ...) (*ResolutionContext, error)
- func (rc *ResolutionContext) RememberArtifacts(artifacts []jobdb.Artifact)
- func (rc *ResolutionContext) ResolveMap(input map[string]interface{}) (map[string]interface{}, error)
- func (rc *ResolutionContext) ResolveTemplateWithMode(expr string, mode RenderMode) (interface{}, error)
- func (rc *ResolutionContext) ResolveValueWithLocals(value interface{}, locals map[string]interface{}) (interface{}, error)
- func (rc *ResolutionContext) ResolveValueWithMode(value interface{}, mode RenderMode) (interface{}, error)
- func (rc *ResolutionContext) ResolveVars(vars map[string]interface{}) error
- func (rc *ResolutionContext) TaskExecutionContext() contextual.TaskExecutionContext
- func (rc *ResolutionContext) UpdateGitState(commit contextual.GitCommitContext)
- func (rc *ResolutionContext) WithFailure(f *recipe.RuntimeFailure) *ResolutionContext
- func (rc *ResolutionContext) WithLocals(locals map[string]interface{}) *ResolutionContext
- type ResolutionMode
- type ResolutionOptions
- type RunOutput
- type ScopeMetadata
- type ScopeType
- type Segment
- type StepOutput
- type TextSegment
- type TransitionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CELOptionsProvider ¶
type CELOptionsProvider interface {
TypeOptions() []cel.EnvOption
FunctionOptions(adapter types.Adapter) ([]cel.EnvOption, error)
}
CELOptionsProvider supplies type options (must be applied at env creation) and function options (require adapter) for CEL.
func MergeCELOptionsProviders ¶
func MergeCELOptionsProviders(providers ...CELOptionsProvider) CELOptionsProvider
type DiagnosticsObserver ¶ added in v0.0.11
type DynamicOutputs ¶
type DynamicOutputs map[string]interface{}
DynamicOutputs marks a map whose keys are not known until runtime (e.g. child recipe outputs). During validation we want template resolution to tolerate missing keys and return a benign placeholder instead of failing with "no such key". DynamicOutputs is a marker type we use when seeding validation placeholders for steps whose outputs are not knowable at compile time (e.g., child recipes). It aliases a simple map so normal execution still gets a concrete map, while validation can wrap it in a permissive accessor.
type ExpressionSegment ¶
type ExpressionSegment struct {
Expression string // Raw CEL expression
Pos int // Start position in original input
}
ExpressionSegment represents a CEL expression in a template
func (ExpressionSegment) Position ¶
func (e ExpressionSegment) Position() int
type RenderMode ¶
type RenderMode int
RenderMode defines how templates should be resolved (interpolation vs pure CEL).
const ( // ModeInterpolation supports string interpolation with embedded expressions ModeInterpolation RenderMode = iota // ModePureCEL requires pure CEL expression only (for when conditions) ModePureCEL )
type ResolutionContext ¶
type ResolutionContext struct {
// Scope type: "root", "sequence", "state_machine", "state"
ScopeType ScopeType
Options ResolutionOptions
// EffectiveConst is inherited down the node tree and prevents git state advancement.
EffectiveConst bool
// Parent context (nil for root)
Parent *ResolutionContext
// Template data for current scope
TemplateData templateData
// CEL environment for when expressions
CELEnv *cel.Env
CurrentRunID string // Track current run for this scope
// contains filtered or unexported fields
}
ResolutionContext represents template resolution context
func NewRecipeResolutionContext ¶
func NewRecipeResolutionContext(commitContext *contextual.GitCommitContext, recipeInputs map[string]interface{}, execCtx contextual.JobContext, opts ...ResolutionOptions) (*ResolutionContext, error)
NewRecipeResolutionContext creates a new resolution context for a recipe
func (*ResolutionContext) AddExecution ¶
func (rc *ResolutionContext) AddExecution(output map[string]interface{})
func (*ResolutionContext) AddExecutionWithArtifactData ¶
func (rc *ResolutionContext) AddExecutionWithArtifactData(output map[string]interface{}, artifactRefs map[string]recipeartifacts.Ref, artifacts []jobdb.Artifact)
func (*ResolutionContext) AddExecutionWithArtifacts ¶
func (rc *ResolutionContext) AddExecutionWithArtifacts(output map[string]interface{}, artifactRefs map[string]recipeartifacts.Ref)
func (*ResolutionContext) ApplyContextPatch ¶
func (rc *ResolutionContext) ApplyContextPatch(p coretask.ContextPatch) error
ApplyContextPatch mutates template-visible context for this ResolutionContext.
Job patches are applied to this context and all ancestors (global visibility). Scoped patches are applied to the currently-visible scope containers only (e.g. a sequence's "sequence" map, or a state machine's "states" map).
func (*ResolutionContext) EvaluateCEL ¶
func (rc *ResolutionContext) EvaluateCEL(expr string) (bool, error)
EvaluateCEL handles pure CEL evaluation for when conditions
func (*ResolutionContext) GetGitCommitContext ¶
func (rc *ResolutionContext) GetGitCommitContext() contextual.GitCommitContext
func (*ResolutionContext) GetLastArtifactRefs ¶
func (rc *ResolutionContext) GetLastArtifactRefs() []recipeartifacts.Ref
func (*ResolutionContext) GetLastArtifacts ¶
func (rc *ResolutionContext) GetLastArtifacts() []jobdb.Artifact
func (*ResolutionContext) GetLastExecution ¶
func (rc *ResolutionContext) GetLastExecution() map[string]interface{}
func (*ResolutionContext) NewChildContext ¶
func (rc *ResolutionContext) NewChildContext(scopeType ScopeType, metadata recipe.NodeMetadata, fallback string, inputs map[string]interface{}) (*ResolutionContext, error)
NewChildContext creates a child resolution context
func (*ResolutionContext) RememberArtifacts ¶
func (rc *ResolutionContext) RememberArtifacts(artifacts []jobdb.Artifact)
func (*ResolutionContext) ResolveMap ¶
func (rc *ResolutionContext) ResolveMap(input map[string]interface{}) (map[string]interface{}, error)
func (*ResolutionContext) ResolveTemplateWithMode ¶
func (rc *ResolutionContext) ResolveTemplateWithMode(expr string, mode RenderMode) (interface{}, error)
ResolveTemplateWithMode handles expression evaluation with a specific mode
func (*ResolutionContext) ResolveValueWithLocals ¶ added in v0.0.24
func (rc *ResolutionContext) ResolveValueWithLocals(value interface{}, locals map[string]interface{}) (interface{}, error)
func (*ResolutionContext) ResolveValueWithMode ¶
func (rc *ResolutionContext) ResolveValueWithMode(value interface{}, mode RenderMode) (interface{}, error)
ResolveValueWithMode recursively resolves templates in a value with a specific mode
func (*ResolutionContext) ResolveVars ¶ added in v0.0.11
func (rc *ResolutionContext) ResolveVars(vars map[string]interface{}) error
ResolveVars evaluates a vars block against the current outer vars snapshot, then atomically overlays the rendered values onto the current scope.
func (*ResolutionContext) TaskExecutionContext ¶
func (rc *ResolutionContext) TaskExecutionContext() contextual.TaskExecutionContext
func (*ResolutionContext) UpdateGitState ¶
func (rc *ResolutionContext) UpdateGitState(commit contextual.GitCommitContext)
func (*ResolutionContext) WithFailure ¶ added in v0.0.22
func (rc *ResolutionContext) WithFailure(f *recipe.RuntimeFailure) *ResolutionContext
func (*ResolutionContext) WithLocals ¶ added in v0.0.24
func (rc *ResolutionContext) WithLocals(locals map[string]interface{}) *ResolutionContext
type ResolutionMode ¶
type ResolutionMode string
const ( ModeRun ResolutionMode = "run" ModeValidate ResolutionMode = "validate" )
type ResolutionOptions ¶
type ResolutionOptions struct {
Mode ResolutionMode
ValidationMode string
ClampSliceIndex bool
AllowFutureStepRefs bool
CatchBeforeRetry bool
// ResolvedSelectors carries compiler-internal selector pins for the current run.
ResolvedSelectors map[string]string
// ResolvedGitRefs carries compiler-internal repo/ref pins for the current run.
ResolvedGitRefs map[string]string
// CELOptionsProvider allows callers (server/api testserver, cortex) to inject CEL functions.
// It is given the adapter to allow proper wrapping of complex return types.
CELOptionsProvider CELOptionsProvider
DiagnosticsObserver DiagnosticsObserver
}
func DefaultResolutionOptions ¶
func DefaultResolutionOptions() ResolutionOptions
type ScopeMetadata ¶
type ScopeMetadata struct {
ExecutionID string `json:"execution_id"`
Timestamp time.Time `json:"timestamp"`
}
ScopeMetadata contains execution context metadata
type Segment ¶
type Segment interface {
Position() int // For error reporting
// contains filtered or unexported methods
}
Segment represents a parsed segment of a template
type StepOutput ¶
type StepOutput = contextual.StepOutput
type TextSegment ¶
TextSegment represents plain text in a template
func (TextSegment) Position ¶
func (t TextSegment) Position() int
type TransitionData ¶ added in v0.0.11
type TransitionData struct {
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Payload map[string]interface{} `json:"payload"`
Failure *recipe.RuntimeFailure `json:"failure,omitempty"`
}
TransitionData is the transition metadata visible to a target state invocation.
func EmptyTransitionData ¶ added in v0.0.11
func EmptyTransitionData() TransitionData
func NewFailureTransitionData ¶ added in v0.0.22
func NewFailureTransitionData(from string, to string, payload map[string]interface{}, failure *recipe.RuntimeFailure) TransitionData
func NewTransitionData ¶ added in v0.0.11
func NewTransitionData(from string, to string, payload map[string]interface{}) TransitionData
func (TransitionData) AsMap ¶ added in v0.0.11
func (td TransitionData) AsMap() map[string]interface{}
func (TransitionData) Clone ¶ added in v0.0.11
func (td TransitionData) Clone() TransitionData