Skip to content

Commit 80d5749

Browse files
committed
Externalize build properties.
Closes #2103.
1 parent 1d2a9dc commit 80d5749

File tree

6 files changed

+53
-186
lines changed

6 files changed

+53
-186
lines changed

CI.adoc

Lines changed: 0 additions & 43 deletions
This file was deleted.

Jenkinsfile

Lines changed: 24 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
def p = [:]
2+
node {
3+
checkout scm
4+
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
5+
}
6+
17
pipeline {
28
agent none
39

@@ -13,60 +19,7 @@ pipeline {
1319
}
1420

1521
stages {
16-
stage("Docker images") {
17-
parallel {
18-
stage('Publish JDK 8 + MongoDB 4.4') {
19-
when {
20-
changeset "ci/openjdk8-mongodb-4.4/**"
21-
}
22-
agent { label 'data' }
23-
options { timeout(time: 30, unit: 'MINUTES') }
24-
25-
steps {
26-
script {
27-
def image = docker.build("springci/spring-data-rest-openjdk8-with-mongodb-4.4", "ci/openjdk8-mongodb-4.4/")
28-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
29-
image.push()
30-
}
31-
}
32-
}
33-
}
34-
stage('Publish JDK 11 + MongoDB 4.4') {
35-
when {
36-
changeset "ci/openjdk11-mongodb-4.4/**"
37-
}
38-
agent { label 'data' }
39-
options { timeout(time: 30, unit: 'MINUTES') }
40-
41-
steps {
42-
script {
43-
def image = docker.build("springci/spring-data-rest-openjdk11-with-mongodb-4.4", "ci/openjdk8-mongodb-4.4/")
44-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
45-
image.push()
46-
}
47-
}
48-
}
49-
}
50-
stage('Publish JDK 17/ + MongoDB 4.4') {
51-
when {
52-
changeset "ci/openjdk17-mongodb-4.4/**"
53-
}
54-
agent { label 'data' }
55-
options { timeout(time: 30, unit: 'MINUTES') }
56-
57-
steps {
58-
script {
59-
def image = docker.build("springci/spring-data-rest-openjdk17-with-mongodb-4.4", "ci/openjdk17-mongodb-4.4/")
60-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
61-
image.push()
62-
}
63-
}
64-
}
65-
}
66-
}
67-
}
68-
69-
stage("test: baseline (jdk8)") {
22+
stage("test: baseline (main)") {
7023
when {
7124
beforeAgent(true)
7225
anyOf {
@@ -79,12 +32,12 @@ pipeline {
7932
}
8033
options { timeout(time: 30, unit: 'MINUTES') }
8134
environment {
82-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
35+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
8336
}
8437
steps {
8538
script {
86-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
87-
docker.image('springci/spring-data-rest-openjdk8-with-mongodb-4.4:latest').inside('-v $HOME:/tmp/jenkins-home') {
39+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
40+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
8841
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
8942
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
9043
sh 'sleep 10'
@@ -106,41 +59,18 @@ pipeline {
10659
}
10760
}
10861
parallel {
109-
stage("test: baseline (jdk11)") {
110-
agent {
111-
label 'data'
112-
}
113-
options { timeout(time: 30, unit: 'MINUTES') }
114-
environment {
115-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
116-
}
117-
steps {
118-
script {
119-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
120-
docker.image('springci/spring-data-rest-openjdk11-with-mongodb-4.4:latest').inside('-v $HOME:/tmp/jenkins-home') {
121-
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
122-
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
123-
sh 'sleep 10'
124-
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
125-
sh 'sleep 15'
126-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list test -Dsort -U -B -Pit,java11'
127-
}
128-
}
129-
}
130-
}
131-
}
13262
stage("test: baseline (JDK 17)") {
13363
agent {
13464
label 'data'
13565
}
13666
options { timeout(time: 30, unit: 'MINUTES') }
13767
environment {
138-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
68+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
13969
}
14070
steps {
14171
script {
142-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
143-
docker.image('springci/spring-data-rest-openjdk17-with-mongodb-4.4:latest').inside('-v $HOME:/tmp/jenkins-home') {
72+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
73+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) {
14474
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
14575
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
14676
sh 'sleep 10'
@@ -152,18 +82,18 @@ pipeline {
15282
}
15383
}
15484
}
155-
stage("test: spring53-next (jdk8)") {
85+
stage("test: spring53-next (main)") {
15686
agent {
15787
label 'data'
15888
}
15989
options { timeout(time: 30, unit: 'MINUTES') }
16090
environment {
161-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
91+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
16292
}
16393
steps {
16494
script {
165-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
166-
docker.image('springci/spring-data-rest-openjdk8-with-mongodb-4.4:latest').inside('-v $HOME:/tmp/jenkins-home') {
95+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
96+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
16797
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
16898
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
16999
sh 'sleep 10'
@@ -175,18 +105,18 @@ pipeline {
175105
}
176106
}
177107
}
178-
stage("test: spring53-next (JDK 17)") {
108+
stage("test: spring53-next (LTS)") {
179109
agent {
180110
label 'data'
181111
}
182112
options { timeout(time: 30, unit: 'MINUTES') }
183113
environment {
184-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
114+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
185115
}
186116
steps {
187117
script {
188-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
189-
docker.image('springci/spring-data-rest-openjdk17-with-mongodb-4.4:latest').inside('-v $HOME:/tmp/jenkins-home') {
118+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
119+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) {
190120
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
191121
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
192122
sh 'sleep 10'
@@ -215,13 +145,13 @@ pipeline {
215145
options { timeout(time: 20, unit: 'MINUTES') }
216146

217147
environment {
218-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
148+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
219149
}
220150

221151
steps {
222152
script {
223-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
224-
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
153+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
154+
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
225155
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
226156
'-Dartifactory.server=https://repo.spring.io ' +
227157
"-Dartifactory.username=${ARTIFACTORY_USR} " +

ci/openjdk11-mongodb-4.4/Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

ci/openjdk17-mongodb-4.4/Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

ci/openjdk8-mongodb-4.4/Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

ci/pipeline.properties

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Java versions
2+
java.main.tag=8u312-b07-jdk
3+
java.next.tag=11.0.13_8-jdk
4+
java.lts.tag=17.0.1_12-jdk
5+
6+
# Docker container images - standard
7+
docker.java.main.image=eclipse-temurin:${java.main.tag}
8+
docker.java.next.image=eclipse-temurin:${java.next.tag}
9+
docker.java.lts.image=eclipse-temurin:${java.lts.tag}
10+
11+
# Supported versions of MongoDB
12+
docker.mongodb.4.0.version=4.0.23
13+
docker.mongodb.4.4.version=4.4.4
14+
docker.mongodb.5.0.version=5.0.3
15+
16+
# Supported versions of Redis
17+
docker.redis.6.version=6.2.4
18+
19+
# Supported versions of Cassandra
20+
docker.cassandra.3.version=3.11.10
21+
22+
# Docker environment settings
23+
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
24+
docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home
25+
26+
# Credentials
27+
docker.registry=
28+
docker.credentials=hub.docker.com-springbuildmaster
29+
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c

0 commit comments

Comments
 (0)