@@ -13,28 +13,25 @@ class FeishuNotifier implements Serializable {
void send(String status, String jobName, String buildNumber, String buildUrl, String duration) {
def payload = [
- msg_type: 'post',
+ msg_type: 'text',
content: [
- post: [
- title: "Jenkins 构建通知",
- content: [ // ← 一维数组
- [
- tag : "text",
- text: """状态:${status}
-任务:${jobName}
-编号:#${buildNumber}
-耗时:${duration}
-链接:${buildUrl}""".stripIndent()
- ]
+ text: """
+ 构建状态: ${status}
+ 任务名称: ${jobName}
+ 构建编号: #${buildNumber}
+ 持续时间: ${duration}
+ 查看详情: ${buildUrl}
+ """.stripIndent()
]
+ def jsonBody = JsonOutput.toJson(payload)
+ println ">>> Feishu JSON: ${jsonBody}"
+
script.httpRequest(
url : webhookUrl,
httpMode : 'POST',
- requestBody: JsonOutput.toJson(payload),
+ requestBody: jsonBody,
contentType: 'APPLICATION_JSON',
consoleLogResponseBody: true
)