edit-icon download-icon

Webhook

Last Updated: Jan 26, 2018

Overview

Alibaba Cloud Container Registry provides a Webhook for each repository, allowing you to push a notification when an image is built and therefore set up a continuous integration pipeline. Suppose you have set a Container Service trigger for Webhook. When an image is built, the applications in Container Service are automatically triggered to pull the latest image and re-deployed.

Currently, Alibaba Cloud Container Registry provides two types of Webhook triggers: expression-based and tag-based. Expression-based trigger filters tags based on a regular expression, and only the tags matching the regular expression can trigger the Webhook. Tag-based trigger is based on a user-filtered tag list. If no triggers are set for a Webhook, the trigger is both expression-based and tag-based by default.

Example

1. Expression-based trigger

Enter a simple regular expression such as release-v.*. Then, only when an image whose version tag begins with release-v is built can the subsequent continuously integrated process be triggered. Otherwise, no trigger occurs, and the access history shows Not Triggered in the Access Status Code column.

Click Access History to view the access history of a Webhook.

2. Tag-based trigger

You can select a maximum of ten tags to be triggered from the list. Only tags in the list can trigger a Webhook when an image is built. Otherwise, no trigger occurs, and the access history shows Not Triggered in the Access Status Code column.

Click Access History to view the access history of a Webhook.

Notification contents

A Webhook notification contains the image repository information and image version information as follows. Image repository information includes the namespace, name, and region of the repository.

  1. POST /payload HTTP/1.1
  2. Content-Type: application/json
  3. Request URL: https://cs.console.aliyun.com/hook/trigger?triggerUrl=YzRmMWE5YzM2ZjMzYzQ0NmFiMGYzNWJlMmM2MjM2NzIyfGV4cHJlc3N8cmVkZXBsb3l8MThlMmllY2drdXYyZXw=&secret=365a4a664b45615438716a487a75695a7ac48329224b35b073c2197374e7d62a
  4. Request method: POST
  5. {
  6. "push_data": {
  7. "digest": "sha256:457f4aa83fc9a6663ab9d1b0a6e2dce25a12a943ed5bf2c1747c58d48bbb4917",
  8. "pushed_at": "2016-11-29 12:25:46",
  9. "tag": "latest"
  10. },
  11. "repository": {
  12. "date_created": "2016-10-28 21:31:42",
  13. "name": "repoTest",
  14. "namespace": "namespace",
  15. "region": "cn-hangzhou",
  16. "repo_authentication_type": "NO_CERTIFIED",
  17. "repo_full_name": "namespace/repoTest",
  18. "repo_origin_type": "NO_CERTIFIED",
  19. "repo_type": "PUBLIC"
  20. }
  21. }
Thank you! We've received your feedback.