|
@@ -14,37 +14,35 @@ class FeishuNotifier implements Serializable {
|
|
|
|
|
|
|
|
void send(String status, String jobName, String buildNumber, String buildUrl, String duration) {
|
|
void send(String status, String jobName, String buildNumber, String buildUrl, String duration) {
|
|
|
def colorMap = [
|
|
def colorMap = [
|
|
|
- 'SUCCESS': 'green',
|
|
|
|
|
- 'FAILURE': 'red',
|
|
|
|
|
|
|
+ 'SUCCESS' : 'green',
|
|
|
|
|
+ 'FAILURE' : 'red',
|
|
|
'UNSTABLE': 'yellow',
|
|
'UNSTABLE': 'yellow',
|
|
|
- 'ABORTED': 'gray'
|
|
|
|
|
|
|
+ 'ABORTED' : 'gray'
|
|
|
]
|
|
]
|
|
|
- def title = "Jenkins构建通知"
|
|
|
|
|
- def text = """
|
|
|
|
|
- 🚀 **构建状态**: ${status}\n
|
|
|
|
|
- 📦 **任务名称**: ${jobName}\n
|
|
|
|
|
- 🔢 **构建编号**: #${buildNumber}\n
|
|
|
|
|
- ⏱️ **持续时间**: ${duration}\n
|
|
|
|
|
- 🔗 [点击查看详情](${buildUrl})
|
|
|
|
|
- """.stripIndent()
|
|
|
|
|
-
|
|
|
|
|
def payload = [
|
|
def payload = [
|
|
|
- msg_type: "text",
|
|
|
|
|
|
|
+ msg_type: 'post',
|
|
|
content: [
|
|
content: [
|
|
|
- text: """
|
|
|
|
|
- 构建状态: ${status}
|
|
|
|
|
- 任务名称: ${jobName}
|
|
|
|
|
- 构建编号: #${buildNumber}
|
|
|
|
|
- 持续时间: ${duration}
|
|
|
|
|
- 查看详情: ${buildUrl}
|
|
|
|
|
- """.stripIndent()
|
|
|
|
|
-
|
|
|
|
|
|
|
+ post: [
|
|
|
|
|
+ zh_cn: [
|
|
|
|
|
+ title: "Jenkins 构建通知",
|
|
|
|
|
+ content: [[
|
|
|
|
|
+ tag : 'text',
|
|
|
|
|
+ text: """
|
|
|
|
|
+ 构建状态 : ${status}
|
|
|
|
|
+ 任务名称 : ${jobName}
|
|
|
|
|
+ 构建编号 : #${buildNumber}
|
|
|
|
|
+ 持续时间 : ${duration}
|
|
|
|
|
+ 查看详情 : ${buildUrl}
|
|
|
|
|
+ """.stripIndent()
|
|
|
|
|
+ ]]
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]
|
|
|
]
|
|
]
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
script.httpRequest(
|
|
script.httpRequest(
|
|
|
- url: webhookUrl,
|
|
|
|
|
- httpMode: 'POST',
|
|
|
|
|
|
|
+ url : webhookUrl,
|
|
|
|
|
+ httpMode : 'POST',
|
|
|
requestBody: JsonOutput.toJson(payload),
|
|
requestBody: JsonOutput.toJson(payload),
|
|
|
contentType: 'APPLICATION_JSON',
|
|
contentType: 'APPLICATION_JSON',
|
|
|
consoleLogResponseBody: true
|
|
consoleLogResponseBody: true
|