Fix provisioning fallback when first template exhausted (#2005)#2010
Open
zendesk-abhijeet wants to merge 2 commits intojenkinsci:masterfrom
Open
Fix provisioning fallback when first template exhausted (#2005)#2010zendesk-abhijeet wants to merge 2 commits intojenkinsci:masterfrom
zendesk-abhijeet wants to merge 2 commits intojenkinsci:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix provisioning fallback to next template when first is exhausted
Issue - #2005
When multiple EC2 templates share the same label, Jenkins would fail to provision agents if the first template reached its instance capacity. The provisioning logic would create PlannedNodes that resolved to
nullinstead of falling back to the next available template with the same label.Reproduction scenario:
my_agent:instanceCap = 1instanceCap = 10my_agentThis issue was a regression from version
2045.v06da_da_a_46422where the fallback behaviour worked correctly.Fix
Modified EC2Cloud.java to:
getPossibleNewSlavesCount()continueto the next matching template instead of creating failed PlannedNodesKey changes:
continuestatement when template has no capacity (allows fallback to next template)t.provision()call directly into the provisioning future with double-checked lockingTesting done
Added integration tests
testProvisionFallbackToSecondTemplateWhenFirstExhaustedandtestMultipleTemplatesWithSameLabelthat validates:Unit test results:

Test setup:
Template 1 - Base (label: dev_cypress_medium): cap=1, no instances
Template 2 - Spike (label: dev_cypress_medium): cap=1, no instances
Queued 3 jobs requiring label "dev_cypress_medium"
Before fix: Only base instance provisions
After fix: Both base and spike instance provisions
Manual test results:


Test Checklist
Submitter checklist