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/15 09:53:34 UTC

[sling-tooling-jenkins] branch feature/parallel-builds updated (1deb7a4 -> 3b4c084)

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

kwin pushed a change to branch feature/parallel-builds
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git


 discard 1deb7a4  shouldDeploy should be called once
     new 3b4c084  shouldDeploy should be called once

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1deb7a4)
            \
             N -- N -- N   refs/heads/feature/parallel-builds (3b4c084)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 vars/slingOsgiBundleBuild.groovy | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[sling-tooling-jenkins] 01/01: shouldDeploy should be called once

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/parallel-builds
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git

commit 3b4c084ed9aab4e5298c51385b1917d2f700263a
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Jun 15 11:50:00 2022 +0200

    shouldDeploy should be called once
---
 vars/slingOsgiBundleBuild.groovy | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 863c30b..f5b17f1 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -22,7 +22,7 @@ def call(Map params = [:]) {
         sonarQubeUseAdditionalMavenParams: true,
         sonarQubeAdditionalParams: ''
     ]
-    
+    boolean shouldDeploy = false
     node(globalConfig.mainNodeLabel) {
         timeout(time:5, unit: 'MINUTES') {
             stage('Init') {
@@ -38,6 +38,7 @@ def call(Map params = [:]) {
                     }
                 }
                 echo "Final job config: ${jobConfig}"
+                shouldDeploy = getShouldDeploy()
             }
         }
     }
@@ -100,7 +101,7 @@ def call(Map params = [:]) {
             parallel stepsMap
 
             // last stage is deploy
-            if ( shouldDeploy('deploy') ) {
+            if ( shouldDeploy ) {
                 node(globalConfig.mainNodeLabel) {
                     stage("Deploy to Nexus") {
                         deployToNexus()
@@ -126,7 +127,7 @@ def additionalMavenParams(def jobConfig) {
         branchConfig.additionalMavenParams : jobConfig.additionalMavenParams
 }
 
-def defineStage(def globalConfig, def jobConfig, def jdkVersion, def isReferenceStage) {
+def defineStage(def globalConfig, def jobConfig, String jdkVersion, boolean isReferenceStage, boolean shouldDeploy) {
 
     def goal = jobConfig.mavenGoal ? jobConfig.mavenGoal : ( isReferenceStage ? "deploy" : "verify" )
     def additionalMavenParams = additionalMavenParams(jobConfig)
@@ -134,13 +135,13 @@ def defineStage(def globalConfig, def jobConfig, def jdkVersion, def isReference
 
     // do not deploy artifacts built from PRs or feature branches
     // also do not deploy non-SNAPSHOT versions
-    if ( goal == "deploy" && ! shouldDeploy(goal) ) {
+    if ( goal == "deploy" && ! shouldDeploy ) {
         goal = "verify"
         echo "Maven goal set to ${goal} since branch is not master ( ${env.BRANCH_NAME} ) or version is not snapshot"
     }
 
     def invocation = {
-        if ( isReferenceStage && shouldDeploy(goal) ) {
+        if ( isReferenceStage && goal == "deploy" && shouldDeploy ) {
             String localRepoPath = "${env.WORKSPACE}/local-snapshots-dir"
             // Make sure the directory is wiped.
             dir(localRepoPath) {
@@ -162,7 +163,7 @@ def defineStage(def globalConfig, def jobConfig, def jdkVersion, def isReference
         if ( isReferenceStage && jobConfig.archivePatterns ) {
             archiveArtifacts(artifacts: SlingJenkinsHelper.jsonArrayToCsv(jobConfig.archivePatterns), allowEmptyArchive: true)
         }
-        if ( isReferenceStage && shouldDeploy(goal) ) {
+        if ( isReferenceStage && goal == "deploy" && shouldDeploy ) {
             // Stash the build results so we can deploy them on another node
             stash name: 'local-snapshots-dir', includes: 'local-snapshots-dir/**'
         }
@@ -247,14 +248,11 @@ def deployToNexus() {
     }
 }
 
-boolean shouldDeploy(String goal) {
+boolean getShouldDeploy() {
     // check branch name
     if ( !isOnMainBranch() ) {
         return false
     }
-    if (goal != 'deploy') {
-        return false
-    }
     // check version
     def mavenPom = readMavenPom()
     def mavenVersion = mavenPom.version ?: mavenPom.parent.version