fix: New resources now unblock waiting jobs immediately#1004
Merged
github-actions[bot] merged 2 commits intomasterfrom Apr 16, 2026
Merged
fix: New resources now unblock waiting jobs immediately#1004github-actions[bot] merged 2 commits intomasterfrom
github-actions[bot] merged 2 commits intomasterfrom
Conversation
When a new resource is added via createResourceWithLabel() or addResource(), waiting jobs now automatically pick it up instead of remaining blocked. Changes: - Invalidate cachedCandidates and process waiting pipeline contexts when adding new resources (inside synchronized block for atomicity) - Call scheduleQueueMaintenance() to notify freestyle jobs - Add refreshQueue() public method for users who modify labels on existing resources (label changes don't auto-trigger re-evaluation) - Add documentation explaining dynamic resource behavior and limitations Fixes #892 See also: JENKINS-46744
Contributor
|
⏳ Auto-merge countdown: This PR will be auto-approved in 2 day(s) if no review is submitted. |
Contributor
|
|
Contributor
|
✅ Auto-approved: No review received within 3 days. Merging now. |
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.
Summary
When a new resource is added via
createResourceWithLabel()oraddResource(), waiting jobs now automatically pick it up instead of remaining blocked.Fixes #892
See also: JENKINS-46744
Changes
Core fix in
LockableResourcesManager.addResource():cachedCandidateswhen adding new resourcesproceedNextContext()scheduleQueueMaintenance()to notify freestyle jobsNew public API:
refreshQueue()method for users who modify labels on existing resources (label changes don't auto-trigger re-evaluation)Documentation:
dynamic-resource-pool-expansion.mdwith usage patternsTesting
newResourceWithLabelUnblocksWaitingPipelineJob()- Pipeline job waiting for label gets unblocked when matching resource is addednewResourceUnblocksWaitingFreestyleJob()- Freestyle job waiting for label gets unblocked when matching resource is addedLimitations documented
Modifying labels on existing resources does not automatically trigger queue re-evaluation. Users must call
LockableResourcesManager.get().refreshQueue()manually after such changes.