Thursday, April 19, 2012

Using BUILD_LOG_REGEX in jenkins email notification

Jenkins provide 'Email-ext' plugin, which allows to configure every aspect of email notifications.
One of my requirement is to send in mail the build package URL, which is already getting displayed in console output.

I found a token 
${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines, substText, escapeHtml, matchedLineHtmlStyle} - Displays lines from the build log that match the regular expression. 

Here is example usage of it
${BUILD_LOG_REGEX, regex="^Build package URL:", showTruncatedLines=false}

This will extract the line starting with "Build package URL:" from the build log and send it through mail.

5 comments:

Uma said...

Do you know how to use this email token "BUILD_LOG_REGEX" in Jelly Script?

Uma said...

I mean how to display this extracted logs (from the Jenkins console logs) using Jelly Template... in the email

Fionn said...

I tried this inside the email subject, without success. IS it not possible?

Thanks,

Fionn

Anonymous said...

Hi Siddesh

How do you read outputs from child jobs. My Jenkins job is a wrapper MAIN job which has a bunch of child jobs. So if any of child jobs fail, i can only read the wrapper console output which says failure of the child job. In order to actually find out the true cause, i would have to click on the failed child job to see the actual results

Unknown said...

Big big thanks! Saved me tones of time! :)