Created
April 22, 2017 02:25
-
-
Save nrshrivatsan/6eb19c56ac390fd82aee50910a8eb171 to your computer and use it in GitHub Desktop.
Jenkins-delete-all-jobs : Groovyscript
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.* | |
disableChildren(Hudson.instance.items) | |
def disableChildren(items) { | |
for (item in items) { | |
if (item.class.canonicalName == 'com.cloudbees.hudson.plugins.folder.Folder') { | |
disableChildren(((com.cloudbees.hudson.plugins.folder.Folder) item).getItems()) | |
} else if (item.class.canonicalName != 'org.jenkinsci.plugins.workflow.job.WorkflowJob') { | |
println("Deleating job:\t"+item.name) | |
item.delete() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment