diff --git a/Jenkinsfile b/Jenkinsfile index 685270466..9779dd237 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,8 +40,8 @@ pipeline { steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) { - sh 'PROFILE=none ci/verify.sh' - sh "ci/clean.sh" + sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/verify.sh" + sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh" } } } @@ -69,8 +69,8 @@ pipeline { steps { script { docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) { - sh 'PROFILE=none ci/verify.sh' - sh "ci/clean.sh" + sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/verify.sh" + sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh" } } } @@ -90,28 +90,26 @@ pipeline { label 'data' } options { timeout(time: 20, unit: 'MINUTES') } - environment { ARTIFACTORY = credentials("${p['artifactory.credentials']}") DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}") DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}") } - steps { script { docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) { - sh 'MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" ' + - 'DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} ' + - 'DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} ' + - 'GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} ' + - './mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' + - '-Dartifactory.server=https://repo.spring.io ' + + sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + + "DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} " + + "DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} " + + "GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} " + + "./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-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-elasticsearch " + "-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 9f86e51eb..34ba4ffcc 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -4,9 +4,10 @@ set -euo pipefail export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} +export JENKINS_USER=${JENKINS_USER_NAME} # The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} -MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" \ - ./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch +MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \ + ./mvnw -s settings.xml clean -Dscan=false -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch diff --git a/ci/pipeline.properties b/ci/pipeline.properties index d65c9db58..dc8b6fb0a 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -26,5 +26,8 @@ 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 develocity.cache.credentials=gradle_enterprise_cache_user develocity.access-key=gradle_enterprise_secret_access_key +jenkins.user.name=spring-builds+jenkins diff --git a/ci/verify.sh b/ci/verify.sh index 82734212b..98b9c79cc 100755 --- a/ci/verify.sh +++ b/ci/verify.sh @@ -7,10 +7,11 @@ chown -R 1001:1001 . export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} +export JENKINS_USER=${JENKINS_USER_NAME} # The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} -MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" \ +MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \ ./mvnw -s settings.xml \ - -P${PROFILE} clean dependency:list verify -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch \ No newline at end of file + -P${PROFILE} clean dependency:list verify -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch