Updated on 2024-07-05 GMT+08:00

Webhooks

Introduction to Webhook

Developers can configure URLs of third-party systems on the Webhook page and subscribe to events such as branch push and tag push of CodeArts Repo based on project requirements. When a subscription event occurs, you can use a webhook to send a POST request to the URL of a third-party system to trigger operations related to your system (third-party system), such as popping up a notification window, building or updating images, or performing deployment.

If you want to email repository change notifications, you can configure Notifications in General Settings.

Configuring Webhooks

To configure webhooks, you can choose Settings > Service Integration > Webhooks on the repository details page.

The settings take effect only for the repository configured.

All repository members can view this page. For details about whether a repository member has repository setting permissions, refer to the Permissions page.

Table 1 Parameters for creating a webhook

Parameter

Description

Name

Custom name.

Description

Description of the webhook.

URL

(Mandatory) Provided by the third-party CI/CD system.

Token type

Used for webhook interface authentication of third-party services. The options are as follows:

  • X-Repo-Token
  • X-Gitlab-Token
  • X-Auth-Token

Token

Used for third-party CI/CD system authentication. The authentication information is stored in the HTTP request header.

Event type

The system can subscribe to the following events:

  • Push events
    • If Push events is selected, Regular Expression for Branch Filtering is displayed.
      NOTE:

      Regular Expression for Branch Filtering: The default value is .*, indicating that all branches are matched. Max. 500 characters.

      The regular expression for branch filtering must comply with regular expressions.

    • This event is triggered when code is updated in CodeArts Repo, such as code update in LFS files or submodules, and code pushed online or on a local Git client.
  • Tag push events

    This event is triggered when a tag is created or deleted.

  • Merge request events
    • This event is triggered when a merge request is created.
    • This event is triggered when a merge request is updated. For example, when someone updates the code content, merge request status (closed or re-opened), merge request title or description, merger, and work items, deletes the source branch, and updates the squash.
    • This event is triggered when a request is merged.
  • Comments
    • This event is triggered when a review is added. For example, add a review for a file on the Files and Commits submenus of the Code tab page, or on the Files Changed submenu of the Merge Requests tab page.
    • This event is triggered when a comment is added on the Commits details page or on the Details page of Merge Requests tab page.
  • A maximum of 20 webhooks can be created for a repository.
  • You can configure a token when setting up a webhook. The token will be associated with the webhook URL and sent to you in the X-Repo-Token header.