I would like to set a variable in one stage and use that in a following stage in a pure declarative Jenkins pipeline.
I DO NOT want to:
- Use a script block to set the variable.
- Use a temporary file to store the value.
Is it possible?
Things I have already tried:
- Usage of environment block: can't override variables set in global environment block inside a stage. Variables inside stage specific environment blocks don't outlive the scope of a specific stage.
- Exporting an environment variable (using 'sh' step) doesn't got beyond the scope of stage.
- Direct variable assignment inside "steps" doesn't seem to be possible.
Please help !