diff --git a/Jenkinsfile b/Jenkinsfile index 69753a556..bafa564c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,8 +36,8 @@ pipeline { steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) { - sh 'PROFILE=ci ci/test.sh' - sh "ci/clean.sh" + sh "PROFILE=ci JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" + sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh" } } } @@ -63,8 +63,8 @@ pipeline { steps { script { docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) { - sh 'PROFILE=ci ci/test.sh' - sh "ci/clean.sh" + sh "PROFILE=ci JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" + sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh" } } } @@ -84,22 +84,21 @@ pipeline { label 'data' } options { timeout(time: 20, unit: 'MINUTES') } - environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") } - 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 -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase-non-root ' + - '-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 -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase-non-root " + + "-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-couchbase " + "-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/clean.sh b/ci/clean.sh index 4986aaf40..72cfc534f 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,5 +2,7 @@ set -euo pipefail -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ +export JENKINS_USER=${JENKINS_USER_NAME} + +MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase 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 diff --git a/ci/test.sh b/ci/test.sh index 5601c3736..ffcc5e1ac 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -5,6 +5,8 @@ set -euo pipefail mkdir -p /tmp/jenkins-home/.m2/spring-data-couchbase chown -R 1001:1001 . -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ +export JENKINS_USER=${JENKINS_USER_NAME} + +MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml \ - -P${PROFILE} clean dependency:list test -Dsort -Dbundlor.enabled=false -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase + -P${PROFILE} clean dependency:list test -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-couchbase