diff --git a/Jenkinsfile b/Jenkinsfile index 17c184235..e5a37fa9d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ def p = [:] node { - checkout scm - p = readProperties interpolate: true, file: 'ci/pipeline.properties' + checkout scm + p = readProperties interpolate: true, file: 'ci/pipeline.properties' } pipeline { @@ -25,7 +25,7 @@ pipeline { anyOf { changeset "ci/openjdk8-redis-6.2/Dockerfile" changeset "Makefile" - changeset "ci/pipeline.properties" + changeset "ci/pipeline.properties" } } agent { label 'data' } @@ -34,7 +34,7 @@ pipeline { steps { script { 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 .") - docker.withRegistry('', 'hub.docker.com-springbuildmaster') { + docker.withRegistry(p['docker.registry'], p['docker.credentials']) { image.push() } } @@ -45,7 +45,7 @@ pipeline { anyOf { changeset "ci/openjdk17-redis-6.2/Dockerfile" changeset "Makefile" - changeset "ci/pipeline.properties" + changeset "ci/pipeline.properties" } } agent { label 'data' } @@ -54,7 +54,7 @@ pipeline { steps { script { 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 .") - docker.withRegistry('', 'hub.docker.com-springbuildmaster') { + docker.withRegistry(p['docker.registry'], p['docker.credentials']) { image.push() } } @@ -76,11 +76,11 @@ pipeline { } options { timeout(time: 30, unit: 'MINUTES') } environment { - ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + ARTIFACTORY = credentials("${p['artifactory.credentials']}") } steps { script { - docker.withRegistry('', 'hub.docker.com-springbuildmaster') { + docker.withRegistry(p['docker.registry'], p['docker.credentials']) { docker.image("springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) { sh 'PROFILE=none LONG_TESTS=true ci/test.sh' } @@ -104,11 +104,11 @@ pipeline { } options { timeout(time: 30, unit: 'MINUTES') } environment { - ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + ARTIFACTORY = credentials("${p['artifactory.credentials']}") } steps { script { - docker.withRegistry('', 'hub.docker.com-springbuildmaster') { + docker.withRegistry(p['docker.registry'], p['docker.credentials']) { docker.image("springci/spring-data-with-redis-6.2:${p['java.lts.tag']}").inside(p['docker.java.inside.basic']) { sh 'PROFILE=java11 ci/test.sh' } @@ -133,12 +133,12 @@ pipeline { options { timeout(time: 20, unit: 'MINUTES') } environment { - ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + ARTIFACTORY = credentials("${p['artifactory.credentials']}") } 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 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' + '-Dartifactory.server=https://repo.spring.io ' + diff --git a/ci/pipeline.properties b/ci/pipeline.properties index 5d91102d2..9d382ca66 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -22,3 +22,8 @@ docker.cassandra.3.version=3.11.10 # Docker environment settings docker.java.inside.basic=-v $HOME:/tmp/jenkins-home 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 + +# Credentials +docker.registry= +docker.credentials=hub.docker.com-springbuildmaster +artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c