Declarative Pipeline agent directive scope limits
0 reputation · 06 Jun 2020, 08:29 UTC
Agent Allocation in Heterogeneous Environments
Jenkins Declarative Pipelines allow the agent directive to be defined globally or overridden at the stage level. This mechanism is intended to support heterogeneous build environments where different stages require specific OS or tool configurations.
When a global agent is defined, it allocates a workspace for the entire pipeline. However, introducing per-stage agent overrides creates a transition between different executors. There is uncertainty regarding the persistence of workspace files when moving from a global agent to a stage-specific agent, and back again, without explicit artifact archiving.
- How does Jenkins handle workspace cleanup when transitioning between a global agent and a stage-specific agent?
- Is there a documented method to maintain a consistent workspace across different agent types within a single Declarative Pipeline execution?