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

sjaranowski pushed a commit to branch jenkins-deploy-master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 03ff4f86f0117bb0612c17aa379f218af71c1b37
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Fri Dec 31 16:57:54 2021 +0100

    Deploy artifacts only for master branch
---
 Jenkinsfile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 2ef2b4a..1fad09e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,7 +36,7 @@ final def jdks = [18, 17, 8]
 
 final def options = ['-e', '-V', '-B', '-nsu', '-P', 'run-its']
 final def goals = ['clean', 'install']
-final def goalsDepl = ['clean', 'deploy', 'jacoco:report']
+final def goalsDepl = ['clean', 'deploy']
 final Map stages = [:]
 
 oses.eachWithIndex { osMapping, indexOfOs ->
@@ -69,7 +69,7 @@ oses.eachWithIndex { osMapping, indexOfOs ->
                             allOptions += '--no-transfer-progress'
                         }
                         ws(dir: "${os == 'windows' ? "${TEMP}\\${BUILD_TAG}" : 
pwd()}") {
-                            buildProcess(stageKey, jdkName, mvnName, first ? 
goalsDepl : goals, allOptions, mavenOpts, first)
+                            buildProcess(stageKey, jdkName, mvnName, 
allOptions, mavenOpts, first)
                         }
                     }
                 }
@@ -113,7 +113,7 @@ timeout(time: 12, unit: 'HOURS') {
     }
 }
 
-def buildProcess(String stageKey, String jdkName, String mvnName, goals, 
options, mavenOpts, boolean makeReports) {
+def buildProcess(String stageKey, String jdkName, String mvnName, options, 
mavenOpts, boolean first) {
     cleanWs()
     def errorStatus = -99
     try {
@@ -129,8 +129,10 @@ def buildProcess(String stageKey, String jdkName, String 
mvnName, goals, options
         println "Maven Local Repository = ${mvnLocalRepoDir}."
         assert mvnLocalRepoDir != null : 'Local Maven Repository is undefined.'
 
-        def properties = ["-Djacoco.skip=${!makeReports}", 
"\"-Dmaven.repo.local=${mvnLocalRepoDir}\""]
-        def cmd = ['mvn'] + goals + options + properties
+        def properties = ["-Djacoco.skip=${!first}", 
"\"-Dmaven.repo.local=${mvnLocalRepoDir}\""]
+        def cmd = ['mvn'] + ( first && env.BRANCH_NAME == 'master' ? goalsDepl 
: goals ) + options + properties
+
+        println "cmd=" + cmd
 
         stage("build ${stageKey}") {
 
@@ -166,7 +168,7 @@ def buildProcess(String stageKey, String jdkName, String 
mvnName, goals, options
         }
     } finally {
         try {
-            if (makeReports) {
+            if (first) {
                 jacoco(changeBuildStatus: false,
                         execPattern: '**/*.exec',
                         sourcePattern: sourcesPatternCsv(),

Reply via email to