Skip to content

Commit

Permalink
Quick-fix for release pipeline to work with Java 17 (openhab#1445)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfink committed Mar 5, 2023
1 parent 85b3667 commit b0e5590
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions launch/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]]])
Expand Down Expand Up @@ -95,46 +94,51 @@ 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
}

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
}
}
}
}
}
}
}

Expand Down

0 comments on commit b0e5590

Please sign in to comment.