Skip to content

Commit 03ebbe6

Browse files
committed
Adjust syntax of subviews of nestedView, JENKINS-27462
1 parent d3e0132 commit 03ebbe6

File tree

8 files changed

+360
-75
lines changed

8 files changed

+360
-75
lines changed

docs/Home.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Have a look at the [Jenkins Job DSL Gradle example](https://github.com/sheehan/j
3434
* Enhanced support for the [Maven Project Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Maven+Project+Plugin)
3535
* The enum argument of `localRepository` for the Maven job and context has changed, see [[Migration]]
3636
* Support for the older versions of the [Multijob Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin) is deprecated, see [[Migration]]
37+
* The views closure of the nested view type has been changed, see [[Migration]]
3738
* 1.30 (March 08 2015)
3839
* Added support for [Custom Tools Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Custom+Tools+Plugin)
3940
* Added support for [Flaky Test Handler Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Flaky+Test+Handler+Plugin)

docs/Migration.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
## Migrating to 1.31
22

3+
### Nested Views
4+
5+
The views closure of the nested view type has been changed to use the same method signatures than the top-level factory
6+
methods.
7+
8+
DSL prior to 1.31
9+
```groovy
10+
nestedView('project-a') {
11+
views {
12+
view('overview') {
13+
}
14+
view('pipeline', type: BuildPipelineView) {
15+
}
16+
}
17+
}
18+
```
19+
20+
DSL since 1.31
21+
```groovy
22+
nestedView('project-a') {
23+
views {
24+
listView('overview') {
25+
}
26+
buildPipelineView('pipeline') {
27+
}
28+
}
29+
}
30+
```
31+
332
### MultiJob Plugin
433

534
Support for version 1.15 and earlier of the MultiJob Plugin is [[deprecated|Deprecation-Policy]] and will be removed.

docs/View-Reference.md

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Create a view that can be divided into sections. Details about the options can b
142142
[Sectioned View Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Sectioned+View+Plugin).
143143

144144
```groovy
145-
sectionedView('project-summary', type: SectionedView) {
145+
sectionedView('project-summary') {
146146
filterBuildQueue()
147147
filterExecutors()
148148
sections {
@@ -195,7 +195,13 @@ nestedView(String name) { // since 1.30
195195
196196
// nested view options
197197
views {
198-
view(Map<String, Object> arguments = [:], String name, Closure viewClosure) // since 1.30
198+
listView(String name, Closure closure = null) // since 1.30
199+
sectionedView(String name, Closure closure = null) // since 1.30
200+
nestedView(String name, Closure closure = null) // since 1.30
201+
deliveryPipelineView(String name, Closure closure = null) // since 1.30
202+
buildPipelineView(String name, Closure closure = null) // since 1.30
203+
buildMonitorView(String name, Closure closure = null) // since 1.30
204+
view(Map<String, Object> arguments = [:], String name, Closure viewClosure) // since 1.30, deprecated since 1.31
199205
view(Map<String, Object> arguments = [:], Closure viewClosure) // deprecated since 1.30
200206
}
201207
columns {
@@ -212,7 +218,7 @@ the [Nested View Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Nested+View
212218
```groovy
213219
nestedView('project-a') {
214220
views {
215-
view('overview') {
221+
listView('overview') {
216222
jobs {
217223
regex('project-A-.*')
218224
}
@@ -224,7 +230,7 @@ nestedView('project-a') {
224230
lastFailure()
225231
}
226232
}
227-
view('pipeline', type: BuildPipelineView) {
233+
buildPipelineView('pipeline') {
228234
selectedJob('project-a-compile')
229235
}
230236
}
@@ -307,7 +313,7 @@ about the options can be found below. Similar to jobs, the view DSL can be exten
307313
[[configure block|The Configure Block]].
308314

309315
```groovy
310-
buildMonitorView('project-A', type: BuildMonitorView) {
316+
buildMonitorView('project-A') {
311317
description('All jobs for project A')
312318
jobs {
313319
name('release-projectA')
@@ -417,7 +423,7 @@ jobs {
417423
### Job Filters
418424

419425
```groovy
420-
view(type: ListView) {
426+
listView {
421427
jobFilters {
422428
regex {
423429
matchType(MatchType matchType) // what to do with matching Jobs
@@ -443,7 +449,7 @@ Possible values for `matchType` are `MatchType.INCLUDE_MATCHED`, `MatchType.INCL
443449
`Status.UNSTABLE`, `Status.FAILED`, `Status.ABORTED`, `Status.DISABLED` or `Status.STABLE`.
444450

445451
```groovy
446-
view('example', type: ListView) {
452+
listView('example') {
447453
jobFilters {
448454
regex {
449455
matchType(MatchType.EXCLUDE_MATCHED)
@@ -636,7 +642,7 @@ startsWithParameters()
636642
### List View Section
637643

638644
```groovy
639-
view(type: SectionedView) {
645+
sectionedView {
640646
sections {
641647
listView {
642648
name(String name) // name of the section
@@ -654,7 +660,7 @@ Creates a section containing a list of jobs. Width defaults to `FULL` and alignm
654660
specified.
655661

656662
```groovy
657-
view('example', type: SectionedView) {
663+
sectionedView('example') {
658664
sections {
659665
listView {
660666
name('project-A')
@@ -680,9 +686,15 @@ view('example', type: SectionedView) {
680686
### Views
681687

682688
```groovy
683-
view(type: NestedView) {
689+
nestedView {
684690
views {
685-
view(Map<String, Object> arguments = [:], String name, Closure viewClosure) // since 1.30
691+
listView(String name, Closure closure = null) // since 1.30
692+
sectionedView(String name, Closure closure = null) // since 1.30
693+
nestedView(String name, Closure closure = null) // since 1.30
694+
deliveryPipelineView(String name, Closure closure = null) // since 1.30
695+
buildPipelineView(String name, Closure closure = null) // since 1.30
696+
buildMonitorView(String name, Closure closure = null) // since 1.30
697+
view(Map<String, Object> arguments = [:], String name, Closure viewClosure) // since 1.30, deprecated since 1.31
686698
view(Map<String, Object> arguments = [:], Closure viewClosure) // deprecated since 1.30
687699
}
688700
}
@@ -691,9 +703,9 @@ view(type: NestedView) {
691703
Creates the nested views. The view methods works like the top-level view method.
692704

693705
```groovy
694-
view('example-1', type: NestedView) {
706+
nestedView('example-1') {
695707
views {
696-
view('overview') {
708+
listView('overview') {
697709
jobs {
698710
regex('project-A-.*')
699711
}
@@ -702,7 +714,7 @@ view('example-1', type: NestedView) {
702714
name()
703715
}
704716
}
705-
view('pipeline', type: BuildPipelineView) {
717+
buildPipelineView('pipeline') {
706718
selectedJob('project-a-compile')
707719
}
708720
}
@@ -712,7 +724,7 @@ view('example-1', type: NestedView) {
712724
### Columns
713725

714726
```groovy
715-
view(type: NestedView) {
727+
nestedView {
716728
columns {
717729
status()
718730
weather()
@@ -727,23 +739,23 @@ Adds columns to the view. Only the status and weather column are supported.
727739
### Pipeline Instances
728740

729741
```groovy
730-
view(type: DeliveryPipelineView) {
742+
deliveryPipelineView {
731743
pipelineInstances(int number)
732744
}
733745
```
734746

735747
Number of pipelines instances showed for each pipeline. Optional, defaults to 3 if omitted.
736748

737749
```groovy
738-
view('example', type: DeliveryPipelineView) {
750+
deliveryPipelineView('example') {
739751
pipelineInstances(5)
740752
}
741753
```
742754

743755
### Aggregated Pipeline
744756

745757
```groovy
746-
view(type: DeliveryPipelineView) {
758+
deliveryPipelineView {
747759
showAggregatedPipeline(boolean showAggregatedPipeline = true)
748760
}
749761
```
@@ -752,31 +764,31 @@ Show a aggregated view where each stage shows the latest version being executed.
752764
omitted.
753765

754766
```groovy
755-
view('example', type: DeliveryPipelineView) {
767+
deliveryPipelineView('example') {
756768
showAggregatedPipeline()
757769
}
758770
```
759771

760772
### Columns
761773

762774
```groovy
763-
view(type: DeliveryPipelineView) {
775+
deliveryPipelineView {
764776
columns(int number)
765777
}
766778
```
767779

768780
Number of columns used for showing pipelines. Optional, defaults to 1 if omitted.
769781

770782
```groovy
771-
view('example', type: DeliveryPipelineView) {
783+
deliveryPipelineView('example') {
772784
columns(2)
773785
}
774786
```
775787

776788
### Sorting
777789

778790
```groovy
779-
view(type: DeliveryPipelineView) {
791+
deliveryPipelineView {
780792
sorting(Sorting sorting)
781793
}
782794
```
@@ -785,79 +797,79 @@ Specifies how to sort the pipeline in the view, only applicable for several pipe
785797
`Sorting.NONE`, `Sorting.TITLE` and `Sorting.LAST_ACTIVITY`. Optional, defaults to `Sorting.NONE` if omitted.
786798

787799
```groovy
788-
view('example', type: DeliveryPipelineView) {
800+
deliveryPipelineView('example') {
789801
sorting(Sorting.TITLE)
790802
}
791803
```
792804

793805
### Avatars
794806

795807
```groovy
796-
view(type: DeliveryPipelineView) {
808+
deliveryPipelineView {
797809
showAvatars(boolean showAvatars = true)
798810
}
799811
```
800812

801813
Show avatar pictures instead of user names. Optional, defaults to `false` if omitted.
802814

803815
```groovy
804-
view('example', type: DeliveryPipelineView) {
816+
deliveryPipelineView('example') {
805817
showAvatars()
806818
}
807819
```
808820

809821
### Update Interval
810822

811823
```groovy
812-
view(type: DeliveryPipelineView) {
824+
deliveryPipelineView {
813825
updateInterval(int seconds)
814826
}
815827
```
816828

817829
Specifies how often the view will be updated. Optional, defaults to 2 if omitted.
818830

819831
```groovy
820-
view('example', type: DeliveryPipelineView) {
832+
deliveryPipelineView('example') {
821833
updateInterval(60)
822834
}
823835
```
824836

825837
### Manual Triggers
826838

827839
```groovy
828-
view(type: DeliveryPipelineView) {
840+
deliveryPipelineView {
829841
enableManualTriggers(boolean enable = true)
830842
}
831843
```
832844

833845
Show a button if a task is manual. Optional, defaults to `false` if omitted.
834846

835847
```groovy
836-
view('example', type: DeliveryPipelineView) {
848+
deliveryPipelineView('example') {
837849
enableManualTriggers()
838850
}
839851
```
840852

841853
### Change Log
842854

843855
```groovy
844-
view(type: DeliveryPipelineView) {
856+
deliveryPipelineView {
845857
showChangeLog(boolean showChangeLog = true)
846858
}
847859
```
848860

849861
Show SCM change log for the first job in the pipeline. Optional, defaults to `false` if omitted.
850862

851863
```groovy
852-
view('example', type: DeliveryPipelineView) {
864+
deliveryPipelineView('example') {
853865
showChangeLog()
854866
}
855867
```
856868

857869
### Pipelines
858870

859871
```groovy
860-
view(type: DeliveryPipelineView) {
872+
deliveryPipelineView {
861873
pipelines {
862874
component(String name, String initialJob)
863875
regex(String regex)
@@ -869,14 +881,14 @@ Defines pipelines by either specifying names and start jobs or by regular expres
869881
multiple times to add different pipelines to the view.
870882

871883
```groovy
872-
view('example-1', type: DeliveryPipelineView) {
884+
deliveryPipelineView('example-1') {
873885
pipelines {
874886
component('Sub System A', 'compile-a')
875887
component('Sub System B', 'compile-b')
876888
}
877889
}
878890
879-
view('example-2', type: DeliveryPipelineView) {
891+
deliveryPipelineView('example-2') {
880892
pipelines {
881893
regex(/compile-(.*)/)
882894
}

0 commit comments

Comments
 (0)