Skip to content

Instantly share code, notes, and snippets.

@meg23
Forked from nehaljwani/del_offline_slaves.groovy
Created August 17, 2016 16:05
Show Gist options
  • Save meg23/3a21d98e166a1865f09e73c9dce658f7 to your computer and use it in GitHub Desktop.
Save meg23/3a21d98e166a1865f09e73c9dce658f7 to your computer and use it in GitHub Desktop.
Jenkins: Delete offline slaves
import jenkins.model.Jenkins
println "Cleaning up offline slaves..."
Jenkins.instance.slaves.each {
if(it.getComputer().isOffline()) {
println "Deleting ${it.name}"
it.getComputer().doDoDelete()
}
}
println "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment