How to get the XML definition for a view that is inside a folder?

Article ID:235534607
1 minute readKnowledge base

Issue

  • Is it possible to dump the view definition XML to stdout ? (The view is in the folder).

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.

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: