luhaowen 1 주 전
부모
커밋
323ed57923
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 3
      vars/feishuNotify.groovy

+ 8 - 3
vars/feishuNotify.groovy

@@ -2,21 +2,26 @@
 import com.example.FeishuNotifier
 
 def call(String webhookUrl, String status) {
+    // 1. 采集常规信息
     def duration = currentBuild.durationString.replace(' and counting', '')
     def commitMsg  = sh(returnStdout: true, script: "git log -1 --pretty=%B").trim()
     def author     = sh(returnStdout: true, script: "git log -1 --pretty=%an").trim()
-    def commitTime = sh(returnStdout: true, script: "git log -1 --pretty=%ci").trim()   // 新增
+    def commitTime = sh(returnStdout: true, script: "git log -1 --pretty=%ci").trim()
     def branch     = env.brach ?: env.GIT_BRANCH ?: env.BRANCH_NAME ?: 'unknown'
 
+    // 2. 把原始 BUILD_URL 改成走 Nginx 代理的 https 域名
+    def buildUrl = env.BUILD_URL.replace('http://68.79.46.88:8080', 'https://jenkins.adwebcloud.com')
+
+    // 3. 发送飞书消息
     new FeishuNotifier(this, webhookUrl).send(
         status,
         env.JOB_NAME,
         env.BUILD_NUMBER,
-        env.BUILD_URL,
+        buildUrl,   
         duration,
         branch,
         commitMsg,
         author,
-        commitTime          
+        commitTime
     )
 }