-
Bug
-
Resolution: Incomplete
-
Minor
-
None
-
Jenkins ver. 2.32.3, email-ext plugin 2.57.1
Given the following Jenkins pipeline code:
String customEmailContent = "<h5>Custom HTML content</h5>"
withEnv(["CUSTOM_EMAIL_CONTENT=$\{customEmailContent}"]) {
steps.emailext(to: "person@company.com",
subject: "Subject",
mimeType: "text/html",
body: '${SCRIPT, template="my-groovy-html.template"}',
recipientProviders: null)
}
I would expect to be able to see the "CUSTOM_EMAIL_CONTENT" environment variable available inside the template. However, that does not appear to be the case. I've tried a number of different approaches mentioned in various message boards (ex: using build.environment["CUSTOM_EMAIL_CONTENT"] in the template, using env.CUSTOM_EMAIL_CONTENT=customEmailContent in the pipeline code), but the environment variable is never there.
Am I missing something?
- is duplicated by
-
JENKINS-47017 Possibility to use build variables in templates
-
- Closed
-
- is related to
-
JENKINS-47017 Possibility to use build variables in templates
-
- Closed
-
Did you try using ENV(var: 'CUSTOM_EMAIL_CONTENT') in the template?