Skip to content

Instantly share code, notes, and snippets.

@AtnNn
Created January 20, 2020 17:45
Show Gist options
  • Save AtnNn/9e29fc8515d659454ef99b5300369666 to your computer and use it in GitHub Desktop.
Save AtnNn/9e29fc8515d659454ef99b5300369666 to your computer and use it in GitHub Desktop.
Jenkins groovy script; run command on each slave
// Run from https://jenkins/script
import hudson.util.RemotingDiagnostics;
cmd = 'def proc = ["conan", "--version"].execute(); proc.waitFor(); println proc.in.text';
for (slave in hudson.model.Hudson.instance.slaves) {
if (slave.name ==~ /^build-slave[0-9]/) {
println slave.name;
println RemotingDiagnostics.executeGroovy(cmd, slave.getChannel());
}
}
@AtnNn
Copy link
Author

AtnNn commented Dec 16, 2020

Delete folders:

println new File("c:\\path").deleteDir()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment