From 47c741392ac16253b9bcf99fc60d2f73e3889ecf Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 27 Nov 2023 15:38:17 +0100 Subject: [PATCH] Introduce property for Jenkins user and Artifactory server details. Closes #189 --- Jenkinsfile | 15 +++++++++------ ci/pipeline.properties | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 24d95ce..61c4c90 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,7 +39,8 @@ pipeline { steps { script { 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 -Pwith-bom-client verify -B -U' + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "./mvnw -Pwith-bom-client verify -B -U" } } } @@ -65,7 +66,8 @@ pipeline { steps { script { docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.basic']) { - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pwith-bom-client verify -B -U' + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "./mvnw -Pwith-bom-client verify -B -U" } } } @@ -93,14 +95,15 @@ pipeline { steps { script { 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 -Partifactory ' + - '-Dartifactory.server=https://repo.spring.io ' + + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "./mvnw -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-bom " + "-Dartifactory.build-number=${BUILD_NUMBER} " + - '-Dmaven.test.skip=true clean deploy -B -U' + "-Dmaven.test.skip=true clean deploy -U -B" } } } diff --git a/ci/pipeline.properties b/ci/pipeline.properties index 3f58111..25c934a 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