Hi,
I have several multibranch pipeline jobs that all use a declarative
pipeline. The Jenkinsfiles contain the following snippet:
post {
failure {
step([$class: 'Mailer', recipients: '[email protected]',
sendToIndividuals: true])
}
}
I would like to avoid hard coding the address "[email protected]" in all
Jenkinsfiles. It is repetitive and is also incorrect when testing on a
staging server or in a VM.
It occurred to me that one option could be to send to the address
"JenkinsLocationConfiguration.getAdminAddress()" [0], as this is configured
correctly in all scenarios listed above.
Is there an easy way to access this value from a Jenkinsfile? Is it
available as some local or environment variable? A normal groovy import and
method call didn't work and instead raised an exception.
If there is a better way to configure this globally, I'd consider that as
well.
Cheers,
Jon
[0]
http://javadoc.jenkins.io/jenkins/model/JenkinsLocationConfiguration.html#getAdminAddress()
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/CADhq2b6fQBCN7NK1QUaxjg82Zm1TjZAfDi2oxRKEupDsFLM4PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.