Last active
April 9, 2016 20:21
-
-
Save bpholt/745439fe1188259fde73a9e40195d97b to your computer and use it in GitHub Desktop.
Remove Jenkins secondary nodes gone out of control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (node in hudson.model.Hudson.instance.slaves.take(100)) { | |
println(node.name) | |
node.getComputer().setTemporarilyOffline(true,null); | |
node.getComputer().doDoDelete(); | |
} | |
println(hudson.model.Hudson.instance.slaves.size()); | |
for (node in hudson.model.Hudson.instance.slaves.take(10)) { | |
computer = node.getComputer(); | |
if(computer != null && computer.isOffline()) { | |
computer.doDoDelete(); | |
} | |
} | |
println(hudson.model.Hudson.instance.slaves.size()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment