Skip to content

Instantly share code, notes, and snippets.

@zentavr
Created February 13, 2019 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zentavr/49046c034b1b46d7d9227572c1d4ad3e to your computer and use it in GitHub Desktop.
Save zentavr/49046c034b1b46d7d9227572c1d4ad3e to your computer and use it in GitHub Desktop.
Drop Jenkins Slaves
for (aSlave in hudson.model.Hudson.instance.slaves) {
println('====================');
println('Name: ' + aSlave.name);
println('getLabelString: ' + aSlave.getLabelString());
println('getNumExectutors: ' + aSlave.getNumExecutors());
println('getRemoteFS: ' + aSlave.getRemoteFS());
println('getMode: ' + aSlave.getMode());
println('getRootPath: ' + aSlave.getRootPath());
println('getComputer: ' + aSlave.getComputer());
println('\tcomputer.isAcceptingTasks: ' + aSlave.getComputer().isAcceptingTasks());
println('\tcomputer.isLaunchSupported: ' + aSlave.getComputer().isLaunchSupported());
println('\tcomputer.getConnectTime: ' + aSlave.getComputer().getConnectTime());
println('\tcomputer.getDemandStartMilliseconds: ' + aSlave.getComputer().getDemandStartMilliseconds());
println('\tcomputer.isOffline: ' + aSlave.getComputer().isOffline());
println('\tcomputer.countBusy: ' + aSlave.getComputer().countBusy());
if (aSlave.name.startsWith("ecs-htdev-jenkins-workers")) {
// println('Shutting down node!!!!');
// aSlave.getComputer().setTemporarilyOffline(true,null);
aSlave.getComputer().doDoDelete();
} else {
println('Leaving ' + aSlave.name)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment