We are experiencing issues where using the Jenkins API to toggle a node offline (toggleOffline) results in the node going fully offline, preventing it from accepting new builds and potentially disrupting ongoing jobs.
Our requirement is to set temporarilyOffline = true via the API so that:
The node stops accepting new jobs.
Existing jobs continue running without interruption.
Could you please provide guidance on achieving this behavior via the API? If any specific API endpoint or payload adjustments are required, kindly share the details.
Actually toggleOffline should exactly do what you need. It is the same as when you click in the UI to take an agent temporarily offline.
It will not accept new builds but the agents stays connected and running builds should finish.
node set to offline and temporarilyOffline = true as you said but In my case, it’s the opposite. Builds are failing with the error: "Unable to create live FilePath for Node04; Node04 was marked offline: Connection was broken.
I’m thinking, what if we remove the node’s labels programmatically? That should allow existing builds to complete while making the node invisible to new builds.
That would work when you only use labels and not directly the node names.
Still strange that taking the agent offline temporarily causes it to disconnect.
After taking an agent offline, does it immediately happen that the connection is somehow lost?
Are those cloud agents?