Skip to content

Instantly share code, notes, and snippets.

@imoutsatsos
Created March 9, 2023 22:26
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 imoutsatsos/f276fd17a4b79d2831d950c5279496a1 to your computer and use it in GitHub Desktop.
Save imoutsatsos/f276fd17a4b79d2831d950c5279496a1 to your computer and use it in GitHub Desktop.
/*
Execute from the Jenkins script console
to delete offline Jenkins nodes
taken from answer at https://stackoverflow.com/a/48438012/2612175
*/
for (aSlave in hudson.model.Hudson.instance.slaves) {
if (aSlave.getComputer().isOffline()) {
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