简体   繁体   English

通过电子邮件通知失败/通过Jenkins工作

[英]Fail/pass Jenkins job by email notification

We have an in-company system for creating production builds, and I need to create a Jenkins job to automate those builds. 我们有一个用于创建生产构建的公司内部系统,我需要创建一个Jenkins作业以使这些构建自动化。

There is a way to automate the launch of production build. 有一种方法可以自动启动生产版本。 But you can only know the results of the build by an email notification. 但是您只能通过电子邮件通知了解构建结果 Furthermore, you can only subscribe to notification using your personal domain credentials, ie the same login/pass that you use to log into your computer (and the password changes every month). 此外,您只能使用您的个人域凭据来订阅通知,即您用于登录计算机的登录名/密码(密码每个月都会更改)。

So now, Jenkins job is considered "pass" as soon as the build launches , and not when it actually finishes. 因此,现在,Jenkins的工作在构建启动时即被视为“通过”,而不是在构建完成时才被视为“通过”。

I wonder how to make Jenkins pass/fail the job with the given restrictions. 我不知道如何在给定的限制下让詹金斯通过/失败。

Additionally, I want to avoid: 另外,我想避免:

  • hardcoding my personal credentials anywhere, 在任何地方对我的个人凭证进行硬编码,
  • depending on my or anyone else's personal computer being turned on. 取决于我或其他人的个人计算机是否已打开。

Ideas? 想法?

I'm not aware of any Jenkins plugin that is capable of receiving e-mails. 我不知道任何能够接收电子邮件的Jenkins插件。

If you can manage to store the notifications' content in a file you could use the Text-finder Plugin in the Post-build Actions of an additional monitor job that runs on a regular basis. 如果您可以将通知的内容存储在文件中,则可以在定期运行的其他监视器作业的“构建后操作”中使用“ 文本查找器”插件

Have a look at Monitoring external jobs , too, whether this is useful for you. 看看“ 监视外部作业”是否对您有用。

UPDATE: 更新:

There is actually a plugin that receives e-mails: the poll-mailbox-trigger-plugin . 实际上,有一个可以接收电子邮件的插件: poll-mailbox-trigger-plugin Install it and do the following: 安装它并执行以下操作:

  • Create a new Freestyle project named eg Build Status Mail Monitor 创建一个新的Freestyle项目,例如Build Status Mail Monitor

    • Build Triggers → [✔] [Poll Mailbox Trigger] - Poll an email inbox 构建触发器 →[✔] [轮询邮箱触发器]-轮询电子邮件收件箱

      • configure as desired 根据需要配置
    • BuildAdd build stepExecute Groovy script 构建添加构建步骤执行Groovy脚本

      • ◉ Groovy command: add code to change build launcher job's status ◉Groovy命令: 添加代码以更改构建启动器作业的状态

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM