-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
Environment Injector Plugin v1.55
Currently the help indication for Script Path/Content states:
... adding or overriding environment variables in the script doesn't have any impacts in the build job.
It would be extremely useful to be able to source a script (i.e., bash) which exports environment variables such that they persist for use in the build job. Currently to work around this, I need to source the script at the top of every Execute Shell build step.
I use the bash built-in 'source' command which executes the script in the context of the current shell. For the purposes of this plugin, doing so will load any exported environment variables into the shell environment. Once the shell is closed, the variables exported into it are gone as well. This is why, if I execute 5 different shell build steps, I must source the environment file in each build step.
As an example, if my script called environment.anything contains:
#!/bin/bash export MY_VARIABLE="Test Variable"
This would be possible in a shell:
You can read about shells Here but the 'source' command should be supported by most major shell types.
Ultimately, I'd like to be able to source a script which sets up my job environment such that all my build steps also share that environment.