Skip to content

Commit 5c83851

Browse files
committed
Polishing.
Extract docker credentials into properties file. See #1214
1 parent 1285555 commit 5c83851

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

Jenkinsfile

+12-11
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pipeline {
2323
stage('Publish JDK (main) + Cassandra 3.11') {
2424
when {
2525
anyOf {
26-
changeset "ci/openjdk8-cassandra-3.11/**"
27-
changeset "ci/pipeline.properties"
26+
changeset "ci/openjdk8-cassandra-3.11/**"
27+
changeset "ci/pipeline.properties"
2828
}
2929
}
3030
agent { label 'data' }
@@ -33,7 +33,7 @@ pipeline {
3333
steps {
3434
script {
3535
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk8-cassandra-3.11/")
36-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
36+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
3737
image.push()
3838
}
3939
}
@@ -42,8 +42,8 @@ pipeline {
4242
stage('Publish JDK (next) + Cassandra 3.11') {
4343
when {
4444
anyOf {
45-
changeset "ci/openjdk11-8-cassandra-3.11/**"
46-
changeset "ci/pipeline.properties"
45+
changeset "ci/openjdk11-8-cassandra-3.11/**"
46+
changeset "ci/pipeline.properties"
4747
}
4848
}
4949
agent { label 'data' }
@@ -52,7 +52,7 @@ pipeline {
5252
steps {
5353
script {
5454
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk11-8-cassandra-3.11/")
55-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
55+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
5656
image.push()
5757
}
5858
}
@@ -71,7 +71,7 @@ pipeline {
7171
steps {
7272
script {
7373
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.lts.tag']}", "--build-arg BASE=${p['docker.java.lts.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk17-8-cassandra-3.11/")
74-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
74+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
7575
image.push()
7676
}
7777
}
@@ -97,7 +97,7 @@ pipeline {
9797
}
9898
steps {
9999
script {
100-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
100+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
101101
docker.image("springci/spring-data-with-cassandra-3.11:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
102102
sh 'mkdir -p /tmp/jenkins-home'
103103
sh 'JAVA_HOME=/opt/java/openjdk /opt/cassandra/bin/cassandra -R &'
@@ -127,7 +127,7 @@ pipeline {
127127
}
128128
steps {
129129
script {
130-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
130+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
131131
docker.image("springci/spring-data-with-cassandra-3.11:${p['java.next.tag']}").inside(p['docker.java.inside.basic']) {
132132
sh 'mkdir -p /tmp/jenkins-home'
133133
sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &'
@@ -147,7 +147,7 @@ pipeline {
147147
}
148148
steps {
149149
script {
150-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
150+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
151151
docker.image("springci/spring-data-with-cassandra-3.11:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) {
152152
sh 'mkdir -p /tmp/jenkins-home'
153153
sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &'
@@ -159,6 +159,7 @@ pipeline {
159159
}
160160
}
161161
}
162+
162163
stage('Release to artifactory') {
163164
when {
164165
beforeAgent(true)
@@ -178,7 +179,7 @@ pipeline {
178179

179180
steps {
180181
script {
181-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
182+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
182183
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
183184
sh 'mkdir -p /tmp/jenkins-home'
184185
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +

ci/openjdk11-8-cassandra-3.11/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN set -eux; \
1515
useradd -d /home/jenkins-docker -m -u 1001 -U jenkins-docker;
1616

1717
RUN set -eux; \
18-
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz'; \
18+
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
1919
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
2020
mkdir -p /opt/java/openjdk8; \
2121
cd /opt/java/openjdk8; \

ci/openjdk17-8-cassandra-3.11/Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ RUN set -eux; \
1414
chmod -R a+rwx /opt/cassandra; \
1515
useradd -d /home/jenkins-docker -m -u 1001 -U jenkins-docker;
1616

17-
1817
RUN set -eux; \
19-
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz'; \
18+
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
2019
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
2120
mkdir -p /opt/java/openjdk8; \
2221
cd /opt/java/openjdk8; \

ci/pipeline.properties

+4
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ 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

0 commit comments

Comments
 (0)