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:50:04 UTC
[sling-tooling-jenkins] branch feature/parallel-builds updated: shouldDeploy should be called once
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
The following commit(s) were added to refs/heads/feature/parallel-builds by this push:
new 61f319d shouldDeploy should be called once
61f319d is described below
commit 61f319d9d019e092f3e9c47d3057e01ee4096db1
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..6aa4f8b 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 = shouldDeploy()
}
}
}
@@ -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 shouldDeploy() {
// check branch name
if ( !isOnMainBranch() ) {
return false
}
- if (goal != 'deploy') {
- return false
- }
// check version
def mavenPom = readMavenPom()
def mavenVersion = mavenPom.version ?: mavenPom.parent.version