Skip to content

Commit

Permalink
More resilient no provision on shutdown (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Dec 20, 2024
1 parent 7288787 commit 9a63017
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ public Collection<PlannedNode> provision(CloudState cloudState, int workLoad) {
LOGGER.log(Level.FINE, "Starting for label {0} workLoad {1}",
new Object[]{cloudState.getLabel(), workLoad}
);

if (Jenkins.get().isQuietingDown()) {
LOGGER.log(Level.FINE, "Skipping provision as Jenkins is in quiet-down");
return Collections.emptyList();

Check warning on line 640 in src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 638-640 are not covered by tests
}

final AzureVMAgentTemplate template = AzureVMCloud.this.getAzureAgentTemplate(cloudState.getLabel());

// round up the number of required machine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public NodeProvisioner.StrategyDecision apply(@NonNull NodeProvisioner.StrategyS
return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES;
}

if (Jenkins.get().isQuietingDown()) {
LOGGER.log(Level.FINE, "Skipping provision as Jenkins is quieting down");
return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES;

Check warning on line 53 in src/main/java/com/microsoft/azure/vmagent/AzureVMNoDelayProvisionerStrategy.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 51-53 are not covered by tests
}

final Label label = strategyState.getLabel();

LoadStatistics.LoadStatisticsSnapshot snapshot = strategyState.getSnapshot();
Expand Down

0 comments on commit 9a63017

Please sign in to comment.