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:59:09 UTC

[sling-tooling-jenkins] branch feature/parallel-builds updated (655638a -> f0dbc74)

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 655638a  shouldDeploy should be called once
     new f0dbc74  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   (655638a)
            \
             N -- N -- N   refs/heads/feature/parallel-builds (f0dbc74)

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[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 f0dbc7483a3f316be4b8b85666c293a3843f35cd
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Jun 15 11:50:00 2022 +0200

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

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 863c30b..8181b7e 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()
             }
         }
     }
@@ -68,14 +69,14 @@ def call(Map params = [:]) {
         helper.runWithErrorHandling(jobConfig, {
             // the reference build is always the first one, and the only one to deploy, archive artifacts, etc
             // usually this is the build done with the oldest JDK version, to ensure maximum compatibility
-            def isReferenceStage = true
+            boolean isReferenceStage = true
 
             // contains the label as key and a closure to execute as value
             def stepsMap = [:]
             def referenceJdkVersion
             // parallel execution of all build jobs
             jobConfig.jdks.each { jdkVersion -> 
-                stageDefinition = defineStage(globalConfig, jobConfig, jdkVersion, isReferenceStage)
+                stageDefinition = defineStage(globalConfig, jobConfig, jdkVersion, isReferenceStage, shouldDeploy)
                 if ( isReferenceStage ) {
                     referenceJdkVersion = jdkVersion
                 }
@@ -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, def 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