|
|
@@ -1,15 +1,20 @@
|
|
|
#!/usr/bin/env groovy
|
|
|
-
|
|
|
import com.example.FeishuNotifier
|
|
|
|
|
|
def call(String webhookUrl, String status) {
|
|
|
def duration = currentBuild.durationString.replace(' and counting', '')
|
|
|
- def notifier = new FeishuNotifier(this, webhookUrl)
|
|
|
- notifier.send(
|
|
|
- status,
|
|
|
- env.JOB_NAME,
|
|
|
- env.BUILD_NUMBER,
|
|
|
- env.BUILD_URL,
|
|
|
- duration
|
|
|
+ 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 branch = env.GIT_BRANCH ?: env.BRANCH_NAME ?: 'unknown'
|
|
|
+
|
|
|
+ new FeishuNotifier(this, webhookUrl).send(
|
|
|
+ status, // 1
|
|
|
+ env.JOB_NAME, // 2
|
|
|
+ env.BUILD_NUMBER, // 3
|
|
|
+ env.BUILD_URL, // 4
|
|
|
+ duration, // 5
|
|
|
+ branch, // 6
|
|
|
+ commitMsg, // 7
|
|
|
+ author // 8
|
|
|
)
|
|
|
}
|