Jenkins email-ext插件,预发送脚本:

时间:2015-04-21 06:07:19

标签: jenkins email-ext

我们使用Jenkins作为我们的ci服务器,我们在xvfb上的firefox上运行集成测试。有时,我们会收到有关xvfb启动失败导致的测试失败的电子邮件。

因此,我们希望忽略通过此案例发送电子邮件。我们知道,email-ext插件可以帮助我们。我们应该写pre-send scripts,但我们不知道如何写它们。

当故障输出消息包含指定的错误消息时,如何编写脚本以取消发送电子邮件?

1 个答案:

答案 0 :(得分:2)

我的groovy script在email-ext插件预发送脚本中是:

try {
    def logFilePath = build.getLogFile().getPath();
    String logContent = new File(logFilePath).text;
    if (logContent.find(/Xvfb failed to start/)) cancel=true;
} catch (all) {
}

解决了我的问题。