feishuEnd.groovy 567 B

12345678910111213141516
  1. #!/usr/bin/env groovy
  2. def call(String secret = '') {
  3. def notifier = new org.feishu.FeishuNotifier()
  4. def status = currentBuild.currentResult // SUCCESS/FAILED/ABORTED
  5. def emoji = status == 'SUCCESS' ? '✅' : '❌'
  6. def msg = """**构建结束**
  7. 项目:${env.JOB_NAME} #${env.BUILD_NUMBER}
  8. 结果:**${status}**
  9. 耗时:${currentBuild.durationString.replace(' and counting', '')}"""
  10. notifier.send(
  11. webhook: env.FEISHU_WEBHOOK,
  12. secret : secret,
  13. title : "$emoji Jenkins 构建$status",
  14. text : msg
  15. )
  16. }