[英]Jenkins : sending email notification when starting a build
In Jenkins, Is there a way to send a mail when starting a build. 在Jenkins中,有没有办法在开始构建时发送邮件。 I know there is a post-build email notification which sends mail to the given recipients after a successful or failure build. 我知道有一个构建后的电子邮件通知,在成功或失败构建后将邮件发送给给定的收件人。 Similarly i am expecting something like pre build notification. 同样地,我期待像预构建通知之类的东西。
Also is there a conditional email like if username == null send to xyz@domain.com else send it to requestor. 还有一个条件电子邮件,如果用户名== null发送到xyz@domain.com,否则发送给请求者。
Tried : couple of plugins but didn't help much as they were post-build plugins 试过:几个插件,但没有帮助太多,因为他们是后期构建插件
Notice that a post build action will solve your problem even though what you intend is to send an e-mail before the build. 请注意,即使您打算在构建之前发送电子邮件,构建后操作也将解决您的问题。
After that, go to the job configuration and " Add Post Build Action " > " Editable Email Notification " 之后,转到作业配置和“ 添加后期构建操作 ”>“ 可编辑的电子邮件通知 ”
Now, at Triggers , just add a new trigger and choose " Before Build " 现在,在Triggers中 ,只需添加一个新触发器并选择“ Before Build ”
For the second part, the solution is to put the recipient list in an environment variable (for example, a string parameter called EMAIL_RECIPIENT ) and then use that in the editable email notification recipients list box as ${EMAIL_RECIPIENT} . 对于第二部分,解决方案是将收件人列表放在环境变量中(例如,名为EMAIL_RECIPIENT的字符串参数),然后在可编辑的电子邮件通知收件人列表框中将其用作$ {EMAIL_RECIPIENT} 。
如果您配置了sendmail,只需使用“执行shell”部分并编写代码以在构建开始之前发送邮件。
You can try the Extend Email-ext, it has the Before build in the Triggers section. 您可以尝试使用Extend Email-ext,它在Triggers部分中有Before build 。
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.