Auto-generating a complex view setup

80 views
Skip to first unread message

Rob Mandeville

unread,
Nov 25, 2014, 4:50:42 PM11/25/14
to jenkins...@googlegroups.com, Rob Mandeville

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.
Message has been deleted

Paul Gorman

unread,
Jan 20, 2015, 12:00:34 AM1/20/15
to jenkins...@googlegroups.com, rmand...@dekaresearch.com
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.
job-dsl-add-new-nested-view-into-nested-views.groovy
job-dsl-nested-view.groovy

Kenneth Younger

unread,
Oct 26, 2015, 10:59:04 PM10/26/15
to Jenkins Users, rmand...@dekaresearch.com
I ran into this same problem, and stumbled onto a solution. You have to include the "view {}" block inside the each. I'm not a groovy expert, so I can't say why this works exactly, but it does prevent it from generating entirely separate nestedview definitions.


Hope that helps, even months later now. :)

-Kenny
Reply all
Reply to author
Forward
0 new messages