Skip to content

Commit e19ab04

Browse files
committed
Quick-fix for release pipeline to work with Java 17 (openhab#1445)
Signed-off-by: Patrick Fink <[email protected]>
1 parent 85b3667 commit e19ab04

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

launch/Jenkinsfile

+30-26
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion,
6363
resetOpenhabFork(gitBaseUrl, componentName, releaseVersion)
6464

6565
withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIALS_ID, passwordVariable: 'githubPassword', usernameVariable: 'githubUser')]) {
66-
withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) {
6766
dir(componentName) {
6867
deleteDir()
6968
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,46 +94,51 @@ def releaseOpenHabComponent(componentName, branch, releaseVersion, nextVersion,
9594

9695
stage(componentName + ": Release") {
9796
writeUnleashWorkflows()
97+
withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) {
98+
//Set release versions
99+
if(updateProperties) {
100+
sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions
101+
sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions
102+
}
103+
if(updateParent) {
104+
sh "mvn versions:update-parent -DparentVersion=[" + env.OH_RELEASE_VERSION +"] " + mvnOptions
105+
}
98106

99-
//Set release versions
100-
if(updateProperties) {
101-
sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions
102-
sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_RELEASE_VERSION +" " + mvnOptions
107+
sh "mvn unleash:perform -Dworkflow=unleash.phase1.workflow " + mvnOptions
103108
}
104-
if(updateParent) {
105-
sh "mvn versions:update-parent -DparentVersion=[" + env.OH_RELEASE_VERSION +"] " + mvnOptions
109+
withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) {
110+
sh "mvn deploy " + mvnReleaseOptions
111+
}
112+
withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) {
113+
//Tag SCM
114+
sh "mvn unleash:perform -Dworkflow=unleash.phase2.workflow " + mvnOptions
106115
}
107-
108-
sh "mvn unleash:perform -Dworkflow=unleash.phase1.workflow " + mvnOptions
109-
110-
sh "mvn deploy " + mvnReleaseOptions
111-
112-
//Tag SCM
113-
sh "mvn unleash:perform -Dworkflow=unleash.phase2.workflow " + mvnOptions
114-
115116
//Prevent wrong scm tag from being checked in
116117
sh 'git reset --hard ' + branch
117118
}
118119

119120
stage(componentName + ": Prepare next version") {
120121
//Set next development versions
121122
if(!releaseVersion.startsWith(nextVersion)) {
122-
if(updateParent) {
123-
sh "mvn versions:update-parent -DallowSnapshots=true -DparentVersion=[" + env.OH_NEXT_VERSION +"-SNAPSHOT] " + mvnOptions
124-
}
125-
if(updateProperties) {
126-
sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions
127-
sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions
128-
sh "mvn versions:set-property -Dproperty=repo.version -DnewVersion="+ env.OH_NEXT_VERSION.replace('[0-9]$', 'x ') + mvnOptions
129-
}
123+
withMaven(jdk: 'OpenJDK 11', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) {
130124

131-
sh "mvn unleash:perform -Dworkflow=unleash.phase3.workflow " + mvnOptions
125+
if(updateParent) {
126+
sh "mvn versions:update-parent -DallowSnapshots=true -DparentVersion=[" + env.OH_NEXT_VERSION +"-SNAPSHOT] " + mvnOptions
127+
}
128+
if(updateProperties) {
129+
sh "mvn versions:set-property -Dproperty=ohc.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions
130+
sh "mvn versions:set-property -Dproperty=oha.version -DnewVersion="+ env.OH_NEXT_VERSION +"-SNAPSHOT " + mvnOptions
131+
sh "mvn versions:set-property -Dproperty=repo.version -DnewVersion="+ env.OH_NEXT_VERSION.replace('[0-9]$', 'x ') + mvnOptions
132+
}
132133

133-
sh "mvn deploy " + mvnSnapshotOptions
134+
sh "mvn unleash:perform -Dworkflow=unleash.phase3.workflow " + mvnOptions
135+
}
136+
withMaven(jdk: 'OpenJDK 17', maven: 'maven (latest)', mavenOpts: '-Xms512m -Xmx2048m', mavenLocalRepo: '.repository', globalMavenSettingsConfig: env.MAVEN_GLOBAL_SETTINGS, options: [artifactsPublisher(disabled: true)]) {
137+
sh "mvn deploy " + mvnSnapshotOptions
138+
}
134139
}
135140
}
136141
}
137-
}
138142
}
139143
}
140144

0 commit comments

Comments
 (0)