问题
we have configured Jenkins - Editable Email Notification Templates for sending customized email after every build.
What we did:
- Added script under
*Jenkins -> Manage Jenkins -> Editable Email Notification Templates-> Add New Template*
and then under"Default Content"
section, we added default groovy scripts (for example: groovy-html.template - Copy paste content). Save. - Now under project job, under Post-build section we selected same template
- But when we receive emails, then email is coming without replacing environment variables.. like
" /> BUILD ${build.result} URL ${rooturl}${build.url} Project: ${project.name} Date: ${it.timestampString} Duration: ${build.durationString} Cause: ${cause.shortDescription}
Problem: Environment variable like "build.result", "build.url" etc are coming as variable name (instead of actual values). Are we missing something here?
回答1:
Got the solution:) We need to specify into Default Content section as ${JELLY_SCRIPT,template="Jelly script name"} and place script under JENKINS home "email-templates" folder
来源:https://stackoverflow.com/questions/43936651/jenkins-editable-email-notification-templates