diff --git a/launch/Jenkinsfile b/launch/Jenkinsfile index cc0a3c75c3..adaa7fed1a 100644 --- a/launch/Jenkinsfile +++ b/launch/Jenkinsfile @@ -63,7 +63,6 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion, resetOpenhabFork(gitBaseUrl, componentName, releaseVersion) withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIALS_ID, passwordVariable: 'githubPassword', usernameVariable: 'githubUser')]) { - withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { dir(componentName) { deleteDir() checkout([$class: 'GitSCM', branches: [[name: '*/' + branch]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: branch], [$class: 'CloneOption', depth: 0, noTags: true, reference: '', shallow: false], [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: false, recursiveSubmodules: true, reference: '', trackingSubmodules: true]], submoduleCfg: [], userRemoteConfigs: [[url: gitRepoUrl ]]]) @@ -95,23 +94,25 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion, stage(componentName + ": Release") { writeUnleashWorkflows() + withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { + //Set release versions + if(updateProperties) { + sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions + sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions + } + if(updateParent) { + sh "mvn versions:update-parent -DparentVersion=[" + env.OH_RELEASE_VERSION +"] " + mvnOptions + } - //Set release versions - if(updateProperties) { - sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions - sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions + sh "mvn unleash:perform -Dworkflow=unleash.phase1.workflow " + mvnOptions } - if(updateParent) { - sh "mvn versions:update-parent -DparentVersion=[" + env.OH_RELEASE_VERSION +"] " + mvnOptions + withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { + sh "mvn deploy " + mvnReleaseOptions + } + withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { + //Tag SCM + sh "mvn unleash:perform -Dworkflow=unleash.phase2.workflow " + mvnOptions } - - sh "mvn unleash:perform -Dworkflow=unleash.phase1.workflow " + mvnOptions - - sh "mvn deploy " + mvnReleaseOptions - - //Tag SCM - sh "mvn unleash:perform -Dworkflow=unleash.phase2.workflow " + mvnOptions - //Prevent wrong scm tag from being checked in sh 'git reset --hard ' + branch } @@ -119,22 +120,25 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion, stage(componentName + ": Prepare next version") { //Set next development versions if(!releaseVersion.startsWith(nextVersion)) { - if(updateParent) { - sh "mvn versions:update-parent -DallowSnapshots=true -DparentVersion=[" + env.OH_NEXT_VERSION +"-SNAPSHOT] " + mvnOptions - } - if(updateProperties) { - sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions - sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions - sh "mvn versions:set-property -Dproperty=repo.version -DnewVersion="+ env.OH_NEXT_VERSION.replace('[0-9]$', 'x ') + mvnOptions - } + withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { - sh "mvn unleash:perform -Dworkflow=unleash.phase3.workflow " + mvnOptions + if(updateParent) { + sh "mvn versions:update-parent -DallowSnapshots=true -DparentVersion=[" + env.OH_NEXT_VERSION +"-SNAPSHOT] " + mvnOptions + } + if(updateProperties) { + sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions + sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions + sh "mvn versions:set-property -Dproperty=repo.version -DnewVersion="+ env.OH_NEXT_VERSION.replace('[0-9]$', 'x ') + mvnOptions + } - sh "mvn deploy " + mvnSnapshotOptions + sh "mvn unleash:perform -Dworkflow=unleash.phase3.workflow " + mvnOptions + } + withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) { + sh "mvn deploy " + mvnSnapshotOptions + } } } } - } } }