Overview
Webhooks allow external services (GitHub, GitLab, Pagure, etc.) to trigger automatic rebuilds when source code changes. To use webhooks securely, you need to generate a webhook secret for your project.Webhook URL Format
Once you have a webhook secret, configure your Git hosting service to send webhooks to:Supported Services
- GitHub - Push events and pull requests
- GitLab - Push events and merge requests
- Pagure - Push events and pull requests
- Bitbucket - Push events
Generate Webhook Secret
Path Parameters
Project owner name (username or @groupname)
Project name
Response
Project ID
Project name
Project owner name
Full project name (ownername/projectname)
The generated webhook secret token
Configuring Webhooks
Prerequisites
- Generate a webhook secret using the endpoint above
- Enable webhook rebuilds for packages in your project
- Configure the webhook in your Git hosting service
Package Configuration
For webhooks to trigger builds, packages must havewebhook_rebuild enabled:
GitHub Configuration
- Go to your repository Settings → Webhooks → Add webhook
- Set Payload URL to:
https://copr.fedorainfracloud.org/webhooks/{ownername}/{projectname}/{webhook_secret}/ - Set Content type to:
application/json - Select events: Just the push event (or Pull requests if desired)
- Click Add webhook
GitLab Configuration
- Go to your project Settings → Webhooks
- Set URL to:
https://copr.fedorainfracloud.org/webhooks/{ownername}/{projectname}/{webhook_secret}/ - Select Push events (and Merge request events if desired)
- Click Add webhook
Pagure Configuration
- Go to your project Settings → Webhooks
- Set URL to:
https://copr.fedorainfracloud.org/webhooks/{ownername}/{projectname}/{webhook_secret}/ - Select Push events
- Click Add webhook
Webhook Behavior
When a webhook is received:- Copr verifies the webhook secret matches
- Copr identifies affected packages based on the repository URL
- For each package with
webhook_rebuildenabled:- A new build is automatically submitted
- The build uses the package’s configured source settings
- The build targets all enabled chroots in the project
Webhook-triggered builds are marked as background builds by default to avoid cluttering the main build list.
Security Considerations
- Keep webhook secrets confidential - Anyone with the secret can trigger builds
- Rotate secrets regularly - Use the generate endpoint to create new secrets
- Enable webhook verification - Configure your Git hosting to verify SSL certificates
- Monitor webhook activity - Check build logs for unexpected automated builds
Troubleshooting
Webhook not triggering builds
- Verify the webhook secret is correct in your Git hosting configuration
- Ensure the package has
webhook_rebuildset totrue - Check that the repository URL in the package configuration matches the webhook source
- Review webhook delivery logs in your Git hosting service
Multiple packages being built
If multiple packages share the same repository URL and have webhooks enabled, all will be rebuilt when the webhook fires. This is intentional for monorepo scenarios.Build errors
Webhook-triggered builds use the package’s configured source settings. If builds fail:- Verify the package source configuration is correct
- Check that the
committishfield matches your default branch - Review build logs for specific errors