Last active
September 24, 2020 17:07
-
-
Save paladin-dranser/02fe0f32a4bd04ccf843df7fcae759b2 to your computer and use it in GitHub Desktop.
Jenkins: Groovy script to delete empty views
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
/** | |
* This script deletes empty views | |
*/ | |
import jenkins.model.Jenkins | |
import hudson.model.View | |
Jenkins instance = Jenkins.get() | |
ArrayList<View> views = instance.getViews() | |
views.each { View view -> | |
if (!view.items) { | |
instance.deleteView(view) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment