Please could you tell me what do you mean about referencing an external Groovy script?
I need a way to invoke Groovy scripts that are managed globally, e.g. with the SharedObjects plugin.
And currently, you can give an absolute path to your Groovy script, so the file can be shared through many jobs.
The "Script File Path" field is for shell scripts and its help states that they cannot contribute environment variables which is another requirement in my case.
Moreover, there is the SharedObjects Jenkins plugins to share more advanced objects and injected them in the EnvInject plugin.
My solution is is to run Groovy scripts defined in the SharedObjects plugin (by content or path), and have those scripts add environment variables to the job.
I've sent a request to pull my solution, please review.