-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
It would be nice if we could inject env variables by a script store in filesystem but not only using "Evaluated Groovy Script" pasted in job parameters.
It would be nice if we could inject env variables by a script store in filesystem but not only using "Evaluated Groovy Script" pasted in job parameters.
Agreed that it would be nice.
In the meantime, I've worked around this by retrieving scripts via http from jenkins userContent,
(Scripts in that directory get auto-updated from scm via puppet).
All scripts return a closure.
One-liner for brevity:
evaluate("${jenkins.model.Jenkins.getInstance().getRootUrl()}/userContent/my-script-name.groovy".toURL().text)()
Script example:
Same with parameter passed to the shared script:
Script example: