From 61ff541810b6cd0994294015fbfd43ac29c3df13 Mon Sep 17 00:00:00 2001
From: Kamil Szymanski <kamil.szymanski.dev@gmail.com>
Date: Mon, 7 Aug 2017 11:48:53 +0200
Subject: [PATCH] enchance support for delivery pipeline view

---
 docs/Home.md                                  |  2 +
 .../dsl/views/DeliveryPipelineView.groovy     | 37 +++++++++++++++++++
 .../dsl/views/DeliveryPipelineViewSpec.groovy |  8 +++-
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/docs/Home.md b/docs/Home.md
index 863bcfb65..41b653219 100755
--- a/docs/Home.md
+++ b/docs/Home.md
@@ -29,6 +29,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
 
 ## Release Notes
 * 1.65 (unreleased)
+  * Enhanced support for the
+    [Delivery Pipeline Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Delivery+Pipeline+Plugin)
 * 1.64 (July 07 2017)
   * Increased the minimum supported Java version to JDK 7
   * Increased the minimum supported Jenkins version to 2.19
diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineView.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineView.groovy
index 464d9776f..175606fb7 100644
--- a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineView.groovy
+++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineView.groovy
@@ -193,6 +193,43 @@ class DeliveryPipelineView extends View {
         }
     }
 
+    /**
+     * Show analysis results from
+     * <a href="https://wiki.jenkins.io/display/JENKINS/Analysis+Collector+Plugin">Analysis Collector Plugin</a>.
+     * Defaults to {@code false}.
+     *
+     * @since 1.65
+     */
+    void showStaticAnalysisResults(boolean value = true) {
+        configure {
+            it / methodMissing('showStaticAnalysisResults', value)
+        }
+    }
+
+    /**
+     * Use relative links for jobs in pipeline view.
+     * Defaults to {@code false}.
+     *
+     * @since 1.65
+     */
+    void useRelativeLinks(boolean value = true) {
+        configure {
+            it / methodMissing('linkRelative', value)
+        }
+    }
+
+    /**
+     * Link jobs in pipeline view directly to the console log.
+     * Defaults to {@code false}.
+     *
+     * @since 1.65
+     */
+    void linkToConsoleLog(boolean value = true) {
+        configure {
+            it / methodMissing('linkToConsoleLog', value)
+        }
+    }
+
     /**
      * Defines pipelines by either specifying names and start jobs or by regular expressions. Both variants can be
      * called multiple times to add different pipelines to the view.
diff --git a/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineViewSpec.groovy b/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineViewSpec.groovy
index 2d7efa0e4..e6fe774b5 100644
--- a/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineViewSpec.groovy
+++ b/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/views/DeliveryPipelineViewSpec.groovy
@@ -58,7 +58,10 @@ class DeliveryPipelineViewSpec extends Specification {
             showDescription()
             showPromotions()
             enablePaging()
-            showTestResults(true)
+            showTestResults()
+            showStaticAnalysisResults()
+            useRelativeLinks()
+            linkToConsoleLog()
             useTheme('foo')
 
             pipelines {
@@ -121,6 +124,9 @@ class DeliveryPipelineViewSpec extends Specification {
     <showPromotions>true</showPromotions>
     <pagingEnabled>true</pagingEnabled>
     <showTestResults>true</showTestResults>
+    <showStaticAnalysisResults>true</showStaticAnalysisResults>
+    <linkRelative>true</linkRelative>
+    <linkToConsoleLog>true</linkToConsoleLog>
     <theme>foo</theme>
     <componentSpecs>
         <se.diabol.jenkins.pipeline.DeliveryPipelineView_-ComponentSpec>