Another option if you want to do it programmatically could be to use an API
call via url hit to take machines offline, then put them back online.  The
general format of the call should be available pretty easily with a web
search, but we use something like this in a curl call when wanting to take
machines offline for regular scripted maintenance:

https://
<user>:<apikey>@<jenkinshost>/computer/<nodename>/toggleOffline?offlineMessage=Offline_For_Maintenance_Script

And then run it again to put the machine back online.  The only negative is
that this call toggles the online/offline state, and I am not aware of a
call which can be made to explicitly put a node online, or offline; just
the toggle of current state.  This will take the machine offline
gracefully, where any running builds will complete, but no new builds will
be started.

This call could be done via a separate job on the Jenkins server itself
(running on a node that doesn't get taken offline), or via any sort of
external scheduling mechanism you'd like that has the ability to do a http
request.

Scott
​

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAAPjsPZ1VijXmeEuMoQsSKtpdhceAbdKGvftSQMx6RRY%3D8h09A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to