Since the job-dsl only creates at the root level I let a new view be created at the root level then wrote a Groovy script to move it.
I basically serialise both the existing view and the new view using the writeXml method on View. This strips out the owner. I then use XmlParser to add the correct owner back into the XML and attach the new view to the correct part of the existing nested view. I then delete both of the views and add the one I just constructed. On Wednesday, November 26, 2014 at 8:50:42 AM UTC+11, Rob Mandeville wrote: > I have a matrix of n projects building on m branches, and I am putting > together pipelines for each one. That is, there are a set of jobs of the > form “regression tests for branch FOO of project BAR”. I have a JSON file > showing the list of branches, projects, and their configurations. With > that, I’ve developed an intricate system to regenerate all the jobs with no > problem. Now, I just need to generate several dozen views. > > > > The hierarchy which I have been building by hand is: > > > > · (Nested View) Branch Builds > > o (Monitor View) All Builds for Branch FOO > > o (Monitor View) All Regression Tests for Branch FOO > > o (Nested View) Regression Pipelines for Branch FOO > > § (Build Pipeline View) Regression Pipeline for Branch FOO Project BAR > > § (Build Pipeline View) Regression Pipeline for Branch FOO Project QUX > > § … > > o (Build Pipeline View) Builds for Branch FOO Project BAR > > o (Build Pipeline View) Builds for Branch FOO Project QUX > > o … > > > > This is no longer scalable, and I’m wearing out my mouse button. > > > > I have been trying to use the Job DSL Plugin to handle this, to no avail. > It has no support for monitor views, and when I try to nest nested views > inside each other, the views all end up at the top level, making the tab > bar ridiculously long. > > > > Is there a plugin I can use, a technique you know of, or even a way to > insert views via XML without rebooting the Jenkins server? > > > > Thanks in advance, > > > > --Rob > > > > ------------------------------ > This e-mail and the information, including any attachments it contains, > are intended to be a confidential communication only to the person or > entity to whom it is addressed and may contain information that is > privileged. If the reader of this message is not the intended recipient, > you are hereby notified that any dissemination, distribution or copying of > this communication is strictly prohibited. If you have received this > communication in error, please immediately notify the sender and destroy > the original message. > > Thank you. > > Please consider the environment before printing this email. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7140dcea-8860-45db-a776-6c0c4c26cc98%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
job-dsl-add-new-nested-view-into-nested-views.groovy
Description: Binary data
job-dsl-nested-view.groovy
Description: Binary data
