Created
December 11, 2017 07:54
-
-
Save gokart23/91a0e7b5c9676d847992106b58b3fc76 to your computer and use it in GitHub Desktop.
Delete slaves with a certain label directly from Jenkins master script console
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
import hudson.slaves.* | |
import hudson.model.* | |
for (aSlave in hudson.model.Hudson.instance.slaves) { | |
if (aSlave.name.indexOf("medium-rt-framework") == 0 && !aSlave.getComputer().isOnline()) { | |
aSlave.getComputer().setTemporarilyOffline(true, null) | |
aSlave.getComputer().doDoDelete() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment