From bd1c93199afe4e69f2e3e556ec212a1ed87a6448 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 3 Feb 2016 19:22:43 -0500 Subject: [PATCH] Fix delete-all command to include all job types getProjects() only includes simple job types like Freestyle jobs but ignores more complex job types like Maven and Matrix jobs. This API is also marked as deprecated in Jenkins so we probably shouldn't be using it anyway. Instead switch to using getAllItems() which pulls down all job types. It is also possible to pass a parameter such as AbstractProjects or more specific to specify exactly which job types we want to remove. In this case though we want all of them so no need to pass any parameters. See: http://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html Change-Id: Ia4e37bc1d4bde70cf8f83783edd6b861eed6c2e3 Signed-off-by: Thanh Ha --- jenkins_jobs/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index e377f610f..6e257bba1 100644 --- a/jenkins_jobs/builder.py +++ b/jenkins_jobs/builder.py @@ -168,7 +168,7 @@ class Jenkins(object): def delete_all_jobs(self): # execute a groovy script to delete all jobs is much faster than # using the doDelete REST endpoint to delete one job at a time. - script = ('for(job in jenkins.model.Jenkins.theInstance.getProjects())' + script = ('for(job in jenkins.model.Jenkins.theInstance.getAllItems())' ' { job.delete(); }') self.jenkins.run_script(script)