Skip to content

Instantly share code, notes, and snippets.

@eresende
Created July 18, 2018 11:52
Show Gist options
  • Save eresende/6362db3a34641e2bc343822581b6e201 to your computer and use it in GitHub Desktop.
Save eresende/6362db3a34641e2bc343822581b6e201 to your computer and use it in GitHub Desktop.
def busyExecutors = Jenkins.instance.computers
.collect {
c -> c.executors.findAll { it.isBusy() }
}
.flatten()
busyExecutors.each { e ->
if (e.getCurrentExecutable().getParent().getOwnerTask().getName() == "JobName") {
e.doStop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment