If I have multiple execute shell steps in a Jenkins build, how can I create an environment variable in a particular execute shell step that will still be available in a subsequent execute shell steps and in plugin fields? I specifically want to use the variable in the formatted email plugin.
Asked
Active
Viewed 1,432 times
0
-
Possible duplicate of [Passing data between build steps in Jenkins](http://stackoverflow.com/questions/22366808/passing-data-between-build-steps-in-jenkins) – Gerold Broser May 03 '16 at 20:04
-
https://stackoverflow.com/questions/43879733/jenkinsfile-declarative-pipeline-defining-dynamic-env-vars/43881731#43881731 – Joe Apr 16 '21 at 06:43
1 Answers
0
If nothing else works, you can always put the variables into a file , make that file and artifact which will be delivered to the next stage and then source that file in the next stage

Markus Mikkolainen
- 3,397
- 18
- 21
-
I want to use the variable in a plugin field, that only can access environment variables. – sakurashinken May 03 '16 at 21:39
-
@sakurashinken Did you follow the link I gave you in my comment to your question? There _is_ an answer apart from handling this via a file. – Gerold Broser May 03 '16 at 23:21
-
I see that, but its cumbersome. I'll have to figure out something else. – sakurashinken May 06 '16 at 23:22