Yes I can share one of the templates.It basically takes the example template 
that was shipped with older version of EmailExt pluginAnd adds some code to 
look at the log for the job for Artifacts that were sent to Artifactory and 
adds links to the email.The script is show below
I am able to run this as it is, in the email template testing.I pulled out the 
custom code and it would still not run as it was originally named. 
(emailBody-HTML.template)
And al I had to do was change the name to groovy-html.template and it ran 
successfully.
Here is the template fileemailBody-HTML.template
<STYLE>BODY, TABLE, TD, TH, P {  font-family:Verdana,Helvetica,sans serif;  
font-size:11px;  color:black;}h1 { color:black; }h2 { color:black; }h3 { 
color:black; }TD.bg1 { color:white; background-color:#0000C0; font-size:120% 
}TD.bg2 { color:white; background-color:#4040FF; font-size:110% }TD.bg3 { 
color:white; background-color:#8080FF; }TD.test_passed { color:blue; 
}TD.test_failed { color:red; }TD.console { font-family:Courier New; 
}</STYLE><BODY>
<TABLE>  <TR><TD align="right"><IMG 
SRC="${rooturl}static/e59dfe28/images/32x32/<%= build.result.toString() == 
'SUCCESS' ? "blue.gif" : build.result.toString() == 'FAILURE' ? 'red.gif' : 
'yellow.gif' %>" />  </TD><TD valign="center"><B style="font-size: 200%;">BUILD 
${build.result}</B></TD></TR>  <TR><TD>Build URL</TD><TD><A 
href="${rooturl}${build.url}">${rooturl}${build.url}</A></TD></TR>  
<TR><TD>Project:</TD><TD>${project.name}</TD></TR>  <TR><TD>Date of 
build:</TD><TD>${it.timestampString}</TD></TR>  <TR><TD>Build 
duration:</TD><TD>${build.durationString}</TD></TR></TABLE><BR/>
<!-- ARTIFACTS IN ARTIFACTORY --><% def logFile = build.getRootDir().getPath() 
+ "/log"    def outputFile = "var/lib/jenkins/email-templates/" + build.getId() 
   def command = "/var/lib/jenkins/email-templates/parseLogArtifactory.sh " + 
logFile + " " + outputFile   def proc = command.execute()   proc.waitFor()   
File outfile = new File( outputFile )   if( outfile.exists() ) { %> <TABLE 
width="100%">    <TR><TD class="bg1"><B>BUILD ARTIFACTS</B></TD></TR>    <TR>   
   <TD><%              outfile.eachLine() { line -> %>            <a 
href="${print(line)}"></a><%              } %>      </TD>    </TR><%   } %> 
</TABLE><BR/><% outfile.delete() %>

<!-- CHANGE SET --><% def changeSet = build.changeSetif(changeSet != null) { 
def hadChanges = false %> <TABLE width="100%">    <TR><TD class="bg1" 
colspan="2"><B>CHANGES</B></TD></TR><%  changeSet.each() { cs -> hadChanges = 
true %>       <TR>        <TD colspan="2" class="bg2">  Revision <B><%= 
cs.metaClass.hasProperty('commitId') ? cs.commitId : 
cs.metaClass.hasProperty('revision') ? cs.revision :         
cs.metaClass.hasProperty('changeNumber') ? cs.changeNumber : "" %></B> by       
   <B><%= cs.author %>: </B>          <B>(${cs.msgAnnotated})</B>         </TD> 
     </TR><% cs.affectedFiles.each() { p -> %>        <TR>          <TD 
width="10%">  ${p.editType.name}</TD>          <TD>${p.path}</TD>        
</TR><% } }
 if(!hadChanges) { %>         <TR><TD colspan="2">No Changes</TD></TR><% } %>  
</TABLE><BR/><% } %>

<!-- NOT USING ARTIFACTS, they are stored on ARTIFACTORY --><!-- ARTIFACTS 
--><% def artifacts = build.artifactsif(artifacts != null && artifacts.size() > 
0) { %>  <TABLE width="100%">    <TR><TD class="bg1"><B>BUILD 
ARTIFACTS</B></TD></TR>    <TR>      <TD><%  artifacts.each() { f -> %>         
 <li>           <a href="${rooturl}${build.url}artifact/${f}">${f}</a>         
</li><% } %>      </TD>    </TR>  </TABLE><BR/>  <% } %>

<!-- MAVEN ARTIFACTS --><% try {  def mbuilds = build.moduleBuilds  if(mbuilds 
!= null) { %>  <TABLE width="100%">      <TR><TD class="bg1"><B>BUILD 
ARTIFACTS</B></TD></TR><%     try {          mbuild.each() { m -> %>           
<TR><TD class="bg2"><B>${m.key.displayName}</B></TD></TR><% m.value.each() { 
mvnbld -> def artifactz = mvnbld.artifacts if(artifactz != null && 
artifactz.size() > 0) { %>       <TR>        <TD><% artifactz.each() { f -> %>  
          <li>             <a 
href="${rooturl}${mvnbld.url}artifact/${f}">${f}</a>           </li><% } %>     
   </TD>      </TR><% }  }       }    } catch(e) { // we don't do anything    } 
 %>        </TABLE><BR/><% } 
}catch(e) { // we don't do anything}%>
<!-- JUnit TEMPLATE -->
<% def junitResultList = it.JUnitTestResultif (junitResultList.size() > 0) { %> 
 <TABLE width="100%">    <TR><TD class="bg1" colspan="2"><B>JUnit 
Tests</B></TD></TR>    <% it.JUnitTestResult.each{ junitResult ->      
junitResult.getChildren().each { packageResult -> %>        <TR><TD class="bg2" 
colspan="2"> Name: ${packageResult.getName()} Failed: 
${packageResult.getFailCount()} test(s), Passed: 
${packageResult.getPassCount()} test(s), Skipped: 
${packageResult.getSkipCount()} test(s), Total: 
${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()}
 test(s)</TD></TR>        <% packageResult.getFailedTests().each{ failed_test 
-> %>          <TR bgcolor="white"><TD class="test_failed" 
colspan="2"><B><li>Failed: ${failed_test.getFullName()} </li></B></TD></TR>     
   <% }      }    }} %>  </TABLE><BR/>
<!-- CONSOLE OUTPUT --><% if(build.result==hudson.model.Result.FAILURE) { 
%><TABLE width="100%" cellpadding="0" cellspacing="0"><TR><TD 
class="bg1"><B>CONSOLE OUTPUT</B></TD></TR><%  build.getLog(100).each() { line 
-> %> <TR><TD 
class="console">${org.apache.commons.lang.StringEscapeUtils.escapeHtml(line)}</TD></TR><%
  } %></TABLE><BR/><% } %>
</BODY>


      From: Slide <[email protected]>
 To: [email protected] 
 Sent: Wednesday, January 14, 2015 2:01 PM
 Subject: Re: EmailExt 2.39
   
Looks to me like its an issue in the template itself. Are you able to share it?

On Wed Jan 14 2015 at 9:57:24 AM 'dj44port' via Jenkins Users 
<[email protected]> wrote:

Updated Jenkins to 1.596, and update to EmailExt 2.39And have the following 
dependencies installedtoken-macro - 1.10script-security - 1.12mailer - 1.12
The issue is we have some custom email templates, when the email is sentThe 
logs for Jenkins and the error sent in the email are below.Changed the name of 
the template being used to groovy-html.templateAnd the emails were sent 
successfully.Why can't custom named templates be used anymore?
There are no errors in the Jenkins log22:44:32 Checking if email needs to be 
generated
22:44:32 Email was triggered for: Success
22:44:32 Sending email for trigger: Success
22:44:32 NOT overriding default server settings, using Mailer to create session
22:44:32 messageContentType = text/html; charset=UTF-8
22:44:32 Adding recipients from project recipient list
22:44:32 Adding recipients from trigger recipient list
22:44:32 Successfully created MimeMessage
The email that gets sent has the following errorsException raised during 
template rendering: java.io.FileNotFoundException: 
/var/lib/jenkins/workspace/Product1 (Is a directory) java.io.IOException: 
java.io.FileNotFoundException: /var/lib/jenkins/workspace/Product1 (Is a 
directory) at 
hudson.remoting.FastPipedInputStream.read(FastPipedInputStream.java:169) at 
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282) at 
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324) at 
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176) at 
java.io.InputStreamReader.read(InputStreamReader.java:184) at 
java.io.Reader.read(Reader.java:140) at 
org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2001) at 
org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1980) at 
org.apache.commons.io.IOUtils.copy(IOUtils.java:1957) at 
org.apache.commons.io.IOUtils.copy(IOUtils.java:1907) at 
org.apache.commons.io.IOUtils.toString(IOUtils.java:778) at 
org.apache.commons.io.IOUtils.toString(IOUtils.java:759) at 
hudson.FilePath.readToString(FilePath.java:1842) at 
hudson.FilePath$readToString$0.call(Unknown Source) at 
SimpleTemplateScript12.run(SimpleTemplateScript12.groovy:29) at 
groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.java:165)
 at 
groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine.java:177)
 at 
hudson.plugins.emailext.plugins.content.ScriptContent.renderTemplate(ScriptContent.java:216)
 at 
hudson.plugins.emailext.plugins.content.ScriptContent.evaluate(ScriptContent.java:85)
 at 
org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro.evaluate(DataBoundTokenMacro.java:189)
 at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:182) at 
org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:233) at 
hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:72)
 at 
hudson.plugins.emailext.ExtendedEmailPublisher.getContent(ExtendedEmailPublisher.java:659)
 at 
hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:538)
 at 
hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:306)
 at 
hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:297)
 at 
hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:244)
 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at 
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
 at 
hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
 at hudson.model.Build$BuildExecution.cleanUp(Build.java:192) at 
hudson.model.Run.execute(Run.java:1805) at 
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at 
hudson.model.ResourceController.execute(ResourceController.java:89) at 
hudson.model.Executor.run(Executor.java:240) Caused by: 
java.io.FileNotFoundException: /var/lib/jenkins/workspace/Product1 (Is a 
directory) at java.io.FileInputStream.open(Native Method) at 
java.io.FileInputStream. (FileInputStream.java:146) at 
hudson.FilePath$33.invoke(FilePath.java:1749) at 
hudson.FilePath$33.invoke(FilePath.java:1742) at 
hudson.FilePath$FileCallableWrapper.call(FilePath.java:2677) at 
hudson.remoting.UserRequest.perform(UserRequest.java:121) at 
hudson.remoting.UserRequest.perform(UserRequest.java:49) at 
hudson.remoting.Request$2.run(Request.java:324) at 
hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
at java.lang.Thread.run(Thread.java:724)-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c3f481e3-ea9d-40e8-87a6-bb5b1a560a1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVdo9MypvRTm-xv4Ye%3DPP11p88Ka5D2zjF27aUyzhbusWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


  

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/173495137.1219252.1421266594612.JavaMail.yahoo%40jws10699.mail.bf1.yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to