Skip to main content
Version: Next

Auto Build

Auto Build enables automatic component builds when code is pushed to a Git repository. Instead of manually triggering builds, you can configure components to build automatically whenever changes are pushed to the repository.

Prerequisites​

Before configuring auto-build, ensure you have:

  1. OpenChoreo installed and running
  2. Workflow plane installed in your OpenChoreo cluster
  3. A Component created in OpenChoreo pointing to a Git repository
  4. Access to create webhooks in your Git repository

Configuration​

Step 1: Create the Webhook Secret​

Create a Kubernetes secret to store the webhook secret that will be used to validate incoming webhooks:

# Generate a random secret
WEBHOOK_SECRET=$(openssl rand -hex 32)
echo "Your webhook secret: $WEBHOOK_SECRET"

# Create the Kubernetes secret
kubectl create secret generic git-webhook-secrets \
-n openchoreo-control-plane \
--from-literal=github-secret="$WEBHOOK_SECRET"

# Verify the secret was created
kubectl get secret git-webhook-secrets -n openchoreo-control-plane
Important

Save the $WEBHOOK_SECRET value. You will need it when configuring the webhook in your Git provider.

Step 2: Configure the Webhook in Your Git Provider​

Create a webhook in your Git provider that points to OpenChoreo's webhook endpoint. OpenChoreo uses a single unified endpoint (/api/v1alpha1/autobuild) for all Git providers β€” the provider is identified automatically from the request headers sent by the Git provider (e.g. X-GitHub-Event for GitHub, X-Event-Key for Bitbucket).

The following example shows how to configure this in GitHub:

  1. Go to your repository
  2. Navigate to Settings > Webhooks > Add webhook
  3. Configure the webhook:
FieldValue
Payload URLhttps://<your-openchoreo-api-domain>/api/v1alpha1/autobuild
Content typeapplication/json
SecretThe $WEBHOOK_SECRET you generated in Step 1
Which eventsSelect "Just the push event"
ActiveChecked
  1. Click Add webhook

GitHub will send a test ping event. You should see a green checkmark if the webhook was delivered successfully.

Step 3: Enable Auto-Build on Components​

Developers enable auto-build on their Components by setting autoBuild: true. See the developer Auto-Build guide for the Component configuration and field reference.

Step 4: Verify​

After a developer enables auto-build on a Component and pushes code, verify a WorkflowRun is created:

kubectl get workflowrun

Local Development Testing​

For local testing with a development cluster, you can use ngrok to expose your local OpenChoreo instance to receive webhooks from your Git provider:

ngrok http --host-header=api.openchoreo.localhost 8080

Use the ngrok HTTPS URL as your webhook payload URL:

https://abc123xyz.ngrok-free.app/api/v1alpha1/autobuild