A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Workflow Next

Steps, Workflows and WorkflowRuns

A workflow is a list of steps. Each step has a type, and the type decides what the step does: apply an object, wait for approval, call an HTTP endpoint, send a notification. The engine runs the steps in order, keeps the state of each one, and passes data between them. It doesn't start a pod or a job for a step: a step is a CUE template that the controller evaluates itself, so a workflow that only applies objects and waits costs no compute beyond the controller.

Where a workflow lives​

The same list of steps can sit in three objects:

ObjectHoldsRun byRuns
Application (spec.workflow)the steps that deliver the Application's componentsvela-coreagain on every change to the Application, which also keeps what it applied in place
WorkflowRun (spec.workflowSpec)a one-off list of stepsthe vela-workflow controlleronce. Deleting it deletes nothing its steps created
Workflowsteps with no run of their own: a templatenothing on its ownwhen a WorkflowRun names it in workflowRef, or an Application in spec.workflow.ref

This section is about the steps, which behave the same in all three. The Application parts, such as the phases around the workflow and the workflow KubeVela writes when you leave it out, are in KubeVela's Application Workflow overview.

A step​

- name: deploy-prod # unique in the workflow
type: apply-deployment # a WorkflowStepDefinition
properties: # the type's parameters
image: nginx
dependsOn: [approve] # wait for other steps (DAG mode)
if: status.approve.succeeded
timeout: 10m
inputs: # take values from earlier steps
- from: image-tag
parameterKey: image
outputs: # give values to later steps
- name: deployed
valueFrom: output.value.metadata.name

Everything but name and type is optional. The guides cover each field: dependsOn, if, timeout, inputs and outputs and forEach.

A step of type step-group holds subSteps instead of properties: a group runs its sub-steps, and finishes when they have.

Step types​

A step type is a WorkflowStepDefinition: a CUE template with a parameter block for the step's properties and the actions the step takes, such as kube.#Apply or http.#Do. The step's properties fill the template's parameter, an open CUE struct, so a property the template doesn't declare is ignored: a misspelt one leaves its field unset. A missing required property, or one of the wrong type, fails the step.

Where the types come fromWhat you get
The vela-workflow chart or addonThe built-in step types a WorkflowRun can use: apply-deployment, apply-job, apply-object, read-object, request, notification, suspend, step-group and the rest.
vela-coreThe Application step types, such as deploy and apply-component, and most of the rest. apply-app, read-app, addon-operation, chat-gpt and apply-job come only with the chart or addon.
Your platform teamTypes of their own, written in CUE: see Workflow Step Definition.

The built-in types are installed in the release namespace, vela-system by default. Each type's reference entry says whether it works in an Application, a WorkflowRun or both.

Execution modes​

ModeHow steps runDefault for
StepByStepEach step starts when the one before it has finished.steps
DAGSteps start together; dependsOn and inputs decide the order.the subSteps of a step-group

Set either with mode on the WorkflowRun or Workflow (workflow.mode in an Application):

spec:
mode:
steps: DAG
subSteps: StepByStep

A step with no if runs only when the steps before it succeeded, so a failure skips what comes after it. An if changes that for its own step: see If Conditions.

What a step can read​

A step's template and its if condition read three things:

  • Its properties, after inputs have been filled in.
  • The context: the name and namespace of the run, the current step, and any values you set. See Context.
  • The status of earlier steps, in if conditions: status.<step>.succeeded, status.<step>.failed, status.<step>.timeout and status.<step>.message.

Next​