|
|
@@ -15,25 +15,56 @@ class FeishuNotifier implements Serializable {
|
|
|
String duration, String branch, String commitMsg, String author,
|
|
|
String commitTime) {
|
|
|
|
|
|
- // 根据状态决定标题颜色
|
|
|
- def title = (status == 'START') ? '🔵 构建开始' :
|
|
|
+ // 1. 决定左侧条颜色 + 标题
|
|
|
+ def color = (status == 'START') ? 'blue' :
|
|
|
+ (status == 'SUCCESS') ? 'green' :
|
|
|
+ (status == 'FAILURE') ? 'red' : 'yellow'
|
|
|
+ def title = (status == 'START') ? '🔵 构建开始' :
|
|
|
(status == 'SUCCESS') ? '✅ 构建成功' :
|
|
|
(status == 'FAILURE') ? '❌ 构建失败' : '🟡 构建不稳定'
|
|
|
|
|
|
+ // 2. 飞书极简卡片:header + elements
|
|
|
def payload = [
|
|
|
- msg_type: 'text',
|
|
|
- content: [
|
|
|
- text: """
|
|
|
- ${title}
|
|
|
- 任务名称: ${jobName}
|
|
|
- 构建编号: #${buildNumber}
|
|
|
- 持续时间: ${duration}
|
|
|
- 分支: ${branch}
|
|
|
- 提交: ${commitMsg}
|
|
|
- 作者: ${author}
|
|
|
- 提交时间: ${commitTime}
|
|
|
- 查看详情: ${buildUrl}
|
|
|
- """.stripIndent()
|
|
|
+ msg_type: 'interactive',
|
|
|
+ card: [
|
|
|
+ header: [
|
|
|
+ title: [
|
|
|
+ tag: 'plain_text',
|
|
|
+ content: title
|
|
|
+ ],
|
|
|
+ template: color // 左侧条颜色
|
|
|
+ ],
|
|
|
+ elements: [
|
|
|
+ [
|
|
|
+ tag: 'div',
|
|
|
+ text: [
|
|
|
+ tag: 'lark_md',
|
|
|
+ content: """
|
|
|
+**任务名称**: ${jobName}
|
|
|
+**构建编号**: [#${buildNumber}](${buildUrl})
|
|
|
+**持续时间**: ${duration}
|
|
|
+**分支**: ${branch}
|
|
|
+**提交信息**: ${commitMsg}
|
|
|
+**作者**: ${author}
|
|
|
+**提交时间**: ${commitTime}
|
|
|
+""".stripIndent()
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ tag: 'action',
|
|
|
+ actions: [
|
|
|
+ [
|
|
|
+ tag: 'button',
|
|
|
+ text: [
|
|
|
+ tag: 'plain_text',
|
|
|
+ content: '查看详情'
|
|
|
+ ],
|
|
|
+ type: 'primary',
|
|
|
+ url: buildUrl
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ]
|
|
|
]
|
|
|
]
|
|
|
|