Issue
How do I use the email-id in prior stages from the variable EmailDL
which I have used in the email text plugin in the declarative pipeline template in the last stage?
Is there any Global variable for the EmailDL
/recipient
/To
like $BUILDID
which can be used?
we have EmailDL
to receive Job Status Emails
to collect the email id & use it in the template
post {
always {
emailext (
body:
subject: "XXXXXX",
mimeType: 'text/html',
to: "${EmailDL}"
)
}
}
All works good but how do I reuse the parameter EmailDL
outside of the Post stages?
Solution
I would suggest define it in environment like this
environment {
EmailDL = "[email protected]"
}
and use it anywhere using ${EmailDL}
Answered By - Dashrath Mundkar
Answer Checked By - Katrina (JavaFixing Volunteer)