I am using Jenkins version 2.463 and I have a parameterized pipe-line job, as:
parameters {
string(name: 'testSite', defaultValue: '...', description: 'Test Site')
string(name: 'GIT_API', defaultValue: '...', description: 'API Git URL')
string(name: 'GIT_UI', defaultValue: '...', description: 'UI Git URL')
string(name: 'receiver', defaultValue: '...', description: 'Email Receiver')
...
}
....
post {
always {
script {
...
// Send email with the Allure report attached
emailext(
body: '''${SCRIPT, template="allure-report.groovy"}''',
subject: "Jenkins Job '${env.JOB_NAME}--${env.BUILD_NUMBER}' ${currentBuild.currentResult}",
to: params.receiver,
mimeType: 'text/html'
)
}
}
}
Now, within the contents of the email, which is from this "allure-report.groovy" file, it is mainly the summarize of the data from each running session, such as:
My question is, is it possible to have the parameter value of "testSite" list here? I have tried ${params.testSite}
, but it is no good.
This is a "Build by parameter" job in Jenkins. The last step is to send email, where the email body template is from my local allure-report.groovy
file. and In the actual email sent out, I would like have the "testSite" value presented in the mail, which is originally from the job parameter.
This is a "Build by parameter" job in Jenkins. The last step is to send email, where the email body template is from my local "allure-report.groovy" file. In the actual email sent out, I would like have the "testSite" value presented in the mail, which is originally from the job parameter provided by the user.
I have found a solution, which is to use this:
${build.getEnvVars()["testSite"]}