1、可以简单的在jenkins中安装企业微信插件,直接配置,就可以直接通知

2、为了实际的需求可能要通知部分人或者通知内容要更改,这个时候我们可以自己手写一个python脚本文件,根据需求放在build前后执行就OK了。

#!/usr/bin/env python
import requests
import json

url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=2aef68c3-9948-439e-ba10-xxxxxxx'

headers = {'content-type': "application/json", 'Authorization': 'APP appid = **,token = **'}

body = {
    "msgtype": "news",
    "news": {
       "articles" : [
           {
               "title" : "Test",
               "description" : "Successful",
               "url" : "www.baidu.com",
               "picurl" : "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"
           }
        ]
    }
}
response = requests.post(url, data = json.dumps(body), headers = headers)
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐