Is it possible to define a new build parameter/ENV variable in a build step so it was available in the next one?
Let’s say I have 2 different “Execute shell” steps and want in the second step access the variable defined in the first one.
PS: the value for the variable is set in runtime – read from 3rd party resource, so I cannot harcode it, thus need to set it from the shell script.
The plugin EnvInject will do that for you.
It can be configured as
pre-SCMstep or asbuildsteps. Put it in between your two existing build steps.Update
In your case, it may be easier to just read the value of the “3rd party” file as part of your second build step:
After the above line, the contents of your
3rdpartyfile.txtwill be available in environment variablevar. You can now use$varas you would any other variable