[ 
https://issues.apache.org/jira/browse/LUCENE-4092?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286994#comment-13286994
 ] 

Steven Rowe commented on LUCENE-4092:
-------------------------------------

Two problems:

# Spreading the BUILD_LOG_REGEX regex value over multiple lines is not 
supported by Jenkins's email templating functionality, which is provided by the 
Jenkins Email Extension Plugin (email-ext) 
[https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin].  See [the 
configuration token parsing regexes in 
ContentBuilder.Tokenizer|https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java#L134],
 in particular the comment over the {{stringRegex}} field:{code:java}// 
Sequence of (1) not \ " CR LF and (2) \ followed by non line terminator
private static final String stringRegex = 
"\"([^\\\\\"\\r\\n]|(\\\\.))*\"";{code}
This could be fixed by allowing line terminators to be escaped:{code:java}// 
Sequence of (1) not \ " CR LF and (2) \ followed by any non-CR/LF character or 
(CR)LF
private static final String stringRegex = 
"\"([^\\\\\"\\r\\n]|(\\\\(?:.|\r?\n)))*\"";{code}
I submitted a Jenkins JIRA issue for this: 
[https://issues.jenkins-ci.org/browse/JENKINS-13976].
# [BuildLogRegexContent, the content parser for BUILD_LOG_REGEX, matches 
line-by-line|https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/java/hudson/plugins/emailext/plugins/content/BuildLogRegexContent.java#L213],
 so regexes targeting multiple lines will fail.  I can see two possible routes 
to address this:
## The BUILD_LOG_EXCERPT token allows specification of begin/end line regexes, 
and includes everything inbetween matches.  I'm doubtful this will enable 
capture of the stuff we want, though.
## I'll try to add an argument to BUILD_LOG_REGEX to enable multi-line content 
matching, and make a pull request/JIRA issue to get it included in the next 
release of the plugin.

In the mean time, I'll switch the configuration in our Jenkins jobs to the 
following:

{noformat}
Build: ${BUILD_URL}

${FAILED_TESTS}

Build Log:
${BUILD_LOG_REGEX,regex="[ 
\\t]*(?:\\[javac\\]\\s+[1-9]\\d*\\s+error|\\[junit4\\].*<<<\\s+FAILURES!|\\[javadoc\\]\\s+[1-9]\\d*\\s+warning).*",linesBefore=100}
${BUILD_LOG_REGEX,regex="[ 
\\t]*\\[echo\\].*)*\\s*[1-9]\\d*\\s+Unknown\\s+Licenses.*",linesBefore=17,linesAfter=20}
${BUILD_LOG_REGEX,regex="[ \\t]*javadocs-lint:.*",linesBefore=0,linesAfter=75}
${BUILD_LOG_REGEX,regex=".*FATAL:.*",linesBefore=0,linesAfter=100}
{noformat}
                
> Check what's Jenkins pattern for e-mailing log fragments (so that it includes 
> failures).
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-4092
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4092
>             Project: Lucene - Java
>          Issue Type: Sub-task
>          Components: general/test
>            Reporter: Dawid Weiss
>            Priority: Trivial
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to