Last active
June 28, 2016 06:43
-
-
Save bchetty/132d442e0675b4774a3e698661a2d344 to your computer and use it in GitHub Desktop.
Cleanup workspace of all jobs in Jenkins - Ref: https://wiki.jenkins-ci.org/display/JENKINS/Wipe+out+workspaces+of+all+jobs
This file contains hidden or 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 hudson.model.* | |
// For each project | |
for(item in Hudson.instance.items) { | |
// check that job is not building | |
if(!item.isBuilding()) { | |
println("Wiping out workspace of job "+item.name) | |
item.doDoWipeOutWorkspace() | |
} | |
else { | |
println("Skipping job "+item.name+", currently building") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment