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

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


The following commit(s) were added to refs/heads/master by this push:
     new 36ffc4b  SLING-8286 - Jenkins should not try and deploy release commits
36ffc4b is described below

commit 36ffc4b5fe8e64efde62f7410571c2f2192d0643
Author: Robert Munteanu <[email protected]>
AuthorDate: Thu Feb 21 14:22:56 2019 +0100

    SLING-8286 - Jenkins should not try and deploy release commits
    
    Improved attempt to restrict deployment of SNAPSHOT versions.
---
 vars/slingOsgiBundleBuild.groovy | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 8f524a8..844597e 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -107,8 +107,15 @@ 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" && ( env.BRANCH_NAME != "master" || 
!readMavenPom().version.endsWith('-SNAPSHOT') ) )
-        goal = "verify"
+    if ( goal == "deploy" ) {
+        def notMaster =  env.BRANCH_NAME != "master"
+        def mavenVersion = readMavenPom().version
+        def isSnapshot = mavenVersion.endsWith('-SNAPSHOT')
+        if ( notMaster || !isSnapshot ) {
+            goal = "verify"
+            echo "Maven goal set to ${goal} since branch is not master ( 
${env.BRANCH_NAME} ) or version is not snapshot ( ${mavenVersion} )"
+        }            
+    }
 
     def invocation = {
         withMaven(maven: globalConfig.mvnVersion, jdk: jenkinsJdkLabel,

Reply via email to