This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git


The following commit(s) were added to refs/heads/feature/SLING-7245 by this 
push:
     new 6a6e2b6  SLING-7245 - Validate pull requests using Jenkins
6a6e2b6 is described below

commit 6a6e2b69a9b49382eb97c25c9716156ccdc5899e
Author: Robert Munteanu <[email protected]>
AuthorDate: Tue Dec 18 00:06:06 2018 +0100

    SLING-7245 - Validate pull requests using Jenkins
    
    Fix copying of overrides from the jenkins key in .sling-module.json and
    also obey the 'enabled' flag.
---
 vars/slingOsgiBundleBuild.groovy | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index b39eae9..f043833 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -29,27 +29,31 @@ def call(Map params = [:]) {
             if ( fileExists('.sling-module.json') ) {
                 overrides = readJSON file: '.sling-module.json'
                 echo "Jenkins overrides: ${overrides.jenkins}"
-                overrides.jenkins.each { entry ->
-                    buildDesc[entry] = entry;
+                overrides.jenkins.each { key,value ->
+                    buildDesc[key] = value;
                 }
             }
             echo "Final build config: ${buildDesc}"
         }
 
-        deploy = true
-        buildDesc.jdks.each { jdkVersion -> 
-            def goal = buildDesc.mavenGoal ? buildDesc.mavenGoal : ( deploy ? 
"deploy" : "verify" )
-            stage("Build (Java ${jdkVersion}, ${goal})") {
-                def jenkinsJdkLabel = availableJDKs[jdkVersion]
-                if ( !jenkinsJdkLabel )
-                    throw new RuntimeException("Unknown JDK version 
${jdkVersion}")
-                withMaven(maven: mvnVersion, jdk: jenkinsJdkLabel ) {
-                   dir(moduleDir) {
-                        sh "mvn clean ${goal}"
+        if ( buildDesc.enabled ) {
+            deploy = true
+            buildDesc.jdks.each { jdkVersion -> 
+                def goal = buildDesc.mavenGoal ? buildDesc.mavenGoal : ( 
deploy ? "deploy" : "verify" )
+                stage("Build (Java ${jdkVersion}, ${goal})") {
+                    def jenkinsJdkLabel = availableJDKs[jdkVersion]
+                    if ( !jenkinsJdkLabel )
+                        throw new RuntimeException("Unknown JDK version 
${jdkVersion}")
+                    withMaven(maven: mvnVersion, jdk: jenkinsJdkLabel ) {
+                    dir(moduleDir) {
+                            sh "mvn clean ${goal} ${additionalMavenParams}"
+                        }
                     }
                 }
+                deploy = false
             }
-            deploy = false
+        } else {
+            echo "Build is disabled, not building"
         }
     }
 }
\ No newline at end of file

Reply via email to