首页 云效2020 流水线 通知 使用 Webhook 插件发送通知

使用 Webhook 插件发送通知

用户可以在流水线中配置 Webhook 通知插件,为指定地址推送流水线阶段任务运行信息。

在流水线中配置 Webhook 通知插件

编辑流水线的任务,在任务插件中选择 Webhook 通知,并填写 Webhook 地址和选择运行时机。如下图所示。注意 Webhook 地址必须公网可访问。

图1.配置 Webhook 通知插件

Flow发送的 Webhook 请求一律为 Post 请求,任务状态信息的 Payload 示例如下。

{
  "event": 'task',
  "action": 'status',
  "task": {
    "pipelineId": 183,
    "pipelineName": 'test pipeline',
    "stageName": '构建',
    "taskName": 'java构建',
    "buildNumber": 19,
    "statusCode": 'SUCCESS', \\ UNKOWN, RUNNING, WAITING, CANCELLING, CANCELED,FINISH,SUCCESS,FAIL,SKIP  
    "statusName": '运行成功',
    "pipelineUrl": 'https://rdc.aliyun.com/ec/pipelines/156539?build=19',
    "message": '[test pipeline]流水线阶段[构建]任务[java构建]运行成功'
  },
  "sources": [
    {
      "repo": 'git@gitlab:test.git',
      "branch": 'master',
      "commitId": 'xdfdfdff',
      "privousCommitId": 'ddddd',
    }
  ],
  "globalParams": [
    {"key": 'test', "value": 'test1'},
    {"key": 'test2', "value": 'test2'}
  ]
}
阿里云首页 云效 相关技术圈