4
votes

I am using the Email-ext plugin on Jenkins, and the default Jelly script ${JELLY_SCRIPT,template="html"}.

The template apparently outputs all unit tests in the email, not just the ones that have failed and made the build unstable. This is in itself a strange design decision since the important content gets lost, but is there an easy way to just output the failed tests in the email? I suppose I need to edit the default Jelly script template somewhere? Thanks!

2

2 Answers

5
votes

${JELLY_SCRIPT,template="html"} in this script html refers to the file html.jelly. In Hudson this file is located in the path, HUDSON_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates. You can create your own jelly file, say abc.jelly and use the script as ${JELLY_SCRIPT,template="abc"}

However, in Jenkin this jelly templates have been bundled to the jar email-ext.jar which is located in Jenkin_Home/plugins/email-ext/WEB-INF/lib. Open this Jar and update/create templates in the location /plugins/emailext/templates/ as per your requirement.

2
votes

There is an excellent example for how it is done using Jelly script in: https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/resources/hudson/plugins/emailext/templates/html-with-health-and-console.jelly -> Search for "JUnit TEMPLATE".

But more specifically it is done using

packageResult.getFailedTests()