Removing all Jenkins slaves

Removing all Jenkins slaves with Groovy

10

Votes

for (aSlave in hudson.model.Hudson.instance.slaves) {
    if (aSlave.getComputer().isOffline()) {
       aSlave.getComputer().setTemporarilyOffline(true,null);
       aSlave.getComputer().doDoDelete();
     }
 }

Vote Here

You must earn at least 1 vote on your snippets to be allowed to vote

Terms Of Use

Privacy Policy

Featured snippets are MIT license

Gears & Masters

Advertise

DevOpsnipp.com © 2020

medium.png