-
Bug
-
Resolution: Won't Fix
-
Minor
-
Linux Master
Windows Node
The email-ext lost a feature between
working: Jenkins 2.51, email-ext 2.56
not working: Jenkins 2.54, email-ext 2.57-2
The template cannot reside on the slave node anymore, the template file is not found anymore with absolute path. The following pipeline code on inside a Windows slave node:
def email_template_file = pwd([tmp: true]) + "\\email_template_file.jelly"; writeFile([file: email_template_file, text: content_template]); emailext body: '${JELLY_SCRIPT,template="' + email_template_file.replaceAll('[\\\\]','/') + '"}'
The email got send but the template is no more found, now give the following results into the email body:
Jelly file [c:/Jenkins/workspace/CAD_CPP/CAD_CPP_ContinuousBuild@tmp/email_template_file.jelly] was not found in$JENKINS_HOME/email-templates.
The workaround is to save the email template on the master (hope no other does the same at the same time or use guid into the filename):
def email_template_file = "testid.html"; node('master') { writeFile([file: "${JENKINS_HOME}/email-templates/" + email_template_file, text: content_template]); emailext body: '${JELLY_SCRIPT,template="' + email_template_file.replaceAll('[\\\\]','/') + '"}', subject: 'test subject', to: 'test@test.com', replyTo: 'jenkins@test.com', mimeType: 'text/html'; }
This is used when you need to determine which section of the email template must be used at run time and based on run results. The pipeline script concat email template section together and then use the results as the final email template.
Now it's locking the template path to a relative path on the master and on top of it, it enforce the ${JENKINS_HOME}/email-templates folder.