Quick setup
Get webhook URL
Navigate to your project’s Settings → Integrations tab in the web UI.Your webhook URL will be in the format:
Supported events
Webhooks can trigger builds on:- Push events: Commits pushed to branches
- Tag events: New tags created
- Pull request events: Pull requests opened or updated (platform-dependent)
GitHub webhooks
Configure webhook
- Payload URL: Your Copr webhook URL
- Content type: Select
application/json - Which events: Select individual events
- Enable Pushes for branch commits
- Enable Branch or tag creation for tag events
GitHub example
GitLab webhooks
Configure webhook
- URL: Your Copr webhook URL
- Trigger: Select event triggers
- Enable Push events
- Enable Tag push events (if building from tags)
GitLab example
Pagure webhooks
For detailed Pagure integration, see the Pagure integration guide. Pagure integration offers advanced features like PR builds and commit status reporting.Bitbucket webhooks
Configure webhook
- Title: Name your webhook (e.g., “Copr”)
- URL: Your Copr webhook URL
- Triggers: Select Repository push
Bitbucket example
Tag events
Webhooks can trigger builds when you create Git tags.Tag name format
For tag events to work correctly, the tag name should contain the package name in this format:Examples of valid tags
mypackage-1.2.3mypackage-1.2.3-1mypackage_1.2.3
Different tag patterns
If your tag name doesn’t include the package name, explicitly specify the package in the webhook URL:my-package, but your GitHub tag is just 1.22.3:
Replace hyphens in the package name with underscores in the URL:
my-package becomes my_packageCustom webhooks
Trigger builds programmatically with custom webhooks.Basic custom webhook
The package must exist in your project, and you must use the
POST HTTP method.Custom webhook with data
Send data to your custom build script:hook_data file.
Custom webhook with subdirectories
Build into custom subdirectories (subprojects)::pr: subdirectories are automatically removed after 40 days of build inactivity.Multiple packages in one repository
If your Git repository contains multiple Copr packages, all packages will be rebuilt when a webhook is triggered, unless you specify a package name in the webhook URL.Selective package builds
Include the package name in the webhook URL to build only that package:Example: Monorepo with multiple packages
Webhook security
Webhook URLs contain a UUID that acts as a secret token. Keep these URLs private to prevent unauthorized builds.Regenerating webhook URLs
If your webhook URL is compromised, you can regenerate it by:- Removing the package
- Re-adding it (this generates a new UUID)
Troubleshooting webhooks
Webhook not triggering builds
Check package auto-rebuild setting
Check package auto-rebuild setting
Ensure
webhook-rebuild is enabled:Verify webhook URL
Verify webhook URL
Make sure the webhook URL in your Git platform matches the one in Copr’s Integrations tab.
Check Git platform webhook deliveries
Check Git platform webhook deliveries
Most Git platforms have a webhook delivery log showing recent webhook requests and responses.
- GitHub: Settings → Webhooks → Recent Deliveries
- GitLab: Settings → Webhooks → Recent events
Verify package exists
Verify package exists
The package must exist in your Copr project before webhooks will work:
Tag builds not working
Check tag name format
Check tag name format
Ensure your tag name follows the
PKGNAME-VERSION format or include the package name in the webhook URL.Enable tag events
Enable tag events
Make sure tag creation events are enabled in your Git platform’s webhook configuration.
Multiple packages building unexpectedly
Specify package in webhook URL
Specify package in webhook URL
If you only want to build specific packages, add the package name to the webhook URL:
Advanced webhook workflows
Pull request builds
Some forges support pull request builds. When a pull request is opened or updated, Copr can automatically build the PR branch. This is particularly well-supported with Pagure integration.Branch-specific builds
Configure different packages for different branches:CI/CD integration
Integrate Copr webhooks into your CI/CD pipeline:Webhook URLs reference
Format
Components
<FORGE>: Git platform (github,gitlab,pagure,bitbucket,custom)<ID>: Copr project ID<UUID>: Secret token (automatically generated)[PACKAGE_NAME]: Optional package name to build
Examples
GitHub webhook:Best practices
Use separate packages for different branches
Use separate packages for different branches
Instead of one package that builds from multiple branches, create separate packages for each branch. This gives you better control and clearer build history.
Test webhooks before relying on them
Test webhooks before relying on them
After setting up a webhook, make a test commit or tag to ensure builds trigger correctly.
Document your webhook setup
Document your webhook setup
Keep notes on which webhooks are configured and for which packages, especially in projects with multiple packages.
Use meaningful tag names
Use meaningful tag names
Include the package name and version in tags to make webhook builds more predictable:
myapp-1.2.3 instead of just v1.2.3Consider rate limiting
Consider rate limiting
Avoid triggering too many builds in rapid succession. Copr may rate-limit excessive webhook requests.