简体   繁体   English

Jenkins:在开始构建时发送电子邮件通知

[英]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 试过:几个插件,但没有帮助太多,因为他们是后期构建插件

  1. Install the Email-ext plugin: https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin 安装Email-ext插件: https//wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

Notice that a post build action will solve your problem even though what you intend is to send an e-mail before the build. 请注意,即使您打算在构建之前发送电子邮件,构建后操作也将解决您的问题。

  1. After that, go to the job configuration and " Add Post Build Action " > " Editable Email Notification " 之后,转到作业配置和“ 添加后期构建操作 ”>“ 可编辑的电子邮件通知

  2. Press Avanced Settings : Avanced设置 按高级设置...

  3. 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.

相关问题 发送针对特定版本的Jenkins版本的电子邮件通知 - Sending out email notification for Jenkins build for a particular builds 由于收件人列表为空,Jenkins Pipelines 定期构建不发送电子邮件通知 - Jenkins Pipelines periodic build not sending email notification due to empty list of recipients Jenkins 2.273.1 “可编辑的 Email 通知”发送带有“$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!”的电子邮件内容 - Jenkins 2.273.1 “Editable Email Notification” sending emails with “$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!” content 使用 jenkins 发送电子邮件时出错 - Error when sending email with jenkins Jenkins基于构建步骤的电子邮件通知 - Jenkins Email notification based on build step Jenkins电子邮件通知中未扩展$ BUILD_USER - $BUILD_USER not expanded in Jenkins email notification 如果构建失败,如何在 jenkins 中添加电子邮件通知 - How to add email notification in jenkins if the build is failed 让Jenkins按需通过电子邮件发送构建通知 - Asking Jenkins to email a build notification on demand 如何在电子邮件通知中获取Jenkins构建结果 - How to get Jenkins build result in email notification Jenkins:将构建趋势图作为电子邮件发送 - Jenkins : Sending Build Trend Graph as email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM