0
votes

I am trying to write/modify a jelly script in Jenkins Email-Ext that returns the build log. I am trying to filter the log with BUILD_LOG_REGEX for regular expressions. Can someone give me a sample script or format for doing build_log_regex using jelly script template? Thanks in advance.

2

2 Answers

0
votes

The default template that you can use as your starting point is located in

$JENKINS_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/html.jelly
0
votes

The ${BUILD_LOG_REGEX} token is used in the Default Content section of email-ext and typically not inside of the Jelly script. To use it, just change your Default Content to reference this token:

enter image description here

The developer of email-ext recommended switching from Jelly to Groovy since they have "more power, its easier to use and you can prototype stuff in the script console to some degree".

See https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-Scriptcontent

You can then look at the source code for BuildLogRegexContent class on how this token is implemented and write code to produce exactly what you want.