lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <>
Subject RE: large messages from Jenkins failures
Date Thu, 30 Aug 2012 18:02:24 GMT
The Groovy-scripted email length reduction method appears to be working now (after quite a
few false starts).

I've added the following script, which limits email body text to 200K chars, to all Lucene
and Solr jobs on all three Jenkins instances that regularly send failure emails to this list
(ASF, SDDS, and flonkings):

	maxLength = 200000;
	trailingLength = 10000;
	bodyPart = msg.getContent().getBodyPart(0);
	body = bodyPart.getContent();
	bodyLength = body.length();
	logger.println("[Email-ext] Notification email body length: " + bodyLength);
	if (bodyLength > maxLength) {
	  text = new StringBuilder();
	  text.append(body.substring(0, maxLength - trailingLength));
	  text.append("\n\n[...truncated too long message...]\n\n");
	  text.append(body.substring(bodyLength - trailingLength));
	  bodyPart.setText(text.toString(), "UTF-8");
	  logger.println("[Email-ext] Reduced notification email body length to: " + text.length());

You can see the first successfully length-reduced email to this list, sent from Policeman
Jenkins Server a little less than an hour before this post, with subject "[JENKINS] Lucene-Solr-trunk-Windows
(32bit/jdk1.7.0_06) - Build # 533 - Failure!".

I chose the 200K chars limit somewhat arbitrarily - please let me know if you think it should
be different.


-----Original Message-----
From: Steven A Rowe [] 
Sent: Tuesday, August 28, 2012 3:56 PM
Subject: RE: large messages from Jenkins failures

Actually, after discussing with Uwe on #lucene-dev IRC, I'm looking into another mechanism
to reduce the size of email messages: the Jenkins Email-Ext plugin has a per-build-job configuration
item named "Pre-send script" that allows you to modify the MimeMessage object representing
an email via a Groovy script.  Here's what I've got so far - I'm going to enable this now
on all the jobs on Uwe's Jenkins (the "msg" variable, of type MimeMessage, is made available
by the plugin to the script):

	maxLength = 200000;
	trailingLength = 10000;
	content = msg.getContent(); // assumption: mime type is "text/plain"
	contentLength = content.length();
	if (content.length() > maxLength) {
	  text = content.substring(0, maxLength - trailingLength) 
	       + "\n\n[... truncated too long message ...]\n\n"
	       + content.substring(contentLength - trailingLength);
	  msg.setText(text, "UTF-8");


-----Original Message-----
From: [] On Behalf Of Yonik Seeley
Sent: Tuesday, August 28, 2012 3:11 PM
Subject: Re: large messages from Jenkins failures

On Mon, Aug 20, 2012 at 2:22 PM, Dawid Weiss
<> wrote:
> Oh, one more thing -- if we suppress the console output we would
> absolutely have to keep (at jenkins) multiple tests-report.txt files
> because these always contain full output dumps (regardless of console
> settings). Otherwise we'd suppress potentially important info.

+1 to not forward truckloads of info to the mailing lists, as long as
we can easily get at it via jenkins or some other mechanism.


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message