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

Context

Every step's template and every if condition can read context: a small set of values about the run, plus any you add. It is how one Workflow serves several environments, and how a custom step names what it creates after the run that created it.

Built-in values​

VariableDescriptionType
context.nameThe name of the WorkflowRunstring
context.namespaceThe namespace of the WorkflowRunstring
context.stepNameThe name of the current stepstring
context.stepSessionIDThe ID of the current stepstring
context.spanIDThe trace ID of the current step in this reconcilestring

In an Application's workflow, context.name and context.namespace are the Application's, and KubeVela adds values of its own, such as the Application's revision: every field is in KubeVela's Context Reference.

Custom values​

Values you set in a WorkflowRun's spec.context are added to it. A value with the same name as a built-in one replaces it.

apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: deploy-run
namespace: default
spec:
context:
env: test
workflowRef: deploy-template

Steps in deploy-template can then branch on context.env, or pass it to a step's properties. Run a Workflow Template per Environment is the full example.

Context and data passing​

The context is fixed for the run: steps read it, they can't change it. To hand a value from one step to the next, use outputs and inputs.