| 12345678910111213141516171819202122 |
- #!/usr/bin/env groovy
- import com.example.FeishuNotifier
- def call(String webhookUrl, String status) {
- 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 branch = env.brach ?: env.GIT_BRANCH ?: env.BRANCH_NAME ?: 'unknown'
- new FeishuNotifier(this, webhookUrl).send(
- status,
- env.JOB_NAME,
- env.BUILD_NUMBER,
- env.BUILD_URL,
- duration,
- branch,
- commitMsg,
- author,
- commitTime
- )
- }
|