From aea2d7bd9eab930c4270e2bb7fb5b9c7b4aed631 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 27 Nov 2023 09:39:54 +0100 Subject: [PATCH] Introduce property for Jenkins user and Artifactory server details. Closes #1455 --- Jenkinsfile | 17 +++++++++++------ ci/pipeline.properties | 3 +++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 675716093..b28306e10 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,9 @@ pipeline { docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-cassandra-3.11:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') { sh 'mkdir -p /tmp/jenkins-home' sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &' - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,external-cassandra clean dependency:list verify -Dsort -U -B' + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "./mvnw -s settings.xml -Pci,external-cassandra " + + "clean dependency:list verify -Dsort -U -B" } } } @@ -109,7 +111,9 @@ pipeline { docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-cassandra-3.11:${p['java.next.tag']}").inside('-v $HOME:/tmp/jenkins-home') { sh 'mkdir -p /tmp/jenkins-home' sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &' - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,external-cassandra clean dependency:list verify -Dsort -U -B' + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "./mvnw -s settings.xml -Pci,external-cassandra " + + "clean dependency:list verify -Dsort -U -B" } } } @@ -138,14 +142,15 @@ pipeline { script { 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 ' + - '-Dartifactory.server=https://repo.spring.io ' + + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "./mvnw -s settings.xml -Pci,artifactory " + + "-Dartifactory.server=${p['artifactory.url']} " + "-Dartifactory.username=${ARTIFACTORY_USR} " + "-Dartifactory.password=${ARTIFACTORY_PSW} " + - "-Dartifactory.staging-repository=libs-snapshot-local " + + "-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " + "-Dartifactory.build-name=spring-data-cassandra " + "-Dartifactory.build-number=${BUILD_NUMBER} " + - '-Dmaven.test.skip=true clean deploy -U -B' + "-Dmaven.test.skip=true clean deploy -U -B" } } } diff --git a/ci/pipeline.properties b/ci/pipeline.properties index 3f58111a7..25c934a51 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -25,3 +25,6 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock - docker.registry= docker.credentials=hub.docker.com-springbuildmaster artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c +artifactory.url=https://repo.spring.io +artifactory.repository.snapshot=libs-snapshot-local +jenkins.user.name=spring-builds+jenkins