Skip to content

Commit b6b0912

Browse files
committed
Polishing.
Extract Artifactory and docker credentials into properties file. See #2245
1 parent 50f8ae4 commit b6b0912

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Jenkinsfile

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
def p = [:]
22
node {
3-
checkout scm
4-
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
3+
checkout scm
4+
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
55
}
66

77
pipeline {
@@ -25,7 +25,7 @@ pipeline {
2525
anyOf {
2626
changeset "ci/openjdk8-redis-6.2/Dockerfile"
2727
changeset "Makefile"
28-
changeset "ci/pipeline.properties"
28+
changeset "ci/pipeline.properties"
2929
}
3030
}
3131
agent { label 'data' }
@@ -34,7 +34,7 @@ pipeline {
3434
steps {
3535
script {
3636
def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg REDIS=${p['docker.redis.6.version']} -f ci/openjdk8-redis-6.2/Dockerfile .")
37-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
37+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
3838
image.push()
3939
}
4040
}
@@ -54,7 +54,7 @@ pipeline {
5454
steps {
5555
script {
5656
def image = docker.build("springci/spring-data-openjdk11-with-redis-6.2:${p['java.11.tag']}", "--build-arg BASE=${p['docker.java.11.image']} --build-arg REDIS=${p['docker.redis.6.version']} -f ci/openjdk11-redis-6.2/Dockerfile .")
57-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
57+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
5858
image.push()
5959
}
6060
}
@@ -65,7 +65,7 @@ pipeline {
6565
anyOf {
6666
changeset "ci/openjdk15-redis-6.2/**"
6767
changeset "Makefile"
68-
changeset "ci/pipeline.properties"
68+
changeset "ci/pipeline.properties"
6969
}
7070
}
7171
agent { label 'data' }
@@ -74,7 +74,7 @@ pipeline {
7474
steps {
7575
script {
7676
def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.15.tag']}", "--build-arg BASE=${p['docker.java.15.image']} --build-arg REDIS=${p['docker.redis.6.version']} -f ci/openjdk17-redis-6.2/Dockerfile .")
77-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
77+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
7878
image.push()
7979
}
8080
}
@@ -95,11 +95,11 @@ pipeline {
9595
}
9696
options { timeout(time: 30, unit: 'MINUTES') }
9797
environment {
98-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
98+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
9999
}
100100
steps {
101101
script {
102-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
102+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
103103
docker.image("springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
104104
sh 'PROFILE=none LONG_TESTS=true ci/test.sh'
105105
}
@@ -122,11 +122,11 @@ pipeline {
122122
}
123123
options { timeout(time: 30, unit: 'MINUTES') }
124124
environment {
125-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
125+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
126126
}
127127
steps {
128128
script {
129-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
129+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
130130
docker.image("springci/spring-data-with-redis-6.2:${p['java.11.tag']}").inside(p['docker.java.inside.basic']) {
131131
sh 'PROFILE=java11 ci/test.sh'
132132
}
@@ -140,11 +140,11 @@ pipeline {
140140
}
141141
options { timeout(time: 30, unit: 'MINUTES') }
142142
environment {
143-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
143+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
144144
}
145145
steps {
146146
script {
147-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
147+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
148148
docker.image("springci/spring-data-with-redis-6.2:${p['java.15.tag']}").inside(p['docker.java.inside.basic']) {
149149
sh 'PROFILE=java11 ci/test.sh'
150150
}
@@ -168,12 +168,12 @@ pipeline {
168168
options { timeout(time: 20, unit: 'MINUTES') }
169169

170170
environment {
171-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
171+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
172172
}
173173

174174
steps {
175175
script {
176-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
176+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
177177
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
178178
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
179179
'-Dartifactory.server=https://repo.spring.io ' +
@@ -199,13 +199,13 @@ pipeline {
199199
options { timeout(time: 20, unit: 'MINUTES') }
200200

201201
environment {
202-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
202+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
203203
}
204204

205205
steps {
206206
script {
207-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
208-
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
207+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
208+
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
209209
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,distribute ' +
210210
'-Dartifactory.server=https://repo.spring.io ' +
211211
"-Dartifactory.username=${ARTIFACTORY_USR} " +

0 commit comments

Comments
 (0)