在声明式管道中提取Git提交者的信息(电子邮件地址)

时间:2019-06-06 03:26:38

标签: jenkins-pipeline

我创建了一个声明性管道,当开发人员在GitHub Enterprise中提交代码时会触发该管道。我想将成功和失败的电子邮件通知发布到提交者

我在下面提到了这个解决方案,但是以某种方式它对我没有用。 How do you pull git committer information for Jenkins pipeline

卷曲$ {env.BUILD_URL} api / json | python -mjson.tool | grep -i'authorEmail'

发布{        成功{           emailext(                 到:“ email.xxx.com”,                 主题:“成功:工作'$ {env.JOB_NAME} [$ {env.BUILD_NUMBER}]'”,                 正文:“”“

成功:作业'$ {env.JOB_NAME} [$ {env.BUILD_NUMBER}]':

                

在“ $ {env.JOB_NAME} [$ {env.BUILD_NUMBER}]”

“”“中检查控制台输出,                 receiverProviders:[[$ class:'DevelopersRecipientProvider']]           )     }

failure {
  emailext  (
      attachLog: true,
      to: "email.xxx.com",
      subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
      body: """<p>FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
        <p>Check console output at &QUOT;<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>&QUOT;</p>""",
      recipientProviders: [[$class: 'DevelopersRecipientProvider']]
  )
}
}

0 个答案:

没有答案