Follow-up fixes to Nodes
refactoring
#9053
Merged
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.
Follows up #8979. I found a test regression in a CloudBees CI plugin triggered by this change, after removing a defensive null check not present in #8979. After some investigation I found that #8979 caused
MasterComputer
to be created a bit later during Jenkins startup: rather than insideNodes.load
as beforeit was being created during an explicit call to
Jenkins.updateComputerList
in the startup sequenceThe reason was an attempted optimization to skip loading when the
nodes
directory did not exist, which would be true if no agent had ever been created (the case in the plugin test), even thoughlistFiles
was already being checked for null; the optimization wound up also skipping the early call toJenkins.updateComputerList
, which was unintentional.That would probably not have mattered were it not for two other factors: an NPE in
Queue.createFlyWeightTaskRunnable
which failed to check¹ for a null return value fromJenkins.toComputer()
and thus broke resumed Pipeline build handling; and a mistake in the proprietary plugin which wound up attempting to load running Pipeline builds earlier than they normally would have been loaded byFlowExecutionList.resume
.I also noticed that the new
ScheduleMaintenanceAfterSavingNode
callsQueue.scheduleMaintenance
even whenJenkins.save
(notSlave.save
) is called, which might be wasteful, though it does not seem to have contributed to the test failure. Perhaps it is correct, in caseJenkins.numExecutors
is adjusted?Testing done
Removal of early exit in
Nodes.load
fixes a functional test in a CloudBees CI plugin. Extra null check also did. Fixing timing in the plugin also did.¹Note that SpotBugs does not find this even after deleting
jenkins/core/src/spotbugs/excludesFilter.xml
Lines 273 to 274 in ec5c072
Proposed changelog entries
Before the changes are marked as
ready-for-merge
:Maintainer checklist