问题描述
我正在编写一个简单的Jenkins声明性脚本,以运行"make"并发送包含结果(成功/失败)的电子邮件.
I am writing a simple Jenkins declarative script to run 'make' and send an email with the result (success/failure).
我可以使用以下方式发送简单的电子邮件:
I can send a simple email using:
post {
success {
mail to:"[email protected]", subject:"${currentBuild.fullDisplayName} - Failed!", body: "Success!"
}
failure {
mail to:"[email protected]", subject:"${currentBuild.fullDisplayName} - Failed!", body: "Failure!"
}
}
生成的电子邮件非常简单.
The resulting email is rather simplistic.
如何从脚本中调用email-ext插件来发送旧式的构建后电子邮件? (我猜这应该使用email-ext的groovy-text.template).
How can I call the email-ext plugin from the script to send an old-style post-build email? (I guess this should use email-ext's groovy-text.template).
我希望能够访问诸如CulpritsRecipientProvider之类的列表,并包含控制台日志的末尾.
I would like to be able to access lists like CulpritsRecipientProvider and to include the tail of the console log.
推荐答案
您可以通过以下方式使用它:
You can use it in this way:
emailext (
subject: "STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
有关更多信息,您可以检查:
For more information you can check:
- Sending Notifications in Pipeline
- Email Extension Plugin
这篇关于如何从Jenkins声明性脚本调用email-ext插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!