2015-04-21 40 views
1

我们使用Jenkins作为我们的ci服务器,我们在Firefox上运行集成测试xvfb。有时,我们会收到有关由xvfb启动失败导致的测试失败的电子邮件。Jenkins email-ext插件,预发送脚本:

所以我们想忽略这种情况下发送邮件。正如我们所知,email-ext插件可以帮助我们。我们应该写pre-send scripts,但我们不知道如何编写它们。

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

+0

请参阅http://stackoverflow.com/questions/11967191/jenkins-email-ext-pre-send-script –

+0

@DaidPostill,谢谢,我得到了解决方案。 – LuoWei

回答

2

groovy script电子邮件-EXT插件预发送脚本是:

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

这解决了我的问题。