Source:
public NodeProvisioner.StrategyDecision apply(NodeProvisioner.StrategyState strategyState) { if (DISABLE_NODELAY_PROVISING) { LOGGER.log(Level.FINE, "Provisioning not complete, NoDelayProvisionerStrategy is disabled"); return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES; } final Label label = strategyState.getLabel(); LoadStatistics.LoadStatisticsSnapshot snapshot = strategyState.getSnapshot(); int availableCapacity = snapshot.getAvailableExecutors() + snapshot.getConnectingExecutors() + strategyState.getPlannedCapacitySnapshot() + strategyState.getAdditionalPlannedCapacity(); int currentDemand = snapshot.getQueueLength(); LOGGER.log(Level.FINE, "Available capacity={0}, currentDemand={1}", new Object[]{availableCapacity, currentDemand}); if (availableCapacity < currentDemand) { Jenkins jenkinsInstance = Jenkins.get(); for (Cloud cloud : jenkinsInstance.clouds) { if (!(cloud instanceof KubernetesCloud)) continue; if (!cloud.canProvision(label)) continue; Collection<NodeProvisioner.PlannedNode> plannedNodes = cloud.provision(label, currentDemand - availableCapacity); LOGGER.log(Level.FINE, "Planned {0} new nodes", plannedNodes.size()); strategyState.recordPendingLaunches(plannedNodes); availableCapacity += plannedNodes.size(); LOGGER.log(Level.FINE, "After provisioning, available capacity={0}, currentDemand={1}", new Object[]{availableCapacity, currentDemand}); break; } } if (availableCapacity >= currentDemand) { LOGGER.log(Level.FINE, "Provisioning completed"); return NodeProvisioner.StrategyDecision.PROVISIONING_COMPLETED; } else { LOGGER.log(Level.FINE, "Provisioning not complete, consulting remaining strategies"); return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES; } }

Target:
public NodeProvisioner.StrategyDecision apply(NodeProvisioner.StrategyState strategyState) { if (DISABLE_NODELAY_PROVISING) { LOGGER.log(Level.FINE, "Provisioning not complete, NoDelayProvisionerStrategy is disabled"); return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES; } final Label label = strategyState.getLabel(); LoadStatistics.LoadStatisticsSnapshot snapshot = strategyState.getSnapshot(); int availableCapacity = snapshot.getAvailableExecutors() + snapshot.getConnectingExecutors() + strategyState.getPlannedCapacitySnapshot() + strategyState.getAdditionalPlannedCapacity(); int currentDemand = snapshot.getQueueLength(); LOGGER.log(Level.FINE, "Available capacity={0}, currentDemand={1}", new Object[]{availableCapacity, currentDemand}); if (availableCapacity < currentDemand) { List<Cloud> jenkinsClouds = new ArrayList<>(Jenkins.get().clouds); Collections.shuffle(jenkinsClouds); for (Cloud cloud : jenkinsClouds) { if (!(cloud instanceof KubernetesCloud)) continue; if (!cloud.canProvision(label)) continue; Collection<NodeProvisioner.PlannedNode> plannedNodes = cloud.provision(label, currentDemand - availableCapacity); LOGGER.log(Level.FINE, "Planned {0} new nodes", plannedNodes.size()); strategyState.recordPendingLaunches(plannedNodes); availableCapacity += plannedNodes.size(); LOGGER.log(Level.FINE, "After provisioning, available capacity={0}, currentDemand={1}", new Object[]{availableCapacity, currentDemand}); break; } } if (availableCapacity >= currentDemand) { LOGGER.log(Level.FINE, "Provisioning completed"); return NodeProvisioner.StrategyDecision.PROVISIONING_COMPLETED; } else { LOGGER.log(Level.FINE, "Provisioning not complete, consulting remaining strategies"); return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES; } }