Webhooks
Webhooks are API push notifications sent in the form of HTTP or HTPS POST requests. They pro-actively deliver messages to other applications when some event occurs inside their own application.
They can inform or trigger further events in the destination application. For instance, you can directly deploy an application upon the image push. This allows you to automate your deployments.
In Container Registry, you can add either an HTTP or Slack-based HTTPS URL that will be used for receiving the messages by the target application.
All incoming messages (payloads) will be in JSON format. Below is an example from the push artifact event message:
{
"type": "PUSH_ARTIFACT",
"occur_at": 1586922308,
"operator": "username",
"event_data":{
"resources": [
{
"digest": "sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
"tag": "5.0",
"resource_url": "epic-exoscale.container-registry.com/documentation/test_slack:5.0"
}
],
"repository": {
"date_created": 1628167510,
"name": "test_slack",
"namespace": "documentation",
"repo_full_name": "documentation/test_slack",
"repo_type": "private"
}
}
}Every event that can trigger a webhook, the event type sent in the notification, and what the notification contains.
The table contains the details about available webhook triggers and what they do.
| Event | Webhook Event Type | Contents of Notification |
|---|---|---|
| Push artifact to registry | PUSH_ARTIFACT | Repository namespace name, repository name, resource URL, tags, manifest digest, artifact name, push time timestamp, username of user who pushed artifact |
| Pull artifact from registry | PULL_ARTIFACT | Repository namespace name, repository name, manifest digest, artifact name, pull time timestamp, username of user who pulled artifact |
| Delete artifact from registry | DELETE_ARTIFACT | Repository namespace name, repository name, manifest digest, artifact name, artifact size, delete time timestamp, username of user who deleted image |
| Upload Helm chart to chartMuseum | UPLOAD_CHART | Repository name, chart name, chart type, chart version, chart size, tag, timestamp of push, username of user who uploaded chart |
| Download Helm chart from chartMuseum | DOWNLOAD_CHART | Repository name, chart name, chart type, chart version, chart size, tag, timestamp of push, username of user who pulled chart |
| Delete Helm chart from chartMuseum | DELETE_CHART | Repository name, chart name, chart type, chart version, chart size, tag, timestamp of delete, username of user who deleted chart |
| Image scan completed | SCANNING_COMPLETED | Repository namespace name, repository name, tag scanned, image name, number of critical issues, number of major issues, number of minor issues, last scan status, scan completion time timestamp, vulnerability information (CVE ID, description, link to CVE, criticality, URL for any fix), username of user who performed scan |
| Image scan failed | SCANNING_FAILED | Repository namespace name, repository name, tag scanned, image name, error that occurred, username of user who performed scan |
| Project quota exceeded | QUOTA_EXCEED | Repository namespace name, repository name, tags, manifest digest, artifact name, push time timestamp, username of user who pushed artifact |
| Project quota near threshold | QUOTA_WARNING | Repository namespace name, repository name, tags, manifest digest, artifact name, push time timestamp, username of user who pushed artifact |
| Artifact replication finished | REPLICATION | Repository namespace name, repository name, tags, manifest digest, artifact name, push time timestamp, username of user who triggered the replication |
You can use any combination of them or all triggers.