Environment
-
Jenkins
-
Jenkins LTS
-
CloudBees Jenkins Enterprise (CJE)
-
CloudBees Jenkins Operation Center (CJOC)
-
CloudBees Folders Plugin
Resolution
In order to get the information of one or more views inside a folder you should use the Jenkins Script Console. For that you should navigate to Manage Jenkins -→ Script Console, and run the following script.
import com.cloudbees.hudson.plugins.folder.* jen = Jenkins.instance jen.getItems().each{ if(it instanceof Folder){ println "Folder found" processFolder(it) } if(it instanceof View){ println "View found"+ it.name } } return void processFolder(Item folder){ def buf = new ByteArrayOutputStream() def newOut = new PrintStream(buf) def saveOut = System.out def viewNameList = [] folder.getItems().each{ println "processing..." + folder.name folder.getViews().each(){ if(it instanceof View && it.name != "All") { if(!(it.name in viewNameList)){ viewNameList << it.name println "View " + it.name it.writeXml(buf) } } } println buf.toString() println " " } }
This script uses a very simple approach, and gets all the elements existing at root level for your instance, and if the element is a folder, it processes all the views included in it (except for the All view). It is quite straightforward to extend the script in a way that you can process recursively all the elements, or to get the information only for views matching a given pattern or inside a given folder.
See also: