-
-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Jenkins#updateNode to call NodeListener#onUpdated #10397
base: master
Are you sure you want to change the base?
Conversation
} | ||
return false; | ||
exists = Queue.withLock(() -> { | ||
if (node == nodes.get(node.getNodeName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ignore WS)
@@ -252,7 +254,7 @@ public void run() { | |||
newOne.onLoad(Nodes.this, newOne.getNodeName()); | |||
} | |||
}); | |||
updateNode(newOne); | |||
updateNode(newOne, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because
NodeListener.fireOnUpdated(oldOne, newOne); |
@@ -138,6 +138,7 @@ public boolean isHoldOffLaunchUntilSave() { | |||
} | |||
|
|||
/** | |||
* In most cases, you should not call this method directly, but {@link Jenkins#updateNode(Node)} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be overridden in Slave
and that overload @Deprecated
as a reminder? In fact
jenkins/core/src/main/java/hudson/model/Node.java
Lines 280 to 284 in f964e56
void setTemporaryOfflineCause(OfflineCause cause) { | |
try { | |
if (temporaryOfflineCause != cause) { | |
temporaryOfflineCause = cause; | |
save(); |
The existing
Jenkins#updateNode
does callNodes#updateNode
thenNode#save
, but unlikeNodes#replaceNode
, it doesn't call the correspondingNodeListener#onUpdated
. In some cases this can cause inconsistencies.See JENKINS-XXXXX.
Testing done
Proposed changelog entries
NodeListener#onUpdated
now gets called whenJenkins#updateNode
is calledProposed changelog category
/label
Proposed upgrade guidelines
N/A
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge
:Maintainer checklist
upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).