-
Improvement
-
Resolution: Fixed
-
Trivial
-
None
The EC2 Jenkins plugin currently supports a Max Total Uses field that allows EC2 agents to be reused for multiple builds. This logic was originally added to reduce startup time and optimize cost.
However, in High Availability (HA) Jenkins environments, this reuse model introduces complications. Specifically, if one controller fails and another takes over, already-connected EC2 agents may be reassigned unexpectedly, leading to potential build inconsistencies or errors.
This change removes the Max Total Uses logic and hardcodes the value to 1. As a result:
- Each EC2 agent is used for a single build only.
- Agents are terminated immediately after the build completes.
- Builds always run on fresh EC2 instances, eliminating risks from residual state.