diff options
author | Thanh Ha <thanh.ha@linuxfoundation.org> | 2016-02-03 19:22:43 -0500 |
---|---|---|
committer | Thanh Ha <thanh.ha@linuxfoundation.org> | 2016-02-03 19:25:47 -0500 |
commit | bd1c93199afe4e69f2e3e556ec212a1ed87a6448 (patch) | |
tree | 8da4f679d0b9042a611dc8bae307db53390d7249 /jenkins_jobs/builder.py | |
parent | 75127e5f84897150a61c23d8a608b89133b27e35 (diff) | |
download | python-jenkins-job-builder-bd1c93199afe4e69f2e3e556ec212a1ed87a6448.tar.gz python-jenkins-job-builder-bd1c93199afe4e69f2e3e556ec212a1ed87a6448.tar.xz python-jenkins-job-builder-bd1c93199afe4e69f2e3e556ec212a1ed87a6448.zip |
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 <thanh.ha@linuxfoundation.org>
Diffstat (limited to 'jenkins_jobs/builder.py')
-rw-r--r-- | jenkins_jobs/builder.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index e377f610..6e257bba 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) |