Reputation: 71
We use Jenkins
as our ci server, and we run integration test on firefox on xvfb
. Sometime, we receive the email about test failure, caused by xvfb
starting failed.
So we want to ignore sending email by this case. As we know, the email-ext
plugin can help us. we should write pre-send scripts
, but we don't know how to write them.
How do I write a script to cancel sending email when failure output message contains a specified error message?
Upvotes: 2
Views: 5415
Reputation: 71
My groovy script
in email-ext plugin pre-send-script is:
try {
def logFilePath = build.getLogFile().getPath();
String logContent = new File(logFilePath).text;
if (logContent.find(/Xvfb failed to start/)) cancel=true;
} catch (all) {
}
That resolve my problem.
Upvotes: 2