Polishing.

Extract docker credentials into properties file.

See #1214
This commit is contained in:
Mark Paluch
2022-02-04 09:19:13 +01:00
parent f2a1e52339
commit 94af70348c
3 changed files with 16 additions and 15 deletions

27
Jenkinsfile vendored
View File

@@ -23,8 +23,8 @@ pipeline {
stage('Publish JDK (main) + Cassandra 3.11') {
when {
anyOf {
changeset "ci/openjdk8-cassandra-3.11/**"
changeset "ci/pipeline.properties"
changeset "ci/openjdk8-cassandra-3.11/**"
changeset "ci/pipeline.properties"
}
}
agent { label 'data' }
@@ -33,7 +33,7 @@ pipeline {
steps {
script {
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/")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
image.push()
}
}
@@ -42,8 +42,8 @@ pipeline {
stage('Publish JDK (next) + Cassandra 3.11') {
when {
anyOf {
changeset "ci/openjdk11-8-cassandra-3.11/**"
changeset "ci/pipeline.properties"
changeset "ci/openjdk11-8-cassandra-3.11/**"
changeset "ci/pipeline.properties"
}
}
agent { label 'data' }
@@ -52,7 +52,7 @@ pipeline {
steps {
script {
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.11.tag']}", "--build-arg BASE=${p['docker.java.11.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk11-8-cassandra-3.11/")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
image.push()
}
}
@@ -70,8 +70,8 @@ pipeline {
steps {
script {
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.15.tag']}", "--build-arg BASE=${p['docker.java.15.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk17-8-cassandra-3.11/")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
def image = docker.build("springci/spring-data-with-cassandra-3.11:${p['java.15.tag']}", "--build-arg BASE=${p['docker.java.15.image']} --build-arg CASSANDRA=${p['docker.cassandra.3.version']} ci/openjdk15-8-cassandra-3.11/")
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
image.push()
}
}
@@ -96,7 +96,7 @@ pipeline {
}
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
docker.image("springci/spring-data-with-cassandra-3.11:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
sh 'mkdir -p /tmp/jenkins-home'
sh 'JAVA_HOME=/opt/java/openjdk /opt/cassandra/bin/cassandra -R &'
@@ -125,7 +125,7 @@ pipeline {
}
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
docker.image("springci/spring-data-with-cassandra-3.11:${p['java.11.tag']}").inside(p['docker.java.inside.basic']) {
sh 'mkdir -p /tmp/jenkins-home'
sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &'
@@ -145,7 +145,7 @@ pipeline {
}
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
docker.image("springci/spring-data-with-cassandra-3.11:${p['java.15.tag']}").inside(p['docker.java.inside.basic']) {
sh 'mkdir -p /tmp/jenkins-home'
sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &'
@@ -157,6 +157,7 @@ pipeline {
}
}
}
stage('Release to artifactory') {
when {
anyOf {
@@ -175,7 +176,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'mkdir -p /tmp/jenkins-home'
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
@@ -206,7 +207,7 @@ pipeline {
steps {
script {
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
sh 'mkdir -p /tmp/jenkins-home'
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,distribute ' +

View File

@@ -15,7 +15,7 @@ RUN set -eux; \
useradd -d /home/jenkins-docker -m -u 1001 -U jenkins-docker;
RUN set -eux; \
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u275b01.tar.gz'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
mkdir -p /opt/java/openjdk8; \
cd /opt/java/openjdk8; \

View File

@@ -15,7 +15,7 @@ RUN set -eux; \
useradd -d /home/jenkins-docker -m -u 1001 -U jenkins-docker;
RUN set -eux; \
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u275b01.tar.gz'; \
BINARY_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz'; \
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \
mkdir -p /opt/java/openjdk8; \
cd /opt/java/openjdk8; \