You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2018/12/18 09:46:20 UTC

[sling-tooling-jenkins] 02/02: SLING-7245 - Validate pull requests using Jenkins

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

commit ab91e3c899454ef65d88db5de7595d5b1708e0a1
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Dec 18 00:06:06 2018 +0100

    SLING-7245 - Validate pull requests using Jenkins
    
    Start parsing .sling-module.xml
---
 vars/slingOsgiBundleBuild.groovy | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index cea544b..92ee5ec 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -1,20 +1,39 @@
 def call(Map params = [:]) {
     def availableJDKs = [ 8: 'JDK 1.8 (latest)', 9: 'JDK 1.9 (latest)']
-    
-    def moduleDir = params.containsKey('moduleDir') ? params.moduleDir : '.'
     def mvnVersion = 'Maven 3.3.9'
-    def jdkVersions = [8, 9]
+    // defaults for the build
+    def buildDesc = {
+        jdks: [8],
+        downstreamProjects: [],
+        archivePatterns: [],
+        mavenGoal: 'install',
+        additionalMavenParams: '',
+        rebuildFrequency: '@weekly',
+        enableXvfb: false,
+        enabled: true
+    }
+
+    def moduleDir = params.containsKey('moduleDir') ? params.moduleDir : '.'
 
     node('ubuntu') {
 
         checkout scm
 
         stage('Init') {
-            def overrides = readFile('.sling-module.xml')
-            echo "Got overrides ${overrides}"
+            if ( fileExists('.sling-module.xml') ) {
+                def overrides = readFile('.sling-module.xml')
+                def slingMod = new XmlParser().parse(overrides)
+                if ( slingMod?.jenkins?.jdks ) {
+                    def jdks = []
+                    slingMod.jenkins.jdks.jdk.each { jdks.add it.text() }
+                    buildDesc.jdks = jdks
+
+                    echo "$Overriding JDKs list to be ${jdks}"
+                }
+            }
         }
 
-        jdkVersions.each { jdkVersion -> 
+        buildDesc.jdks.each { jdkVersion -> 
             stage("Build (Java ${jdkVersion})") {
                 def jenkinsJdkLabel = availableJDKs[jdkVersion]
                 if ( !jenkinsJdkLabel )