Skip to content

Commit 708d1a5

Browse files
committed
Split release and build jobs
1 parent 33dfc69 commit 708d1a5

File tree

2 files changed

+82
-63
lines changed

2 files changed

+82
-63
lines changed

Jenkinsfile

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
1+
@Library('hibernate-jenkins-pipeline-helpers@1.17') _
22

33
import org.hibernate.jenkins.pipeline.helpers.version.Version
44

@@ -14,25 +14,6 @@ pipeline {
1414
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10')
1515
disableConcurrentBuilds(abortPrevious: false)
1616
}
17-
parameters {
18-
string(
19-
name: 'RELEASE_VERSION',
20-
defaultValue: '',
21-
description: 'The version to be released, e.g. 1.0.0.Final.',
22-
trim: true
23-
)
24-
string(
25-
name: 'DEVELOPMENT_VERSION',
26-
defaultValue: '',
27-
description: 'The next version to be used after the release, e.g. 1.0.1-SNAPSHOT.',
28-
trim: true
29-
)
30-
booleanParam(
31-
name: 'RELEASE_DRY_RUN',
32-
defaultValue: false,
33-
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts.'
34-
)
35-
}
3617
stages {
3718
stage('Build') {
3819
steps {
@@ -41,47 +22,5 @@ pipeline {
4122
}
4223
}
4324
}
44-
stage('Release') {
45-
when {
46-
beforeAgent true
47-
// Releases must be triggered explicitly with parameters
48-
expression { return params.RELEASE_VERSION }
49-
}
50-
steps {
51-
script {
52-
// Check that all the necessary parameters are set
53-
if (!params.RELEASE_VERSION) {
54-
throw new IllegalArgumentException("Missing value for parameter RELEASE_VERSION.")
55-
}
56-
if (!params.DEVELOPMENT_VERSION) {
57-
throw new IllegalArgumentException("Missing value for parameter DEVELOPMENT_VERSION.")
58-
}
59-
60-
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
61-
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
62-
echo "Performing full release for version ${releaseVersion.toString()}"
63-
64-
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
65-
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
66-
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
67-
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
68-
sshagent(['ed25519.Hibernate-CI.github.com']) {
69-
sh 'cat $HOME/.ssh/config'
70-
sh """ \
71-
./mvnw release:prepare \
72-
-Dtag=${releaseVersion.toString()} \
73-
-DreleaseVersion=${releaseVersion.toString()} \
74-
-DdevelopmentVersion=${developmentVersion.toString()} \
75-
-Prelease \
76-
"""
77-
sh """ \
78-
./mvnw release:perform ${params.RELEASE_DRY_RUN ? '-DdryRun' : ''} -Prelease \
79-
"""
80-
}
81-
}
82-
}
83-
}
84-
}
85-
}
8625
}
87-
}
26+
}

ci/release/Jenkinsfile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
@Library('hibernate-jenkins-pipeline-helpers@1.17') _
2+
3+
import org.hibernate.jenkins.pipeline.helpers.version.Version
4+
5+
pipeline {
6+
agent {
7+
label 'Worker&&Containers'
8+
}
9+
tools {
10+
maven 'Apache Maven 3.8'
11+
jdk 'OpenJDK 17 Latest'
12+
}
13+
options {
14+
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10')
15+
disableConcurrentBuilds(abortPrevious: false)
16+
}
17+
parameters {
18+
string(
19+
name: 'RELEASE_VERSION',
20+
defaultValue: '',
21+
description: 'The version to be released, e.g. 1.0.0.Final.',
22+
trim: true
23+
)
24+
string(
25+
name: 'DEVELOPMENT_VERSION',
26+
defaultValue: '',
27+
description: 'The next version to be used after the release, e.g. 1.0.1-SNAPSHOT.',
28+
trim: true
29+
)
30+
booleanParam(
31+
name: 'RELEASE_DRY_RUN',
32+
defaultValue: false,
33+
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts.'
34+
)
35+
}
36+
stages {
37+
stage('Release') {
38+
when {
39+
beforeAgent true
40+
// Releases must be triggered explicitly with parameters
41+
expression { return params.RELEASE_VERSION }
42+
}
43+
steps {
44+
script {
45+
// Check that all the necessary parameters are set
46+
if (!params.RELEASE_VERSION) {
47+
throw new IllegalArgumentException("Missing value for parameter RELEASE_VERSION.")
48+
}
49+
if (!params.DEVELOPMENT_VERSION) {
50+
throw new IllegalArgumentException("Missing value for parameter DEVELOPMENT_VERSION.")
51+
}
52+
53+
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
54+
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
55+
echo "Performing full release for version ${releaseVersion.toString()}"
56+
57+
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
58+
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
59+
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
60+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
61+
sshagent(['ed25519.Hibernate-CI.github.com']) {
62+
sh 'cat $HOME/.ssh/config'
63+
sh """ \
64+
./mvnw release:prepare \
65+
-Dtag=${releaseVersion.toString()} \
66+
-DreleaseVersion=${releaseVersion.toString()} \
67+
-DdevelopmentVersion=${developmentVersion.toString()} \
68+
-Prelease \
69+
"""
70+
sh """ \
71+
./mvnw release:perform ${params.RELEASE_DRY_RUN ? '-DdryRun' : ''} -Prelease \
72+
"""
73+
}
74+
}
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}

0 commit comments

Comments
 (0)