Documentation
¶
Index ¶
- Constants
- func BuildCellRecipeSelector(repositorySource string, recipeName string, ref string) (string, error)
- func ExecuteRecipe(ctx workflow.Context, r recipe.Recipe, rawRecipeInputs map[string]interface{}, ...) (map[string]interface{}, []swf.Artifact, error)
- func ExecuteRecipeWithExecutor(exec RecipeExecutor, ctx workflow.Context, r recipe.Recipe, ...) (map[string]interface{}, []swf.Artifact, error)
- func GenerateTestContext() (contextual.JobContext, contextual.GitCommitContext)
- func IsCellRecipeName(value string) bool
- func IsGitRecipeSelector(selector string) bool
- func IsLocalRecipeFileReference(value string) bool
- func NewRecipeJobWorker(opts RecipeJobWorkerOptions) swf.JobWorker
- func NewRecipeWorker(dependencies ops.ServiceDependencies2, ...) (*swf.WorkSet, error)
- func NewRecipeWorkerWithOptions(dependencies ops.ServiceDependencies2, ...) (*swf.WorkSet, error)
- func NormalizeGitRepositorySource(source string) (string, error)
- func RepositoryNameFromSource(source string) string
- func ValidateRecipeSelector(selector string) error
- type CELVariables
- type DefaultRecipeExecutor
- func (d DefaultRecipeExecutor) ExecuteNode(ctx workflow.Context, parentResCtx *template.ResolutionContext, n *recipe.Node) error
- func (d DefaultRecipeExecutor) ExecuteOp(ctx workflow.Context, parentResolutionContext *template.ResolutionContext, ...) error
- func (d DefaultRecipeExecutor) ExecuteRecipe(ctx workflow.Context, r recipe.Recipe, rawRecipeInputs map[string]interface{}, ...) (map[string]interface{}, []swf.Artifact, error)
- func (d DefaultRecipeExecutor) ExecuteSequence(ctx workflow.Context, rCtx *template.ResolutionContext, ...) error
- func (d DefaultRecipeExecutor) ExecuteStateMachine(ctx workflow.Context, parentContext *template.ResolutionContext, ...) error
- func (d DefaultRecipeExecutor) WithDelegate(delegate RecipeExecutor) DefaultRecipeExecutor
- type EnvironmentInfo
- type ExecutionInfo
- type ExecutionMode
- type ExecutionOptions
- type NoOpStateObserver
- type NormalizedOpInput
- type RecipeContext
- type RecipeExecutor
- type RecipeInfo
- type RecipeJobWorkerOptions
- type RecipeRefResolver
- type RecipeRefYAMLLoader
- type RecipeSourceKind
- type RecipeSourceResolution
- type RecipeSourceResolver
- type RecipeSourceResolverOptions
- type RecipeSourceYAMLLoader
- type ResolvedRecipeSource
- type ScopedContext
- func (sc *ScopedContext) GetCELVariables(currentOutputs map[string]interface{}) map[string]interface{}
- func (sc *ScopedContext) GetStepOutput(stepID string) (interface{}, bool)
- func (sc *ScopedContext) GetTemplateData() map[string]interface{}
- func (sc *ScopedContext) MergeOutputs() map[string]interface{}
- func (sc *ScopedContext) SetStepOutput(stepID string, output interface{})
- type StateContext
- type StateInfo
- type StateObserver
- type StepResult
- type ValidationMode
- type ValidationOptions
- type WithinRecipeResolutionResult
Constants ¶
const ( CellRecipeDirectory = ".c2j/recipes" DefaultRecipeName = "default" DefaultRecipeRef = "main" )
const RootSourceResolutionTaskType = "recipe_root_source_resolve"
const WithinRecipeResolutionTaskType = "recipe_within_resolution"
Variables ¶
This section is empty.
Functions ¶
func BuildCellRecipeSelector ¶
func ExecuteRecipe ¶
func ExecuteRecipe(ctx workflow.Context, r recipe.Recipe, rawRecipeInputs map[string]interface{}, execCtx contextual.JobContext, commitContext contextual.GitCommitContext, opts ...ExecutionOptions) (map[string]interface{}, []swf.Artifact, error)
ExecuteRecipe keeps the existing public entry point, delegating to the default executor.
func ExecuteRecipeWithExecutor ¶
func ExecuteRecipeWithExecutor(exec RecipeExecutor, ctx workflow.Context, r recipe.Recipe, rawRecipeInputs map[string]interface{}, execCtx contextual.JobContext, commitContext contextual.GitCommitContext, opts ...ExecutionOptions) (map[string]interface{}, []swf.Artifact, error)
ExecuteRecipeWithExecutor allows callers to run with a custom executor (e.g., decorator).
func GenerateTestContext ¶
func GenerateTestContext() (contextual.JobContext, contextual.GitCommitContext)
func IsCellRecipeName ¶
func IsGitRecipeSelector ¶
func NewRecipeJobWorker ¶
func NewRecipeJobWorker(opts RecipeJobWorkerOptions) swf.JobWorker
func NewRecipeWorker ¶
func NewRecipeWorker(dependencies ops.ServiceDependencies2, activityRegistry *workerops.ActivityRegistry, provider ...template.CELOptionsProvider) (*swf.WorkSet, error)
func NewRecipeWorkerWithOptions ¶
func NewRecipeWorkerWithOptions(dependencies ops.ServiceDependencies2, activityRegistry *workerops.ActivityRegistry, opts RecipeJobWorkerOptions) (*swf.WorkSet, error)
func ValidateRecipeSelector ¶
Types ¶
type CELVariables ¶
type CELVariables struct {
Outputs map[string]interface{} `json:"Outputs"`
State *StateInfo `json:"State"`
States map[string]map[string]interface{} `json:"States"`
Inputs map[string]interface{} `json:"ContainerInputs"`
Context *RecipeContext `json:"Context"`
Steps map[string]interface{} `json:"Steps"` // Access to step outputs within current state
}
CELVariables represents the variables available in CEL expressions
type DefaultRecipeExecutor ¶
type DefaultRecipeExecutor struct {
// contains filtered or unexported fields
}
DefaultRecipeExecutor preserves the existing execution behavior, with optional CEL provider injection.
func NewDefaultRecipeExecutor ¶
func NewDefaultRecipeExecutor(provider template.CELOptionsProvider) DefaultRecipeExecutor
NewDefaultRecipeExecutor builds an executor with a default CEL provider.
func (DefaultRecipeExecutor) ExecuteNode ¶
func (d DefaultRecipeExecutor) ExecuteNode(ctx workflow.Context, parentResCtx *template.ResolutionContext, n *recipe.Node) error
ExecuteWorkflow implements the WorkflowExecutor interface for unified recipes
func (DefaultRecipeExecutor) ExecuteOp ¶
func (d DefaultRecipeExecutor) ExecuteOp(ctx workflow.Context, parentResolutionContext *template.ResolutionContext, metadata recipe.NodeMetadata, op string) error
func (DefaultRecipeExecutor) ExecuteRecipe ¶
func (d DefaultRecipeExecutor) ExecuteRecipe(ctx workflow.Context, r recipe.Recipe, rawRecipeInputs map[string]interface{}, execCtx contextual.JobContext, commitContext contextual.GitCommitContext, opts ...ExecutionOptions) (map[string]interface{}, []swf.Artifact, error)
func (DefaultRecipeExecutor) ExecuteSequence ¶
func (d DefaultRecipeExecutor) ExecuteSequence(ctx workflow.Context, rCtx *template.ResolutionContext, metadata recipe.NodeMetadata, outputTemplate map[string]interface{}, sequence []recipe.Node) error
func (DefaultRecipeExecutor) ExecuteStateMachine ¶
func (d DefaultRecipeExecutor) ExecuteStateMachine(ctx workflow.Context, parentContext *template.ResolutionContext, metadata recipe.NodeMetadata, outputTemplate map[string]interface{}, stateMap *recipe.StateMap, opts ...ExecutionOptions) error
ExecuteStateMachine runs the state machine with the new StateMap format
func (DefaultRecipeExecutor) WithDelegate ¶
func (d DefaultRecipeExecutor) WithDelegate(delegate RecipeExecutor) DefaultRecipeExecutor
WithDelegate returns a copy of the executor that will dispatch recursive executor calls (ExecuteNode/ExecuteSequence/ExecuteStateMachine/ExecuteOp) to the provided delegate. This allows decorators to wrap the default executor without reimplementing execution logic.
type EnvironmentInfo ¶
EnvironmentInfo contains environment context
type ExecutionInfo ¶
type ExecutionInfo struct {
StartedAt time.Time `json:"started_at"`
Timeout time.Duration `json:"timeout"`
}
ExecutionInfo contains execution context
type ExecutionMode ¶
type ExecutionMode string
const ( ExecutionModeRun ExecutionMode = "run" ExecutionModeValidate ExecutionMode = "validate" )
type ExecutionOptions ¶
type ExecutionOptions struct {
Mode ExecutionMode
Validation ValidationOptions
// Optional CEL options provider to inject extra functions/types.
CELOptionsProvider template.CELOptionsProvider
StateObserver StateObserver
// ResolvedSelectors carries internal selector pins for the current recipe run.
ResolvedSelectors map[string]string
}
type NoOpStateObserver ¶
type NoOpStateObserver struct{}
func (NoOpStateObserver) StateEntered ¶
func (NoOpStateObserver) StateEntered(stateName string)
func (NoOpStateObserver) StateExited ¶
func (NoOpStateObserver) StateExited(stateName string)
func (NoOpStateObserver) TransitionEvalauted ¶
func (NoOpStateObserver) TransitionEvalauted(expression string, result bool, nextStateIfExpressionTrue string)
type NormalizedOpInput ¶
type NormalizedOpInput struct {
Data map[string]interface{}
StoredArtifactKeys []swf.ArtifactKey
}
func NormalizeOpInput ¶
func NormalizeOpInput(inputType reflect.Type, raw map[string]interface{}) (NormalizedOpInput, error)
type RecipeContext ¶
type RecipeContext struct {
Recipe RecipeInfo `json:"recipe"`
Environment EnvironmentInfo `json:"environment"`
Execution ExecutionInfo `json:"execution"`
}
RecipeContext contains system-provided context variables
type RecipeExecutor ¶
type RecipeExecutor interface {
ExecuteRecipe(ctx workflow.Context, r recipe.Recipe, rawRecipeInputs map[string]interface{}, execCtx contextual.JobContext, commitContext contextual.GitCommitContext, opts ...ExecutionOptions) (map[string]interface{}, []swf.Artifact, error)
ExecuteNode(ctx workflow.Context, parentResCtx *template.ResolutionContext, n *recipe.Node) error
ExecuteStateMachine(ctx workflow.Context, parentContext *template.ResolutionContext, metadata recipe.NodeMetadata, outputTemplate map[string]interface{}, stateMap *recipe.StateMap, opts ...ExecutionOptions) error
ExecuteOp(ctx workflow.Context, parentResolutionContext *template.ResolutionContext, metadata recipe.NodeMetadata, op string) error
ExecuteSequence(ctx workflow.Context, rCtx *template.ResolutionContext, metadata recipe.NodeMetadata, outputTemplate map[string]interface{}, sequence []recipe.Node) error
}
RecipeExecutor defines the surface area for executing recipes, states, and ops. This enables decorator implementations (e.g., analysis) without changing call sites.
type RecipeInfo ¶
type RecipeInfo struct {
Name string `json:"name"`
Version string `json:"version"`
ExecutionID string `json:"execution_id"`
}
RecipeInfo contains information about the current recipe
type RecipeJobWorkerOptions ¶
type RecipeJobWorkerOptions struct {
CELOptionsProvider template.CELOptionsProvider
// Executor overrides recipe execution for instrumentation. When nil, DefaultRecipeExecutor is used.
Executor RecipeExecutor
// ExecutorFactory overrides Executor when provided, allowing per-run executors.
ExecutorFactory func() RecipeExecutor
// RootSourceResolver resolves non-embedded root recipe selectors at execution time.
RootSourceResolver RecipeSourceResolver
// OnRecipeLoaded is called after the recipe artifact has been loaded and parsed.
OnRecipeLoaded func(recipeName string)
// OnRecipeSourceResolved is called after the root recipe source has been resolved.
OnRecipeSourceResolved func(RecipeSourceResolution)
}
type RecipeRefResolver ¶
type RecipeRefResolver interface {
ResolveRecipeRef(ctx context.Context, projectID string, selector string) (RecipeSourceResolution, error)
LoadRecipeRef(ctx context.Context, projectID string, selector string) (*recipe.Recipe, error)
}
type RecipeRefYAMLLoader ¶
type RecipeSourceKind ¶
type RecipeSourceKind string
const ( RecipeSourceKindArtifact RecipeSourceKind = "artifact" RecipeSourceKindServerRef RecipeSourceKind = "serverRef" RecipeSourceKindGit RecipeSourceKind = "git" )
type RecipeSourceResolution ¶
type RecipeSourceResolution struct {
SourceKind RecipeSourceKind `json:"source_kind"`
SubmittedSelector string `json:"submitted_selector"`
ResolvedSelector string `json:"resolved_selector,omitempty"`
ResolvedCommit string `json:"resolved_commit,omitempty"`
ArtifactName string `json:"artifact_name,omitempty"`
WasAlreadyPinned bool `json:"was_already_pinned"`
}
func (RecipeSourceResolution) EffectiveSelector ¶
func (r RecipeSourceResolution) EffectiveSelector() string
type RecipeSourceResolver ¶
type RecipeSourceResolver interface {
Resolve(ctx context.Context, projectID string, selector string) (RecipeSourceResolution, error)
Load(ctx context.Context, projectID string, resolution RecipeSourceResolution) (recipe.Recipe, error)
}
func NewRecipeSourceResolver ¶
func NewRecipeSourceResolver(opts RecipeSourceResolverOptions) RecipeSourceResolver
type RecipeSourceResolverOptions ¶
type RecipeSourceResolverOptions struct {
GitRepository gitpkg.Repository
RecipeRefResolver RecipeRefResolver
}
type RecipeSourceYAMLLoader ¶
type ResolvedRecipeSource ¶
type ResolvedRecipeSource struct {
RecipeSourceResolution
RecipeYAML string `json:"recipe_yaml,omitempty"`
}
func ParseResolvedRecipeSourceJSON ¶
func ParseResolvedRecipeSourceJSON(raw []byte) (*ResolvedRecipeSource, error)
func ParseResolvedRecipeSourceTaskData ¶
func ParseResolvedRecipeSourceTaskData(td swf.TaskData) (*ResolvedRecipeSource, error)
func (ResolvedRecipeSource) LoadRecipe ¶
func (r ResolvedRecipeSource) LoadRecipe() (recipe.Recipe, error)
type ScopedContext ¶
type ScopedContext struct {
// Parent scope (nil for root)
Parent *ScopedContext
// Local step outputs for this scope only
LocalStepOutputs map[string]interface{}
// Reference to the global state context
StateContext *StateContext
// Scope identifier for debugging
ScopeID string
}
ScopedContext represents an isolated execution context for nested compositions
func NewScopedContext ¶
func NewScopedContext(parent *ScopedContext, stateCtx *StateContext, scopeID string) *ScopedContext
NewScopedContext creates a new scoped context
func (*ScopedContext) GetCELVariables ¶
func (sc *ScopedContext) GetCELVariables(currentOutputs map[string]interface{}) map[string]interface{}
GetCELVariables prepares variables for CEL evaluation with proper scoping
func (*ScopedContext) GetStepOutput ¶
func (sc *ScopedContext) GetStepOutput(stepID string) (interface{}, bool)
GetStepOutput retrieves a step output from the current scope only
func (*ScopedContext) GetTemplateData ¶
func (sc *ScopedContext) GetTemplateData() map[string]interface{}
GetTemplateData prepares template data with proper scoping
func (*ScopedContext) MergeOutputs ¶
func (sc *ScopedContext) MergeOutputs() map[string]interface{}
MergeOutputs merges the outputs from a nested scope back to parent This is used when a nested composition completes
func (*ScopedContext) SetStepOutput ¶
func (sc *ScopedContext) SetStepOutput(stepID string, output interface{})
SetStepOutput sets a step output in the current scope
type StateContext ¶
type StateContext struct {
CurrentState string `json:"current_state"`
Inputs map[string]interface{} `json:"inputs"`
StateOutputs map[string]map[string]interface{} `json:"state_outputs"`
Attempts map[string]int `json:"attempts"`
StateInfo map[string]*StateInfo `json:"state_info"`
RecipeContext *RecipeContext `json:"recipe_context,omitempty"`
StepOutputs map[string]interface{} `json:"step_outputs"` // Track step outputs within current state
}
StateContext maintains the runtime context for state machine execution
type StateInfo ¶
type StateInfo struct {
Name string `json:"name"`
Attempts int `json:"attempts"`
EnteredAt time.Time `json:"entered_at"`
}
StateInfo tracks metadata for each state
type StateObserver ¶
type StepResult ¶
type StepResult struct {
Outputs map[string]interface{}
}
StepResult stores the result of a workflow step
type ValidationMode ¶
type ValidationMode string
const ( ValidateAll ValidationMode = "all" ValidatePathOnly ValidationMode = "path_only" )
type ValidationOptions ¶
type ValidationOptions struct {
Mode ValidationMode
CollectAll bool
}
type WithinRecipeResolutionResult ¶
type WithinRecipeResolutionResult struct {
ResolvedSelectors map[string]string `json:"resolved_selectors,omitempty"`
}
func ParseWithinRecipeResolutionJSON ¶
func ParseWithinRecipeResolutionJSON(raw []byte) (*WithinRecipeResolutionResult, error)
func ParseWithinRecipeResolutionTaskData ¶
func ParseWithinRecipeResolutionTaskData(td swf.TaskData) (*WithinRecipeResolutionResult, error)
Source Files
¶
- artifact_bindings.go
- artifact_job_context.go
- artifact_keys.go
- artifact_map.go
- compiler.go
- execution_options.go
- extension_functions.go
- extension_helpers.go
- job_worker.go
- normalize_op_input.go
- op_input_validation.go
- ops_test_init.go
- recipe_inputs.go
- recipe_retriever.go
- root_source.go
- scope.go
- selector_helpers.go
- shared_test_tools.go
- statemachine_compiler.go
- statemachine_context.go
- task_output.go
- validation_context.go
- validation_helpers.go
- validation_placeholders.go
- within_recipe_resolution.go