Last active
June 21, 2022 04:11
-
-
Save obcode/63d9ddd7a239c9f3b020 to your computer and use it in GitHub Desktop.
Jenkins - Deletes all jobs in a view and the view
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.ListView | |
| import jenkins.model.* | |
| // Begin Parameters | |
| view_name = "braun-sweng"; | |
| // End Parameters | |
| vc = Jenkins.instance.getView(view_name).getOwner(); | |
| v = vc.getView(view_name); | |
| for(job in v.getItems()) { | |
| print "removing $job \n" | |
| job.delete(); | |
| } | |
| vc.deleteView(v); | |
| print "$view_name removed \n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment