Stage-level environment variable missing in later Declarative Pipeline stages
0 reputation · 30 Dec 2023, 02:05 UTC
Determine whether a variable defined in a stage‑level environment block of a Jenkins Declarative Pipeline is automatically available to stages that follow it.
The inheritance of stage‑level environment settings is not explicitly documented and appears to differ between Jenkins core releases, Pipeline plugin versions, and when plugins such as EnvInject or Config File Provider are present; additionally, the behavior may change when stages execute on different agents in a distributed build.
Does a stage‑level environment block propagate its variables to subsequent stages in the same pipeline run? Is the propagation consistent across Jenkins core 2.400+ and Pipeline plugin 2.12+? Are there known plugin interactions that suppress or alter this inheritance?