Incoming Webhooks
Incoming webhooks allow you to trigger pipelines directly via HTTP POST requests, without requiring Git events.
TOC
OverviewConfigure Incoming WebhookTrigger Pipeline via Incoming WebhookIncoming Webhook PayloadCustom ParametersSecurity ConsiderationsTroubleshooting Incoming WebhooksBest Practices1. PipelineRun Management2. Monitoring3. Incoming WebhooksTroubleshootingPipelineRun Not CreatedPipelineRun Not RunningStatus Not ReportedNext StepsOverview
Incoming webhooks provide a way to:
- Trigger pipelines from external systems
- Integrate with CI/CD tools that don't use Git
- Trigger pipelines manually or via API calls
- Support custom payloads and parameters
- HTTP POST request: Send a POST request to the PAC controller's
/incomingendpoint - Authentication: PAC validates the request using the secret (from header or query parameter)
- Repository lookup: PAC finds the Repository CR based on the repository name and namespace
- Pipeline trigger: PAC processes the payload and triggers matching pipelines, similar to Git webhook events
- PipelineRun creation: PAC creates PipelineRuns based on the payload and pipeline definitions
Key differences from Git webhooks:
- No Git provider involved - direct HTTP requests
- Custom payload format - you control the structure
- Can trigger pipelines without actual Git commits
- Useful for external integrations and manual triggers
Configure Incoming Webhook
-
Enable in Repository CR: Add incoming webhook configuration to your Repository CR:
-
Create incoming webhook secret:
-
Get incoming webhook URL:
The incoming webhook endpoint is:
URL Parameters (optional, can also be passed via headers):
repository: Repository CR namenamespace: Namespace where Repository CR is locatedsecret: Incoming webhook secret value
Example with query parameters:
Example with headers (recommended for security):
With headers: X-Repository, X-Namespace, X-Secret
Use headers (X-Repository, X-Namespace, X-Secret) instead of query parameters to avoid exposing secrets in URLs and logs.
Trigger Pipeline via Incoming Webhook
Send a POST request to the incoming webhook endpoint:
Incoming Webhook Payload
The incoming webhook accepts a JSON payload with the following structure:
Custom Parameters
You can pass custom parameters in the webhook payload:
These parameters are available in your pipeline as $(params.environment) and $(params.deploy).
Security Considerations
- Use secrets: Always use webhook secrets to validate requests
- HTTPS: Use HTTPS for webhook endpoints in production
- Network policies: Restrict access to incoming webhook endpoints
- Rate limiting: Implement rate limiting to prevent abuse
- Validate payloads: Validate incoming payloads before processing
Troubleshooting Incoming Webhooks
-
Check webhook URL: Verify the URL is correct and accessible
-
Verify secret: Ensure the secret matches in both request and Repository CR
-
Check PAC logs:
-
Verify Repository CR: Ensure incoming webhook is configured correctly
-
Test with curl: Use curl to test the webhook endpoint
Best Practices
1. PipelineRun Management
- Set cleanup limits: Use
max-keep-runsto prevent accumulation - Monitor resources: Watch for resource usage from PipelineRuns
- Archive important runs: Export important PipelineRuns before cleanup
2. Monitoring
- Use labels: Label PipelineRuns for easier filtering
- Set up alerts: Configure alerts for failed PipelineRuns
- Regular reviews: Periodically review PipelineRun status and logs
3. Incoming Webhooks
- Secure endpoints: Always use HTTPS and secrets
- Validate payloads: Validate incoming webhook payloads
- Document usage: Document webhook endpoints and payload formats
- Test thoroughly: Test webhook triggers before production use
Troubleshooting
PipelineRun Not Created
- Check webhook: Verify webhook is configured and receiving events
- Review Repository CR: Ensure Repository CR is correctly configured
- Check PAC logs: Review PAC controller logs for errors
- Verify pipeline file: Ensure pipeline definition file exists in repository
PipelineRun Not Running
- Check status: Review PipelineRun status and conditions
- Review logs: Check PipelineRun and TaskRun logs
- Verify resources: Ensure sufficient cluster resources
- Check permissions: Verify ServiceAccount has required permissions
Status Not Reported
- Verify Git provider token: Ensure token has required scopes
- Check PAC Watcher: Verify PAC Watcher is running
- Review logs: Check PAC Watcher logs for errors
- Test connectivity: Ensure PAC can reach Git provider API
Next Steps
- Trigger Pipelines - Learn about different trigger methods
- Maintain Pipeline Code - Pipeline definition guide
- Configure Repository - Repository setup
- Common Issues - Troubleshooting guide