You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2022/06/21 07:06:38 UTC

[sling-tooling-jenkins] 01/01: SLING-11401 properly isolate workspace directories

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

kwin pushed a commit to branch bugfix/isolate-workspaces
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git

commit 20af77b1afbb82d0c562668f43ef9be02d24eb10
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Jun 21 09:06:31 2022 +0200

    SLING-11401 properly isolate workspace directories
---
 vars/slingOsgiBundleBuild.groovy | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index c7b4488..1c0e4d3 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -78,7 +78,7 @@ def call(Map params = [:]) {
                 if ( isReferenceStage ) {
                     referenceJdkVersion = jdkVersion
                 }
-                stepsMap["Build (Java ${jdkVersion})"] = stageDefinition.call()
+                stepsMap["Build (Java ${jdkVersion})"] = stageDefinition
                 isReferenceStage = false
                 currentBuild.result = "SUCCESS"
             }
@@ -178,8 +178,11 @@ def defineStage(def globalConfig, def jobConfig, def jdkVersion, boolean isRefer
     def branchConfig = jobConfig?.branches?."$env.BRANCH_NAME" ?: [:]
 
     return {
-        wrapInNode(branchConfig.nodeLabel ?: globalConfig.mainNodeLabel, {
+        node(nodeLabel: branchConfig.nodeLabel ?: globalConfig.mainNodeLabel,
+            customWorkspace: jenkinsJdkLabel // isolate parallel builds on same node
+            ) {
             timeout(time: 30, unit: 'MINUTES') {
+                checkout scm
                 stage("Maven Build (Java ${jdkVersion}, ${goal})") {
                     echo "Running on node ${env.NODE_NAME}"
                     invocation.call()
@@ -278,12 +281,3 @@ boolean getShouldDeploy() {
 boolean isOnMainBranch() {
     return env.BRANCH_NAME == 'master'
 }
-
-def wrapInNode(def nodeLabel, Closure invocation) {
-    return {
-        node(nodeLabel) {
-            checkout scm
-            invocation.call()
-        }
-    }
-}