Jenkins发布构建通知至飞书群
#!/usr/bin/env python# -*- coding: utf-8 -*-import sysimport requestsimport osJob_name = os.getenv("JOB_NAME")Job_num = os.getenv("BUILD_NUMBER")JOB_URL = 'http://xxxxxxxx' + '/job' + '/{}'.format(Job
·
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import requests
import os
Job_name = os.getenv("JOB_NAME")
Job_num = os.getenv("BUILD_NUMBER")
JOB_URL = 'http://xxxxxxxx' + '/job' + '/{}'.format(Job_name) + '/{}'.format(Job_num) + '/consoleText'
url = 'https://open.feishu.cn/open-apis/bot/v2/hook/xxxxx'
method = 'post'
headers = {
'Content-Type': 'application/json'
}
json = {
"msg_type": "interactive",
"card": {
"config": {
"wide_screen_mode": True,
"enable_forward": True
},
"elements": [{
"tag": "div",
"text": {
"content": "任务名称:" + "{}".format(Job_name) + "\n任务编号:" + "{}".format(Job_num),
"tag": "lark_md"
}
}, {
"actions": [{
"tag": "button",
"text": {
"content": "查看发布报告",
"tag": "lark_md"
},
"url": JOB_URL,
"type": "default",
"value": {}
}],
"tag": "action"
}],
"header": {
"title": {
"content": "程序已发布",
"tag": "plain_text"
}
}
}
}
requests.request(method=method, url=url, headers=headers, json=json)
更多推荐
已为社区贡献1条内容
所有评论(0)