Reputation: 30448
I need to dynamically modify the notification e-mail recipients based on the build, so I'm using a groovy script. I want this script to be available to all jobs, so I want it to reside on the Jenkins file system and not within each project. It can be either in the recipients fields (using ${SCRIPT,...}) or in the pre-send script. A short (fixed) script that evaluates the master script is also good, as long it is the same for all projects.
Upvotes: 4
Views: 3230
Reputation: 170846
My impression it that you would probably want to completely switch to Jenkins pipelines where the entire job is groovy file (Jenkinsfile) in the root of the repository.
Email-Ext already supports it even if it may be lacking some documentation. https://jenkins.io/doc/pipeline/steps/email-ext/
Upvotes: 0
Reputation: 27515
You should try Config File Provider plugin. It works together with the Credentials configuration of Jenkins.
Your script will now be saved centrally on Jenkins, available to master/slave nodes.
In your Job Configuration:
myscript
Now, anywhere in your job, you can say ${myscript}
and it will refer to absolute location of the file on filesystem (it will be somewhere in Jenkins dir).
Upvotes: 3