本文介绍了如何以编程方式设置Jenkins Email-ext插件的收件人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Email-ext (又名可编辑电子邮件通知)的收件人设置为测试失败的所有者。由于所有者在构建失败后无法计算,因此不能使用 Inject Environment Variables 插件。

I'm trying to set the recipients of the Email-ext (aka Editable Email Notficiation) to the owners of failed tests. Since the owners can't be calculated until after a build fails, the Inject Environment Variables plugin can't be used.

如何做?

推荐答案

高级... 部分创建以下预发送脚本

import javax.mail.Message
import javax.mail.internet.InternetAddress

msg.addRecipient(Message.RecipientType.TO, new InternetAddress('recipient@example.com'))

您还需要设置项目收件人列表可能是一些虚拟值),因为如果它是空的,插件决定没有什么可做的。

You'll also need to set Project Recipient List (maybe to some dummy value) since if it's empty, the plugin decides there's nothing to do.

脚本运行在主程序上,所以你需要 ssh 如果您需要处理其工作区,则从主设备进入从设备。

The script runs on the master so you'll need to ssh onto the slave from the master if you need to process its workspace.

这篇关于如何以编程方式设置Jenkins Email-ext插件的收件人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 16:36