Skip to main content
Version: v1.0.0-rc.1 (pre-release)

WorkflowRun

A WorkflowRun represents a single execution instance of a Workflow in OpenChoreo. While Workflows define the template and parameter schema for what can be executed, WorkflowRuns represent actual executions with specific parameter values. When created, the controller renders and executes the Argo Workflow in the workflow plane.

note

WorkflowRuns currently support Argo Workflow-based workflows only.

Imperative Resource

WorkflowRun is an imperative resource β€” it triggers an action rather than declaring a desired state. Each time a WorkflowRun is applied, it initiates a new execution. For this reason, do not include WorkflowRuns in GitOps repositories. Instead, create them through Git webhooks, the UI, or direct kubectl apply commands.

API Version​

openchoreo.dev/v1alpha1

Resource Definition​

Metadata​

WorkflowRuns are namespace-scoped resources.

apiVersion: openchoreo.dev/v1alpha1
kind: WorkflowRun
metadata:
name: <workflowrun-name>
namespace: <namespace>

WorkflowRuns should have labels to link the run to a component and project if it is running for a component:

metadata:
labels:
openchoreo.dev/component: <component-name>
openchoreo.dev/project: <project-name>

These labels are accessible in the Workflow's CEL expressions as ${metadata.labels['openchoreo.dev/component']} and ${metadata.labels['openchoreo.dev/project']}.

Spec Fields​

FieldTypeRequiredDefaultDescription
workflowWorkflowConfigYes-Workflow configuration referencing the Workflow CR and providing parameter values
ttlAfterCompletionstringNo-Auto-delete duration after completion. Copied from the Workflow template. Pattern: ^(\d+d)?(\d+h)?(\d+m)?(\d+s)?$

WorkflowConfig​

FieldTypeRequiredDefaultDescription
kindstringNoClusterWorkflowKind of the referenced workflow: Workflow (namespace-scoped) or ClusterWorkflow (cluster-scoped). Immutable after creation.
namestringYes-Name of the Workflow or ClusterWorkflow CR to use for this execution (min length: 1). Immutable after creation.
parametersobjectNo-Developer-provided values conforming to the parameter schema defined in the Workflow or ClusterWorkflow CR

The parameters field contains nested configuration that matches the parameters.openAPIV3Schema structure defined in the referenced Workflow or ClusterWorkflow.

Status Fields​

FieldTypeDefaultDescription
conditions[]Condition[]Standard Kubernetes conditions tracking execution state
runReferenceResourceReference-Reference to the workflow execution resource in workflow plane
resources[]ResourceReference-References to additional resources created in workflow plane (for cleanup)
tasks[]WorkflowTask-Vendor-neutral step status list ordered by execution sequence
startedAtTimestamp-When the workflow run started execution
completedAtTimestamp-When the workflow run finished execution (used with TTL for auto-delete)

ResourceReference​

FieldTypeDefaultDescription
apiVersionstring""API version of the resource (e.g., v1, argoproj.io/v1alpha1)
kindstring""Kind of the resource (e.g., Secret, Workflow)
namestring""Name of the resource in the workflow plane cluster
namespacestring""Namespace of the resource in the workflow plane cluster

WorkflowTask​

Provides a vendor-neutral abstraction over workflow engine-specific steps (e.g., Argo Workflow nodes).

FieldTypeDefaultDescription
namestring""Name of the task/step
phasestring""Execution phase: Pending, Running, Succeeded, Failed, Skipped, Error
startedAtTimestamp-When the task started execution
completedAtTimestamp-When the task finished execution
messagestring""Additional details, typically populated on failure or error

Condition Types​

  • WorkflowCompleted - Workflow has completed (successfully or with failure)
  • WorkflowRunning - Workflow is currently executing in the workflow plane
  • WorkflowSucceeded - Workflow execution completed successfully
  • WorkflowFailed - Workflow execution failed or errored

Examples​

Docker Build WorkflowRun​

Since kind defaults to ClusterWorkflow, you only need to specify the name:

apiVersion: openchoreo.dev/v1alpha1
kind: WorkflowRun
metadata:
name: docker-build-run-01
namespace: default
spec:
workflow:
name: dockerfile-builder
parameters:
repository:
url: "https://github.com/openchoreo/sample-workloads"
revision:
branch: "main"
appPath: "/service-go-greeter"
docker:
context: "/service-go-greeter"
filePath: "/service-go-greeter/Dockerfile"

Component WorkflowRun (with labels)​

apiVersion: openchoreo.dev/v1alpha1
kind: WorkflowRun
metadata:
name: greeter-build-01
namespace: default
labels:
openchoreo.dev/component: greeter-service
openchoreo.dev/project: default
spec:
workflow:
name: dockerfile-builder
parameters:
repository:
url: "https://github.com/openchoreo/sample-workloads"
secretRef: "github-credentials"
revision:
branch: "main"
commit: "a1b2c3d4"
appPath: "/service-go-greeter"
docker:
context: "/service-go-greeter"
filePath: "/service-go-greeter/Dockerfile"

WorkflowRun Referencing a Namespace-Scoped Workflow​

apiVersion: openchoreo.dev/v1alpha1
kind: WorkflowRun
metadata:
name: github-stats-report-run-01
namespace: default
spec:
workflow:
kind: Workflow
name: github-stats-report
parameters:
source:
org: "openchoreo"
repo: "openchoreo"
output:
format: "table"

Minimal WorkflowRun Using Defaults​

apiVersion: openchoreo.dev/v1alpha1
kind: WorkflowRun
metadata:
name: simple-run
namespace: default
spec:
workflow:
name: dockerfile-builder
parameters:
repository:
url: "https://github.com/myorg/hello-world"
# Uses default values for other parameters from Workflow schema

Status Example​

After execution, a WorkflowRun status might look like:

status:
conditions:
- type: WorkflowCompleted
status: "True"
lastTransitionTime: "2024-01-15T10:30:00Z"
reason: WorkflowSucceeded
message: Workflow has completed successfully
observedGeneration: 1
- type: WorkflowRunning
status: "False"
lastTransitionTime: "2024-01-15T10:29:30Z"
reason: WorkflowRunning
message: Argo Workflow running has completed
observedGeneration: 1
- type: WorkflowSucceeded
status: "True"
lastTransitionTime: "2024-01-15T10:30:00Z"
reason: WorkflowSucceeded
message: Workflow completed successfully
observedGeneration: 1
runReference:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
name: greeter-build-01
namespace: workflows-default
resources:
- apiVersion: external-secrets.io/v1
kind: ExternalSecret
name: greeter-build-01-git-secret
namespace: workflows-default
tasks:
- name: checkout-source
phase: Succeeded
startedAt: "2024-01-15T10:28:00Z"
completedAt: "2024-01-15T10:28:30Z"
- name: build-image
phase: Succeeded
startedAt: "2024-01-15T10:28:30Z"
completedAt: "2024-01-15T10:29:45Z"
- name: publish-image
phase: Succeeded
startedAt: "2024-01-15T10:29:45Z"
completedAt: "2024-01-15T10:30:00Z"
startedAt: "2024-01-15T10:28:00Z"
completedAt: "2024-01-15T10:30:00Z"

Annotations​

AnnotationDescription
openchoreo.dev/display-nameHuman-readable name for UI display
openchoreo.dev/descriptionDetailed description of the workflow run