Passing variable from shell to email-ext in Jenkins

jenkins, jenkins-plugins

Solution

Simple and easy:

In your "Execute Shell"

echo "test log" > /some/file/path/logFile.txt

Then in your "Editable Email Notification-Default Content"

${FILE,path="/some/file/path/logFile.txt"}

Build and you will receive a email with content "test log"

To see more email tokens, you can click the question mark beside "Content Token Reference" in "Editable Email Notification" section.

Problem

I have Jenkins job that has execute shell part in which I have some variable BUILD that is dynamically populated. After build execution, I want to pass this variable to email-ext plugin Default Content to able to show it's value. I've tried couple of ways without a success: - Passing this ${BUILD} value in Default Content is not recognized (Only Jenkins environment variables are visible in this context) - Defined new Jenkins global environment variable and tried to overwrite its initial value in shell context which apparently is not possible Any idea on how to do this?

Original source

Related problems