Hi All,
I wish to send some parameter/ variable from the current build job to the Email template to send it in an email.
I have saved my email template as Manage_Jenkins>> Managed_Files >> custom_groovy_Email.groovy
in email template, I am trying to use it as follows
<td>Duration:</td>
<td>${build.durationString}</td>
</tr>
<tr>
<td>Cause:</td>
<td><% build.causes.each() { cause -> %> ${cause.shortDescription} <% } %></td>
</tr>
<tr>
<td>Tool version:</td>
//<td>${ENV(var="MYTOOL_VERSION")}</td>
//<td>${ENV(var:"MYTOOL_VERSION")}</td>
<td>${build.buildVariables.MYTOOL_VERSION}</td>
</tr>
</table>
<br/>
And In the groovy file in job configuration, I have tried setting it like this
import hudson.EnvVars
import hudson.model.Environment
import hudson.model.*
node{
stage(tool){
//def MYTOOL_VERSION = '1.33'
//evn.MYTOOL_VERSION = '1.33'
def MYTOOL_VERSION = build.getEnvVars()["${MYTOOL_VERSION}"]
}
}
But it does not seem to be working.
Can anybody help me in this regards, Thank you.