Skip to content

Commit c53bdcd

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

File tree

6 files changed

+57
-167
lines changed

6 files changed

+57
-167
lines changed

CI.adoc

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

Jenkinsfile

Lines changed: 28 additions & 75 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,18 +59,18 @@ pipeline {
10659
}
10760
}
10861
parallel {
109-
stage("test: baseline (jdk11)") {
62+
stage("test: baseline (next)") {
11063
agent {
11164
label 'data'
11265
}
11366
options { timeout(time: 30, unit: 'MINUTES') }
11467
environment {
115-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
68+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
11669
}
11770
steps {
11871
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') {
72+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
73+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.next.tag']}").inside(p['docker.java.inside.basic']) {
12174
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
12275
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
12376
sh 'sleep 10'
@@ -135,12 +88,12 @@ pipeline {
13588
}
13689
options { timeout(time: 30, unit: 'MINUTES') }
13790
environment {
138-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
91+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
13992
}
14093
steps {
14194
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') {
95+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
96+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) {
14497
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
14598
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
14699
sh 'sleep 10'
@@ -152,18 +105,18 @@ pipeline {
152105
}
153106
}
154107
}
155-
stage("test: spring53-next (jdk8)") {
108+
stage("test: spring53-next (main)") {
156109
agent {
157110
label 'data'
158111
}
159112
options { timeout(time: 30, unit: 'MINUTES') }
160113
environment {
161-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
114+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
162115
}
163116
steps {
164117
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') {
118+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
119+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
167120
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
168121
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
169122
sh 'sleep 10'
@@ -175,18 +128,18 @@ pipeline {
175128
}
176129
}
177130
}
178-
stage("test: spring53-next (JDK 17)") {
131+
stage("test: spring53-next (LTS)") {
179132
agent {
180133
label 'data'
181134
}
182135
options { timeout(time: 30, unit: 'MINUTES') }
183136
environment {
184-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
137+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
185138
}
186139
steps {
187140
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') {
141+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
142+
docker.image("springci/spring-data-with-mongodb-4.4:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) {
190143
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
191144
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
192145
sh 'sleep 10'
@@ -215,13 +168,13 @@ pipeline {
215168
options { timeout(time: 20, unit: 'MINUTES') }
216169

217170
environment {
218-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
171+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
219172
}
220173

221174
steps {
222175
script {
223-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
224-
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
176+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
177+
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
225178
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
226179
'-Dartifactory.server=https://repo.spring.io ' +
227180
"-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)