Receive multi-line message in jenkins email notification

I need to change the extended email part for email notification in jenkins. This is what I have right now:

enter image description here

It just shows the first line of the commit message in the letter. I would like to grab a few lines from a commit message.

I found this: https://issues.jenkins-ci.org/browse/JENKINS-12289 so I tried to follow, it didn't work.

enter image description here Please someone tell me how to fix it.

Thank you tons!

+4
source share
1 answer

Comments are truncated to 71 or 72 characters, because behind the scenes the ext email uses the title property instead of the comment property.

Save this in Jenkins> email-templates as test.template. Note the use of cs.comment instead of cs.title

 <!-- CHANGE SET --> <% def changeSets = build.changeSets if(changeSets != null) { def hadChanges = false %> <table class="section"> <tr class="tr-title"> <td class="td-title" colspan="2">CHANGES</td> </tr> <% changeSets.each() { cs_list -> cs_list.each() { cs -> hadChanges = true %> <tr> <td> Revision <%= cs.metaClass.hasProperty('commitId') ? cs.commitId : cs.metaClass.hasProperty('revision') ? cs.revision : cs.metaClass.hasProperty('changeNumber') ? cs.changeNumber : "" %> by <B><%= cs.author %></B> </td> <td>${org.apache.commons.lang.StringEscapeUtils.escapeHtml(cs.comment)}</td> </tr> <% cs.affectedFiles.each() { p -> %> <tr> <td class="filesChanged">${p.editType.name}</td> <td>${p.path}</td> </tr> <% } } } if ( !hadChanges ) { %> <tr> <td colspan="2">No Changes</td> </tr> <% } %> </table> <br/> <% } %> 

Then in your editable email after build add the following line:

${SCRIPT, template="test.template"}

0
source

All Articles