Skip to content

Commit 0491ec3

Browse files
committed
Introduce property for Jenkins user and Artifactory server details.
Closes #4570
1 parent 14e500f commit 0491ec3

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

Jenkinsfile

+13-11
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ pipeline {
122122
sh 'sleep 10'
123123
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
124124
sh 'sleep 15'
125-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list test -Duser.name=jenkins -Dsort -U -B'
125+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
126+
"./mvnw -s settings.xml clean dependency:list test -Dsort -U -B"
126127
}
127128
}
128129
}
@@ -154,7 +155,8 @@ pipeline {
154155
sh 'sleep 10'
155156
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
156157
sh 'sleep 15'
157-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list test -Duser.name=jenkins -Dsort -U -B'
158+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
159+
"./mvnw -s settings.xml clean dependency:list test -Dsort -U -B"
158160
}
159161
}
160162
}
@@ -176,7 +178,8 @@ pipeline {
176178
sh 'sleep 10'
177179
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
178180
sh 'sleep 15'
179-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list test -Duser.name=jenkins -Dsort -U -B'
181+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
182+
"./mvnw -s settings.xml clean dependency:list test -Dsort -U -B"
180183
}
181184
}
182185
}
@@ -198,7 +201,8 @@ pipeline {
198201
sh 'sleep 10'
199202
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
200203
sh 'sleep 15'
201-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean dependency:list test -Duser.name=jenkins -Dsort -U -B'
204+
sh 'MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" ' +
205+
'./mvnw -s settings.xml clean dependency:list test -Dsort -U -B'
202206
}
203207
}
204208
}
@@ -218,23 +222,21 @@ pipeline {
218222
label 'data'
219223
}
220224
options { timeout(time: 20, unit: 'MINUTES') }
221-
222225
environment {
223226
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
224227
}
225-
226228
steps {
227229
script {
228230
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
229-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -v'
230-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
231-
'-Dartifactory.server=https://repo.spring.io ' +
231+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
232+
"./mvnw -s settings.xml -Pci,artifactory " +
233+
"-Dartifactory.server=${p['artifactory.url']} " +
232234
"-Dartifactory.username=${ARTIFACTORY_USR} " +
233235
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
234-
"-Dartifactory.staging-repository=libs-snapshot-local " +
236+
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
235237
"-Dartifactory.build-name=spring-data-mongodb " +
236238
"-Dartifactory.build-number=${BUILD_NUMBER} " +
237-
'-Dmaven.test.skip=true clean deploy -U -B'
239+
"-Dmaven.test.skip=true clean deploy -U -B"
238240
}
239241
}
240242
}

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

0 commit comments

Comments
 (0)