Skip to content
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

Nodes persistence cleanup, APIs to control loading #8979

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

jglick
Copy link
Member

@jglick jglick commented Feb 21, 2024

When running CloudBees CI in high availability mode we need to control which agents are loaded from disk: blocking some from being loaded at startup, loading them later, reloading them from disk, unloading them from memory while they remain on disk. The four new methods here allow that level of fine-grained control. By default the behavior remains unchanged, of course: the list of agents in memory matches the contents of the nodes directory.

Testing done

Exercised by various functional tests in CloudBees CI.

Proposed changelog entries

  • Add experimental APIs to control which agents are loaded and when.

Proposed upgrade guidelines

  • N/A

Before the changes are marked as ready-for-merge:

Maintainer checklist

Comment on lines -140 to +153
Node oldNode = nodes.get(node.getNodeName());
if (node != oldNode) {
AtomicReference<Node> old = new AtomicReference<>();
old.set(nodes.put(node.getNodeName(), node));
Node old = nodes.put(node.getNodeName(), node);
if (node != old) {
node.onLoad(this, node.getNodeName());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking the opportunity to simplify the logic here a bit: #5450 (comment)

@NotMyFault NotMyFault added the developer Changes which impact plugin developers label Feb 27, 2024
@NotMyFault NotMyFault requested a review from a team March 4, 2024 14:48
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Mar 4, 2024
@NotMyFault NotMyFault merged commit 13c86ee into jenkinsci:master Mar 5, 2024
17 checks passed
@jglick jglick deleted the Nodes branch March 5, 2024 20:52
@mattiassluis
Copy link

I couldn't find an issue number to comment to hence responding here:
Could it be that a side effect of this change is that renaming a node through Groovy (calling setNodeName) causes duplicate nodes?
We have a groovy init script that randomises node names and after updating to 2.449 it suddenly causes nodes to duplicate after running the script (we are aware that we are using API internals that probably shouldn't be used).

@jglick
Copy link
Member Author

jglick commented Mar 14, 2024

@mattiassluis that seems plausible. Renaming a node remains possible through the GUI so I think you were just using the wrong method all along. Try creating a new Slave object and calling Jenkins.removeNode + Jenkins.addNode, or Jenkins.setNodes. (To reconfigure one agent without renaming, create a new Slave and call updateNode. I am not sure if this is safe to use for a rename as well.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer Changes which impact plugin developers ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants