Skip to content

Commit fb95f96

Browse files
committed
Introduce property for Jenkins user and Artifactory server details.
Closes #2787
1 parent 8b57795 commit fb95f96

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

Jenkinsfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pipeline {
8181
steps {
8282
script {
8383
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
84-
sh 'PROFILE=none LONG_TESTS=true ci/test.sh'
84+
sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
8585
}
8686
}
8787
}
@@ -107,7 +107,7 @@ pipeline {
107107
steps {
108108
script {
109109
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-6.2:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
110-
sh 'PROFILE=runtimehints LONG_TESTS=false ci/test.sh'
110+
sh "PROFILE=runtimehints LONG_TESTS=false JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
111111
}
112112
}
113113
}
@@ -123,7 +123,7 @@ pipeline {
123123
steps {
124124
script {
125125
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-6.2:${p['java.next.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
126-
sh 'PROFILE=none LONG_TESTS=true ci/test.sh'
126+
sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
127127
}
128128
}
129129
}
@@ -151,14 +151,15 @@ pipeline {
151151
steps {
152152
script {
153153
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
154-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
155-
'-Dartifactory.server=https://repo.spring.io ' +
154+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
155+
"./mvnw -s settings.xml -Pci,artifactory " +
156+
"-Dartifactory.server=${p['artifactory.url']} " +
156157
"-Dartifactory.username=${ARTIFACTORY_USR} " +
157158
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
158-
"-Dartifactory.staging-repository=libs-snapshot-local " +
159+
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
159160
"-Dartifactory.build-name=spring-data-redis " +
160161
"-Dartifactory.build-number=${BUILD_NUMBER} " +
161-
'-Dmaven.test.skip=true clean deploy -U -B'
162+
"-Dmaven.test.skip=true clean deploy -U -B"
162163
}
163164
}
164165
}

ci/pipeline.properties

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -
2525
docker.registry=
2626
docker.credentials=hub.docker.com-springbuildmaster
2727
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
28+
artifactory.url=https://repo.spring.io
29+
artifactory.repository.snapshot=libs-snapshot-local
30+
jenkins.user.name=spring-builds+jenkins

ci/test.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ cwd=$(pwd)
1010
# Launch Redis in proper configuration
1111
pushd /tmp && ln -s /work && make -f $cwd/Makefile start && popd
1212

13+
export JENKINS_USER=${JENKINS_USER_NAME}
14+
1315
# Execute maven test
14-
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B
16+
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B
1517

1618
# Capture resulting exit code from maven (pass/fail)
1719
RESULT=$?

0 commit comments

Comments
 (0)