Class MinimumInstanceChecker
java.lang.Object
com.google.jenkins.plugins.computeengine.MinimumInstanceChecker
Enforces minimum instance requirements for
InstanceConfigurations.
- Provisioning —
checkForMinimumInstances()iterates all GCE clouds/configs and provisions agents to meetminimumNumberOfInstancesandminimumNumberOfSpareInstances. Called on startup, on config save, on build events and periodically. - Retention protection —
shouldPreserve(ComputeEngineComputer)prevents the idle-timeout from terminating agents that are needed to satisfy minimums. - Time-range gating —
isActiveTimeRange(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),
ComputeEngineRetentionStrategytriggers 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). AddingComputerListener.onOffline(hudson.model.Computer)toComputeEngineComputerListenerwould close this gap. - Pure decision methods —
computeProvisionCount(int, int, com.google.jenkins.plugins.computeengine.MinimumInstanceChecker.MinCheckerInput)andshouldPreserveAgent(int, int, com.google.jenkins.plugins.computeengine.MinimumInstanceChecker.MinCheckerInput, int, boolean, boolean)contain the core math/logic, decoupled from Jenkins state for unit testing viaMinimumInstanceChecker.MinCheckerInput.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidProvisions agents as needed to satisfy minimum instance requirements across all GCE cloud configurations.static booleanCalled byComputeEngineRetentionStrategy.check(com.google.jenkins.plugins.computeengine.ComputeEngineComputer)before delegating to theOnceRetentionStrategy
-
Method Details
-
shouldPreserve
Called byComputeEngineRetentionStrategy.check(com.google.jenkins.plugins.computeengine.ComputeEngineComputer)before delegating to theOnceRetentionStrategy -
checkForMinimumInstances
public static void checkForMinimumInstances()Provisions agents as needed to satisfy minimum instance requirements across all GCE cloud configurations. Concurrent calls are skipped rather than queued to avoid double-provisioning.
-