Last active
December 16, 2015 11:09
-
-
Save miyakawataku/5425774 to your computer and use it in GitHub Desktop.
Cleans up Jenkins EC2 slaves which have failed to launch. Use this script as a system groovy script with Groovy Plugin.
This file contains 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 jenkins.model.Jenkins | |
import hudson.slaves.OfflineCause | |
for (node in Jenkins.instance.getNodes()) { | |
computer = node.toComputer() | |
if (computer.getOfflineCause() instanceof OfflineCause.LaunchFailed) { | |
node.terminate() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment