Component Workflow Schema
ComponentWorkflows use a flexible parameter system that separates platform engineer governance from developer configuration. Parameters can be configured at both the platform engineer (PE) level and the developer level.
Parameter Categoriesβ
System Parametersβ
System parameters have a fixed structure required for platform features like webhooks, UI integration, and build traceability. Platform engineers can customize defaults, enums, and descriptions, but must maintain the field structure.
Fixed structure:
systemParameters:
repository:
url: string # Git repository URL
revision:
branch: string # Git branch to checkout
commit: string # Specific commit SHA (optional)
appPath: string # Path to application within repository
Why this structure is fixed:
- Enables webhooks to map Git events to components
- Powers UI actions like "build from latest commit"
- Provides build traceability and audit logs
- Supports monorepo workflows with
appPath
Developer Parametersβ
Developer parameters are completely flexible and defined by platform engineers based on the build strategy's requirements. These parameters appear in the UI when creating components and can include any build-specific configuration.
Common use cases:
- Docker build context and Dockerfile path
- Build resources (CPU, memory)
- Buildpack configuration
Schema Definitionβ
The schema section in ComponentWorkflow defines both system and developer parameters using OpenChoreo's schema shorthand syntax.
Basic Parameter Schemaβ
apiVersion: openchoreo.dev/v1alpha1
kind: ComponentWorkflow
metadata:
name: docker
namespace: default
spec:
schema:
systemParameters:
repository:
url: string | description="Git repository URL"
revision:
branch: string | default=main description="Git branch to checkout"
commit: string | description="Git commit SHA or reference (optional)"
appPath: string | default=. description="Path to application directory"
parameters:
docker:
context: string | default=. description="Docker build context path"
filePath: string | default=./Dockerfile description="Path to Dockerfile"
Advanced Schema with Custom Typesβ
Platform engineers can define reusable types for complex parameter structures:
apiVersion: openchoreo.dev/v1alpha1
kind: ComponentWorkflow
metadata:
name: google-cloud-buildpacks-advanced
namespace: default
spec:
schema:
# Define reusable types
types:
Endpoint:
name: string
port: integer
type: string | enum=REST,HTTP,TCP,UDP
schemaFile: string | description="Path to endpoint schema file"
ResourceRequirements:
requests: ResourceQuantity | default={}
limits: ResourceQuantity | default={}
ResourceQuantity:
cpu: string | default=100m
memory: string | default=256Mi
systemParameters:
repository:
url: string | description="Git repository URL"
revision:
branch: string | default=main description="Git branch"
commit: string | description="Commit SHA (optional)"
appPath: string | default=. description="Application path"
# Use custom types in parameters
parameters:
endpoints: '[]Endpoint | default=[] description="Service endpoints"'
resources: ResourceRequirements | default={}
Template Variable Referenceβ
ComponentWorkflow templates support the following variable categories for use in the runTemplate field:
| Variable Category | Syntax | Description | Example |
|---|---|---|---|
| Metadata | ${metadata.*} | System-provided workflow and component metadata | ${metadata.componentName} |
| System Parameters | ${systemParameters.*} | Repository and revision information | ${systemParameters.repository.url} |
| Developer Parameters | ${parameters.*} | Build-specific configuration from schema | ${parameters.docker.context} |
Available Metadata Variablesβ
${metadata.workflowRunName}- ComponentWorkflowRun CR name${metadata.componentName}- Component name${metadata.projectName}- Project name${metadata.orgName}- Organization name (namespace)
Using Parameters in runTemplateβ
The runTemplate field defines the Argo Workflow that will be rendered and executed. Template variables are substituted with actual values from ComponentWorkflowRun.
Example: Docker Workflowβ
apiVersion: openchoreo.dev/v1alpha1
kind: ComponentWorkflow
metadata:
name: docker
namespace: default
spec:
schema:
systemParameters:
repository:
url: string | description="Git repository URL"
revision:
branch: string | default=main description="Git branch"
commit: string | description="Commit SHA (optional)"
appPath: string | default=. description="Application path"
parameters:
docker:
context: string | default=. description="Docker build context"
filePath: string | default=./Dockerfile description="Dockerfile path"
# Template that will be rendered for each ComponentWorkflowRun
runTemplate:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: ${metadata.workflowRunName}
namespace: openchoreo-ci-${metadata.orgName}
spec:
arguments:
parameters:
# System parameters
- name: git-repo
value: ${systemParameters.repository.url}
- name: branch
value: ${systemParameters.repository.revision.branch}
- name: commit
value: ${systemParameters.repository.revision.commit}
- name: app-path
value: ${systemParameters.repository.appPath}
# Developer parameters
- name: docker-context
value: ${parameters.docker.context}
- name: dockerfile-path
value: ${parameters.docker.filePath}
# PE-controlled hardcoded parameters
- name: component-name
value: ${metadata.componentName}
- name: project-name
value: ${metadata.projectName}
- name: build-timeout
value: "30m"
- name: image-name
value: ${metadata.projectName}-${metadata.componentName}-image
- name: image-tag
value: v1
serviceAccountName: workflow-sa
workflowTemplateRef:
clusterScope: true
name: docker
Parameter Flowβ
Understanding how parameters flow through the system:
1. Platform Engineer defines ComponentWorkflow
βββ Defines schema (systemParameters + parameters)
βββ Defines runTemplate with ${...} variables
2. Developer creates Component
βββ References ComponentWorkflow by name
βββ Provides values for systemParameters and parameters
3. ComponentWorkflowRun created
βββ Contains parameter values from Component
βββ Controller renders runTemplate by substituting variables
4. Argo Workflow executed in Build Plane
βββ Receives resolved parameter values
βββ Executes build steps with actual configuration
Parameter Best Practicesβ
- Use System Parameters for Repository Info: Always use the fixed
systemParameters.repositorystructure for Git repository configuration - Define Clear Schemas: Provide descriptions and defaults for all developer parameters
- Use Enums for Limited Choices: Constrain values using
enumto prevent invalid configurations - Create Reusable Types: Define common structures as types for consistency across parameters
- Hardcode Governance Values: Use PE-controlled hardcoded parameters for security policies, registry endpoints, and build timeouts
Validation and Defaultsβ
The ComponentWorkflowRun controller automatically:
- Validates parameter values against schema constraints
- Applies default values for parameters not provided by developers
- Converts complex values (arrays, objects) to appropriate formats for Argo Workflows
- Reports validation errors through ComponentWorkflowRun conditions