Class MinimumInstanceChecker

java.lang.Object
com.google.jenkins.plugins.computeengine.MinimumInstanceChecker

public class MinimumInstanceChecker extends Object
Enforces minimum instance requirements for InstanceConfigurations.
  • ProvisioningcheckForMinimumInstances() iterates all GCE clouds/configs and provisions agents to meet minimumNumberOfInstances and minimumNumberOfSpareInstances. Called on startup, on config save, on build events and periodically.
  • Retention protectionshouldPreserve(ComputeEngineComputer) prevents the idle-timeout from terminating agents that are needed to satisfy minimums.
  • Time-range gatingisActiveTimeRange(com.google.jenkins.plugins.computeengine.MinimumNumberOfInstancesTimeRangeConfig) checks whether minimums should be enforced based on configured time-of-day and day-of-week windows.
  • Instance failure handling — when a oneShot agent completes (including preemption), ComputeEngineRetentionStrategy triggers immediate replenishment. For non-oneShot agents that go offline (VM preempted, crashed, or disconnected), replenishment currently relies on the periodic check (up to 10-min delay). Adding ComputerListener.onOffline(hudson.model.Computer) to ComputeEngineComputerListener would close this gap.
  • Pure decision methodscomputeProvisionCount(int, int, com.google.jenkins.plugins.computeengine.MinimumInstanceChecker.MinCheckerInput) and shouldPreserveAgent(int, int, com.google.jenkins.plugins.computeengine.MinimumInstanceChecker.MinCheckerInput, int, boolean, boolean) contain the core math/logic, decoupled from Jenkins state for unit testing via MinimumInstanceChecker.MinCheckerInput.