Sharing nodes between two masters

Hey there,

We are in the process of getting a new machine for a our controller node, and we would like to share the nodes between the old controller and the new one (at least, till we are sure everything is fine with the new controller).

Does Jenkins have built-in support for something like this?

There is no support for this built-in.
The best it gets is with the node sharing plugins:

Other than that, it depends on how you want to use the new machine while you ramp it up. You can run an agent from both controllers on your machines as long as they run in different directories, but you must be aware that there is no mechanism that prevents that a build is triggered on both controllers on the same agent. So if both start a build and the builds require a lot of CPU/memory you can easily overload the agent.
You can use the Bring this agent online according to a schedule availability strategy for you agents to have them online only at specific times, so if those times don’t overlap you might not overload an agent.
And you could also consider taking an agent temporarily offline while you intend to run tests with the new controller on the agent.

We have inhouse a plugin that allows to use the same agent on 2 different controllers, it implements a LoadBalancer (Jenkins core 2.461 API) that uses the rest api of Jenkins to check if the agent on the other Jenkins is currently busy. But the plugin is very specific to our use case. We use it in a scenario where we have an active instance and a backup (inactive) instance that runs on another machine. From time to time we have to do a longer maintenance, but our requirements do not allow for a downtime of several hours. And we have usually long running builds lasting between 1 and 4 hours and some special builds that run for 24hours. So we can’t just put the active one in shutdown mode and wait for builds to finish. The plugin helps in this scenario though it puts high load on both controllers. So we try to avoid having to switch the active instance.

1 Like