emailpluginsjenkinsformatjelly

Jenkins Email-ext plugin build log all on one line


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 

Solution

  • 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:

    <!-- 
    <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> -->
    

    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. The email content example

    By the way, it's also wonderful to use the groovy template, you can try!