forked from infinispan/infinispan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile-release
109 lines (95 loc) · 3.97 KB
/
Jenkinsfile-release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env groovy
pipeline {
agent {
label 'slave-group-release'
}
parameters {
string(name: 'version', defaultValue: '0.0.0.Qualifier', description: 'Release version')
string(name: 'nextVersion', defaultValue: '', description: 'Next release (blank to stay on current SNAPSHOT)')
gitParameter(name: 'branch', defaultValue: 'origin/master', branchFilter: 'origin/(.*)', type: 'PT_BRANCH', description: 'Branch to release from', sortMode: 'DESCENDING_SMART')
}
options {
timeout(time: 3, unit: 'HOURS')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '100', daysToKeepStr: '61'))
}
stages {
stage('Prepare') {
steps {
script {
env.MAVEN_HOME = tool('Maven')
env.MAVEN_OPTS = "-Xmx1500m -XX:+HeapDumpOnOutOfMemoryError"
env.JAVA_HOME = tool('JDK 21')
}
sh returnStdout: true, script: 'cleanup.sh'
}
}
stage('Checkout') {
steps {
checkout scm
}
}
stage('Commit Proto.lock Files') {
steps {
script {
if ("${version}".endsWith('Final')) {
sh "$MAVEN_HOME/bin/mvn clean install -B -e -DskipTests -DcommitProtoLockChanges=true"
sh "git add '**/proto.lock'"
sh "git diff-index --quiet HEAD || git commit -m 'Committing proto.lock files for ${version}'"
}
}
}
}
stage('Commit version for documentation') {
steps {
script {
sh "sed -i \"s/^:ispn_version:.*\$/:ispn_version: ${version}/\" documentation/src/main/asciidoc/topics/attributes/community-attributes.adoc"
sh "git add 'documentation/src/main/asciidoc/topics/attributes/community-attributes.adoc'"
sh "git diff-index --quiet HEAD || git commit -m 'Committing ${version} to doc attribute file'"
}
}
}
stage('Version') {
steps {
sh "$MAVEN_HOME/bin/mvn -B versions:set -DnewVersion=${version} -DprocessAllModules=true"
sh "$MAVEN_HOME/bin/mvn -B versions:set-property -Dproperty=version.infinispan -DnewVersion=${version}"
}
}
stage('Deploy') {
steps {
sh "$MAVEN_HOME/bin/mvn -B -Drelease-mode=upstream -Pdistribution -DskipTests clean deploy -Dinfinispan.brand.version=${version}"
}
}
stage('Tag') {
steps {
// Commit and tag once everything is good
sh "$MAVEN_HOME/bin/mvn -B scm:checkin -Dmessage=\"Releasing version ${version}\" -DpushChanges=false"
sh "$MAVEN_HOME/bin/mvn -B scm:tag -Dtag=${version}"
}
}
stage('Next version') {
when {
expression { params.nextVersion != '' }
}
steps {
sh "$MAVEN_HOME/bin/mvn -B versions:set -DnewVersion=${nextVersion} -DprocessAllModules=true"
sh "$MAVEN_HOME/bin/mvn -B versions:set-property -Dproperty=version.infinispan -DnewVersion=${nextVersion}"
sh "$MAVEN_HOME/bin/mvn -B -Dmessage='next version ${nextVersion}' -DscmVersion=${branch} -DscmVersionType=branch scm:checkin"
}
}
}
post {
always {
// Clean
sh 'git clean -fdx -e "*.hprof" || echo "git clean failed, exit code $?"'
}
failure {
echo "post build status: failure"
emailext to: '${DEFAULT_RECIPIENTS}', subject: '${DEFAULT_SUBJECT}', body: '${DEFAULT_CONTENT}'
}
success {
echo "post build status: success"
emailext to: '${DEFAULT_RECIPIENTS}', subject: '${DEFAULT_SUBJECT}', body: '${DEFAULT_CONTENT}'
}
}
}