Skip to main content
Version: Next

Auto-Build

Auto-build triggers a CI workflow automatically whenever you push code to your Git repository. Instead of manually creating a WorkflowRun for each build, OpenChoreo creates one for you based on the workflow configuration in your Component.

Platform Engineer Setup Required

Auto-build requires your platform engineer to set up a webhook secret and configure the webhook endpoint. See the PE Auto Build guide for infrastructure setup.

Enable Auto-Build on Your Component​

Add autoBuild: true to your Component spec:

apiVersion: openchoreo.dev/v1alpha1
kind: Component
metadata:
name: patient-management-service
spec:
owner:
projectName: default
componentType:
kind: ClusterComponentType
name: deployment/service
autoBuild: true
autoDeploy: true
workflow:
kind: ClusterWorkflow
name: ballerina-buildpack-builder
parameters:
repository:
url: "https://github.com/openchoreo/sample-workloads"
revision:
branch: "main"
appPath: "/service-ballerina-patient-management"

Apply it:

kubectl apply -f component.yaml

Key Fields​

FieldDescription
autoBuild: trueEnables webhook-triggered builds. Pushes to the configured branch create a WorkflowRun automatically.
autoDeploy: trueAutomatically deploys the generated Workload after a successful build.
workflow.parameters.repository.revision.branchThe branch that triggers builds on push.
workflow.parameters.repository.appPathOnly pushes that change files within this path trigger builds.

What Triggers a Build​

When a push event is received, OpenChoreo matches it to Components by checking:

  1. The repository URL matches the Component's repository.url
  2. The branch matches the Component's repository.revision.branch
  3. The push includes changes within the Component's appPath

If all conditions match, a WorkflowRun is created automatically with the commit SHA from the push event.

Verify Auto-Build​

After pushing a change to your repository:

# Check if a WorkflowRun was created
kubectl get workflowrun

# Watch the build progress
kubectl get workflowrun -w

See Also​

  • CI Overview β€” How CI workflows work, monitoring builds, error conditions
  • Auto Build Setup β€” Platform engineer guide for webhook infrastructure setup