4

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!

user1340582
  • 19,151
  • 35
  • 115
  • 171

2 Answers2

7

${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.

Dipu H
  • 2,372
  • 15
  • 24
  • Hmm interesting. I could not really find other than a template. I'm sure there are Groovy/Jelly examples somewhere stored that people have created, I would assume? An html email that contains test and coverage summaries, graphs, changes, etc. ? – user1340582 Feb 16 '14 at 20:44
  • @Dipu thanks. Spent 2 hours looking for that html.jelly. – NotAgain Sep 05 '14 at 05:27
  • how to open and pack again this jar file?? – Yogesh Jilhawar Oct 01 '18 at 12:22
2

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()
user3360767
  • 868
  • 7
  • 18