Skip to content

Commit c10ebf1

Browse files
committed
Polishing.
Extract Artifactory and docker credentials into properties file. See #2245
1 parent c0d5fd7 commit c10ebf1

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Jenkinsfile

+12-12
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
}
@@ -45,7 +45,7 @@ pipeline {
4545
anyOf {
4646
changeset "ci/openjdk17-redis-6.2/Dockerfile"
4747
changeset "Makefile"
48-
changeset "ci/pipeline.properties"
48+
changeset "ci/pipeline.properties"
4949
}
5050
}
5151
agent { label 'data' }
@@ -54,7 +54,7 @@ pipeline {
5454
steps {
5555
script {
5656
def image = docker.build("springci/spring-data-with-redis-6.2:${p['java.lts.tag']}", "--build-arg BASE=${p['docker.java.lts.image']} --build-arg REDIS=${p['docker.redis.6.version']} -f ci/openjdk17-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
}
@@ -76,11 +76,11 @@ pipeline {
7676
}
7777
options { timeout(time: 30, unit: 'MINUTES') }
7878
environment {
79-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
79+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
8080
}
8181
steps {
8282
script {
83-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
83+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
8484
docker.image("springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
8585
sh 'PROFILE=none LONG_TESTS=true ci/test.sh'
8686
}
@@ -104,11 +104,11 @@ pipeline {
104104
}
105105
options { timeout(time: 30, unit: 'MINUTES') }
106106
environment {
107-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
107+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
108108
}
109109
steps {
110110
script {
111-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
111+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
112112
docker.image("springci/spring-data-with-redis-6.2:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) {
113113
sh 'PROFILE=java11 ci/test.sh'
114114
}
@@ -133,12 +133,12 @@ pipeline {
133133
options { timeout(time: 20, unit: 'MINUTES') }
134134

135135
environment {
136-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
136+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
137137
}
138138

139139
steps {
140140
script {
141-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
141+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
142142
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
143143
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
144144
'-Dartifactory.server=https://repo.spring.io ' +

ci/pipeline.properties

+5
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ docker.cassandra.3.version=3.11.10
2222
# Docker environment settings
2323
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
2424
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)