Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clear jenkins view with jobs
import hudson.model.ListView
import jenkins.model.*
//Parameters: In case you are running this outside Scriptler, please uncomment and fill the following line.
view_name = "ViewName";
vc = Jenkins.instance.getView(view_name).getOwner();
v = vc.getView(view_name);
//delete jobs belonging to the view
for(view in v.getItems()) {
print "removing $view \n"
view.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