Documentation
¶
Overview ¶
Package workflow builds native xyOps workflows: a validated graph (NewXyopsWorkflow) and the plan -> changes? -> approval -> deploy pipeline (NewPipeline). xyOps owns orchestration, Resume authorization and audit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pipeline ¶
type Pipeline struct {
Workflow *XyopsWorkflow
Plan, Apply xyops.EventRef
OwnedPlan, OwnedApply *xyops.Event
// Approval is always owned: ID_approval.
Approval *xyops.Event
}
Pipeline is a native workflow. Plan and Apply are references to the events its nodes run; OwnedPlan/OwnedApply are set only for events it created.
func NewPipeline ¶
NewPipeline creates a visible native graph: plan -> changes? -> apply, where apply is suspended at start until an authorized user resumes it (Abort declines). A start suspension keeps the apply job "starting", so the run keeps its slot while it waits: with MaxRuns 1 one run is in progress (planning, waiting or applying) and the rest queue. Resume can merge params/input into the apply job and redirect the workflow; handlers must not take deployment intent from either. The workflow ID and any owned event IDs are claimed app-wide: a collision with another event, workflow or pipeline in the app fails synthesis.
type PipelineProps ¶
type PipelineProps struct {
// ID names the workflow; owned steps are ID_plan, ID_approval and
// ID_deploy. Every title is "<stack>-<id>" (xyops.Title).
ID, Category string
// Executor runs the gate job and any owned steps.
Executor string
Enabled bool
Trigger xyops.Trigger
Fields []xyops.Field
Plan, Apply PipelineStep
MaxRuns int
StepConcurrency int
// Queue holds up to this many further runs (FIFO, native xyOps queue) while
// MaxRuns are in progress, for up to TimeoutSeconds. 0 = refuse them.
// A queued run starts nothing (no step, no credentials) until it starts.
Queue int
TimeoutSeconds int
AlertWebHook string
// NotifyWebHook is fired when a run reaches approval (plan has changes).
NotifyWebHook string
}
PipelineProps defines native xyOps orchestration, not an independent approval service. xyOps permissions authorize Resume and its audit log records it. Plan must emit {"xy":1,"data":{"changes":true}} only after successful admission/planning. Apply must independently enforce pinned deployment intent, expiry, replay protection and disruption guards. A graph is not that policy.
Concurrency has three separate controls:
- MaxRuns: concurrent runs of this workflow (including ones paused at the gate).
- StepConcurrency: job limit on events this pipeline owns (default MaxRuns). Shared events keep the limits their owner declared.
- Target locking (two runs mutating the same infrastructure) belongs to the handlers: the graph cannot know which runs touch the same targets.
type PipelineStep ¶
PipelineStep is one handler in a pipeline: either an event this pipeline owns (Task: created as "<pipeline ID>_<step>" on Executor) or an existing event referenced by ID (Event: declared elsewhere in this app, or external). A referenced event is never created or changed by the pipeline, so several pipelines can share one event; its own concurrency limits still apply.
type XyopsConnection ¶
type XyopsConnection struct {
ID string `json:"id"`
Source string `json:"source"`
Dest string `json:"dest"`
Condition string `json:"condition,omitempty"`
}
XyopsConnection preserves native routing conditions.
type XyopsNode ¶
type XyopsNode struct {
ID string `json:"id"`
Type string `json:"type"`
X int `json:"x"`
Y int `json:"y"`
Data map[string]any `json:"data,omitempty"`
}
XyopsNode is a native xyOps node. Data is backend-owned JSON, not a CDK deployment vocabulary. Action/limit nodes attach to jobs, not sequential steps.
type XyopsTask ¶
XyopsTask is a trusted control-plane handler owned by a pipeline step. Scripts come from reviewed code, never from request parameters.
type XyopsWorkflow ¶
XyopsWorkflow is a provider-backed workflow definition, installed when its containing stack is applied (including bootstrap). Construction never runs it.
func NewXyopsWorkflow ¶
func NewXyopsWorkflow(stack *core.Stack, name string, p XyopsWorkflowProps) (*XyopsWorkflow, error)
NewXyopsWorkflow validates and synthesizes a native workflow resource using attributes available since provider 0.1.2-dev.8. Require xyops.Provider on stack. Native loops are allowed. Use an explicit join controller for all-of fan-in.
func (*XyopsWorkflow) Ref ¶
func (w *XyopsWorkflow) Ref() xyops.EventRef
Ref returns a reference for launching this workflow (for example from an event's OnSuccess). The workflow resource is a dependency of the launcher.
type XyopsWorkflowProps ¶
type XyopsWorkflowProps struct {
ID string
Title string
Category string
Enabled bool
Nodes []XyopsNode
Connections []XyopsConnection
Triggers []map[string]any
Actions []map[string]any
Limits []map[string]any
Tags []string
Import bool
Params map[string]any
Fields []map[string]any
Notes *string
Icon *string
}
XyopsWorkflowProps maps the existing xyops_workflow provider resource. No runtime approval or deployment-safety guarantee is inferred from a graph. Optional metadata and runtime input fields require provider 0.1.2-dev.8 or later.