Yeah, as you found, the environment is the sh is only present during that run. It is just like dropping to a shell (or running another shell within a shell), running some things, and then exiting.
If you want to set them globally, you will need to set them in an environment block in declarative pipeline, or in groovy code. env.FOO = "BAR".
If you want to try to set something in the shell, and then get those values back into the pipeline, it gets a little harder. You can return just a value from a shell script and assign that to a variable. Or you can look at the pipeline utility steps plugin to suck things in from a file.
On Thursday, November 2, 2017 at 2:07:38 PM UTC-6, itchymuzzle wrote:
Don't know how to set it globally, most likely someone will know how to do that and respond.
> each sh looses it's environment.
Each sh is it's own environment. If you have two different terminals up, what you do in one isn't known in the other. For example.