Ive seen this sort of asked in various places but haven't found a true answer.
Does anyone know how to make the build log thats displayed in the body using the html.jelly template NOT all run together and to actually separate each line with a line break?
Im pretty sure the answer lies with some sort of change that needs to happen with the template but I have no idea where to begin.
Right now I get this in my email:
[copy] Copying 1 file to /opt/hybris/hybris/bin/ext-channel/cscockpit/resources/localization [mkdir] Created dir: /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc [echo] [jspcompile] generating.. [echo] [jspcompile] touching jsp files [echo] [jspcompile] compiling.. /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc [yjavac] Compiling 209 source files to /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc [touch] Creating /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc/jspcompile_touch [stopwatch] [build: 36.436 sec] server: [echo] [echo] Configuring server at /opt/hybris/hybris/bin/platform/tomcat-6 [echo] Using config set at /opt/hybris/hybris/config/tomcat [echo] [copy] Copying 8 files to /opt/hybris/hybris/bin/platform/tomcat-6 [copy] Copying 6 files to /opt/hybris/hybris/bin/platform/tomcat-6 [copy] Copying 1 file to /opt/hybris/hybris/bin/platform/tomcat-6/lib [java] Process not found [java] shutting down hybris registry.. all: [echo] Build finished on 24-March-2014 07:09:01. [echo] BUILD SUCCESSFUL Total time: 42 seconds SSH: EXEC: completed after 59,838 ms SSH: Disconnecting configuration [Dev-trunk] ... SSH: Transferred 3 file(s) Email was triggered for: Success Sending email for trigger: Success
But I want it to look like this...
[copy] Copying 1 file to /opt/hybris/hybris/bin/ext-channel/cscockpit/resources/localization
[mkdir] Created dir: /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc
echo]
jspcompile] generating..
[echo]
[jspcompile] touching jsp files
[echo]
[jspcompile] compiling.. /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc [yjavac] Compiling 209 source files to /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc [touch] Creating /opt/hybris/hybris/bin/platform/tomcat-6/work/Catalina/localhost/hmc/jspcompile_touch
[stopwatch]
[build: 36.436 sec] server:
[echo]
[echo] Configuring server at /opt/hybris/hybris/bin/platform/tomcat-6
[echo] Using config set at /opt/hybris/hybris/config/tomcat
[echo]
[copy] Copying 8 files to /opt/hybris/hybris/bin/platform/tomcat-6
[copy] Copying 6 files to /opt/hybris/hybris/bin/platform/tomcat-6
[copy] Copying 1 file to /opt/hybris/hybris/bin/platform/tomcat-6/lib
[java] Process not found
[java] shutting down hybris registry.. all:
[echo] Build finished on 24-March-2014 07:09:01.
[echo] BUILD SUCCESSFUL Total time: 42 seconds SSH: EXEC: completed after 59,838 ms SSH: Disconnecting configuration
[Dev-trunk] ... SSH: Transferred 3 file(s) Email was triggered for: Success Sending email for trigger: Success
Sorry to keep you waiting so long. Today I can access my jenkins server and I tried the Jelly template and it works fine.
First of all, the WIKI of the ext-mail plug-in is very useful, here is the link:ext-mail wiki
My jenkins' install path is the same as yours: /var/lib/jenkins/, but I have not find the JELLY Template file html.jelly, I use the file from the WIKI, and here is the link: html.jelly
Now I will show what I have done and the result I got:
Actually I put the template file html.jelly in /var/lib/jenkins/email-templates, note that according to the WIKI, you need to create the folder email-templates under your jenkins installed folder so that the ext-mail plug-in can access the template file. I have no tried the path that you specified, so I don't know if it will still work if I put the html.jelly under the directory: /var/lib/jenkins/plugins/email-ext/WEB-INF/lib/hudson/plugins/emailext/templates.
Rename the html.jelly to html_my.jelly.
<!-- <j:getStatic var="resultFailure" field="FAILURE" className="hudson.model.Result"/> <j:if test="${build.result==resultFailure}"> --> <TABLE width="100%" cellpadding="0" cellspacing="0"> <TR><TD class="bg1"><B>CONSOLE OUTPUT</B></TD></TR> <j:forEach var="line" items="${build.getLog(100)}"><TR><TD class="console">${line}</TD></TR></j:forEach> </TABLE> <BR/> <!-- </j:if> -->
Jenkins -- Manage Jenkins -- Configure System -- Extended E-mail Notification.
Set the "Default Content Type" to be "HTML (text/html)", and I set the default content here to ${JELLY_SCRIPT, template="html_my"}
, and I think we can set Default Content in the Job's configuration will also work. Refer the image here:
In your job's configuration, you also need to modify the content type to be "HTML (text/html)", and you need to specify the trigger type. Refer to the image of configure the Job:
As you can see, the below image is the email content of my temp Job, hope that this will help you and if you have more question, please just let me know.
By the way, it's also wonderful to use the groovy template, you can try!