Jenkins configuration DingTalk notification

1. DingTalk group robot settings

2. Click Add Robot and select Custom Robot.

insert image description here

3. Fill in the robot name and custom keywords or add a signature to complete.

insert image description here
insert image description here

4. Copy the webhook and save it for subsequent jenkins configuration.

insert image description here

2. DingTalk webhook configuration

  1. Install the DingTalk plugin in Jenkins, go to System Management - Plugin Management - Optional Plugins in turn, and search for DingTalk.
    insert image description here
  2. Go to System Configuration - Uncategorized in turn, click Advanced, and configure the DingTalk robot information. After the configuration is complete, click the Test button to see if the sending is successful.
    insert image description here
    insert image description here
    insert image description here
id:可以不设置,增加时自动设置;
名称:机器人别名;
webook:钉钉中添加自定义机器人时的webhook;
关键字:钉钉机器人中填写的自定义关键字;
加密:钉钉机器人中勾选加签后的内容(也可不设置)
  1. After the test is sent successfully, you can receive a notification in the DingTalk group, as shown in the figure below:
    insert image description here

3. DingTalk notification for project configuration and construction

  1. On the Jenkins home page, create a new task, in the general section, check the robot, and click Advanced.
    insert image description here

  2. Configure notification timing and notification person.
    insert image description here

勾选atAll:通知群内所有人

指定人:输入框中输入要通知人的手机号(多个手机号之间用逗号或换行分隔)
  1. After the configuration is complete, click Apply-Save, click Build Immediately for the task, and you will be notified in the DingTalk group after the build.
    insert image description here

4. Jenkins customizes DingTalk message notification

Tick 禁用内置消息​​""" and fill in the content that DingTalk needs to notify in the custom message自定义消息,支持 markdown 格式
insert image description here

Jenkins 内置的环境变量
变量	描述
EXECUTOR_NAME	构建人姓名
EXECUTOR_MOBILE	构建人手机号
PROJECT_NAME	项目名称
PROJECT_URL	项目地址
JOB_NAME	任务名称
JOB_URL	任务地址
JOB_DURATION	任务持续时间
JOB_STATUS	任务状态
### --- ${PROJECT_NAME} ---

**构建分支:**
### --- Jenkins ---

**执行人:** ${EXECUTOR_NAME}

**构建任务:** ${JOB_NAME}

**构建任务名称:** ${PROJECT_NAME}

**构建任务地址:** ${JOB_URL}

**构建状态:** ${JOB_STATUS}

**构建时间:** ${JOB_DURATION}

**构建人手机号:** ${EXECUTOR_MOBILE}

insert image description here

Guess you like

Origin blog.csdn.net/weixin_45720992/article/details/131381724