Hi,
   I am trying to create jenkins views (ListView) under a given view. I am 
able to create the view at the top level, but not able to find a way to 
create a view under a given view. I am using groovy to achieve this.Below 
is the use case:
1. I am using Nested View plugin to organize the jobs.
2. Leaf level views are the Jenkins ListView and all the jobs are placed 
under leaf level views.

In order to automate the view creation process, i want to create the leaf 
level views; to be more precise, i need ability to create views at a given 
level in a view hierarchy. I am able to create the views, but it always 
gets created at as the top level view. Below is the script i am working on 
for the same. Pls help:

import jenkins.model.* 

import hudson.model.ListView

import hudson.model.*

def name = '3_Pangaea_Platform'

def viewObj = Jenkins.instance.getView(name)

def parentObj = viewObj.getOwner()


parentObj.getViews().each { 

   if( it.name == '3_Pangaea_Platform'){

         println "found: " + it.name

it.getViews().each{

                if( it.name == "DevTools"){

                     // it.addView(new ListView('TestView'))

                      it.getViews().each{

                           println "DevTools: " + it.name

                           if(it.name == "1_Build_Triggers"){

                                  //it.addView(new ListView('TestView'))

                                  println "Parent Name: " + 
it.getOwner().name

                                  Jenkins.instance.addView(new 
ListView('Hello',it.getOwner()))

                                  it.getOwner().getViews().each{

                                   println "print view Name: " + it.name

                                  }

                           }

                      }

                }

 //println "found: " + it.name + it.getUrl()

}

 }

   //println "hello" + it.name;

  } 

 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to