Notifications

更新时间:
复制 MD 格式

Use notification plugins in pipelines to send messages triggered by task running status through third-party system webhooks.

Go to the pipeline edit page and Add plugin to the desired task. The following notification plugins are supported: DingTalk robot, email, webhook, WeCom robot, and Lark robot.image

Dingtalk robot notification

Prerequisites

  • Custom robots require security settings and must be added from a computer.

  • Create a DingTalk group and configure a Webhook robot. For more information, see Robot configuration reference.

  1. Edit the pipeline task and add the DingTalk Robot notification plug-in to the required step.

    1. In DingTalk, go to . Copy the webhook URL of the DingTalk robot and paste it into the plugin configuration.

    2. Custom DingTalk robots must have security settings enabled. If you do not use signing, you can leave the signing key field empty.

    3. Select a running status. The plugin sends a notification when the pipeline task enters the selected status.

    4. Select the notification content. The selected content is automatically added to the push message.

    5. You can enter custom content. This field supports environment variables, such as ${CI_COMMIT_TITLE}, and DingTalk Markdown syntax. For more information, see View help.

    6. You can use @phone number to mention users. Separate multiple phone numbers (numbers associated with DingTalk accounts) with a comma (,). To mention everyone in the group, enter all.

    image

  2. Run the pipeline task. When the step reaches the configured running status, a notification is sent to the corresponding DingTalk group.

Email notification

Prerequisites

An email address that can receive messages is required.

  1. Edit the pipeline task and add the email notification plugin to the required task. In the plugin settings, enter the email address and select a running status.

    image

  2. Run the pipeline task. When the step reaches the configured running status, a notification is sent to the specified email address.

Webhook notification

Prerequisites

The webhook URL must be publicly accessible. Verify access in a browser before configuring.

  1. Edit the pipeline task, add the webhook notification plugin to the required step, enter the webhook URL, and select a running status.

    image

  2. When the step reaches the configured running status, a webhook call is initiated. Flow always sends a POST request. The following example shows the task status payload.

    {
      "event": "task",
      "action": "status",
      "task": {
        "pipelineId": "183",
        "pipelineName": "test pipeline",
        "stageName": "Build",
        "taskName": "java build",
        "buildNumber": "19",
        "statusCode": "SUCCESS", // UNKNOWN, RUNNING, WAITING, CANCELLING, CANCELED,FINISH,SUCCESS,FAIL,SKIP  
        "statusName": "Success",
        "pipelineUrl": "https://***.aliyun.com/ec/pipelines/1565**?build=19",
        "message": "Pipeline [test pipeline] stage [Build] task [java build] succeeded."
      },
      "sources": [
        {
          "repo": "git@gitlab:test.git",
          "branch": "master",
          "commitId": "xdfdfdff",
          "previousCommitId": "ddddd"
        }
      ],
      "globalParams": [
        {"key": "test", "value": "test1"},
        {"key": "test2", "value": "test2"}
      ]
    }

Wecom robot notification

Prerequisites

Create a WeCom group and configure a webhook robot.

image

  1. Edit the pipeline task and add the WeCom robot notification plugin to the required step.

    1. In WeCom, go to . Copy the webhook URL of the WeCom robot and paste it into the plugin configuration.

    2. Select a running status. The plugin sends a notification when the pipeline task enters the selected status.

    3. Select the notification content. The selected content is automatically added to the push message.

    4. Enter custom content. Environment variables such as ${CI_COMMIT_TITLE} and DingTalk Markdown syntax are supported. View help.

    5. You can mention users by their user ID. Separate multiple user IDs (WeCom user_id) with a comma (,). To mention everyone, enter all.

      • To find a user_id, go to WeCom Admin Console > Address Book.

    image

  2. Run the pipeline. When the task reaches the configured running status, a notification is sent to the corresponding WeCom group.

Lark robot notification

Prerequisites

Create a Lark group and configure a webhook robot. For more information, see Robot configuration reference.image

  1. Edit the pipeline task and add the Lark robot notification plugin to the required step.

    1. In Lark, go to . Copy the webhook URL of the Lark robot and paste it into the plugin configuration.

    2. If the Lark robot has "Signing" enabled, enter the signing key.

    3. Select a running status. The plugin sends a notification when the pipeline task enters the selected status.

    4. Select the notification content. The selected content is automatically added to the push message.

    5. Enter custom content. Environment variables such as ${CI_COMMIT_TITLE} are supported.

    6. You can mention users by their user ID. Separate multiple user IDs (Lark user_id) with a comma (,). To mention everyone, enter all.

      • To find a user_id, go to Lark Admin Console > Members and Departments.

    image

  2. Run the pipeline. When the task reaches the configured running status, a notification is sent to the corresponding Lark group.