Skip to content

Commit 106760e

Browse files
committed
Introduce property for Jenkins user and Artifactory server details.
Closes #4570
1 parent 8a0aabc commit 106760e

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
@@ -41,7 +41,8 @@ pipeline {
4141
sh 'sleep 10'
4242
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
4343
sh 'sleep 15'
44-
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'
44+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
45+
"./mvnw -s settings.xml clean dependency:list test -Dsort -U -B"
4546
}
4647
}
4748
}
@@ -73,7 +74,8 @@ pipeline {
7374
sh 'sleep 10'
7475
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
7576
sh 'sleep 15'
76-
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'
77+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
78+
"./mvnw -s settings.xml clean dependency:list test -Dsort -U -B"
7779
}
7880
}
7981
}
@@ -95,7 +97,8 @@ pipeline {
9597
sh 'sleep 10'
9698
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
9799
sh 'sleep 15'
98-
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'
100+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
101+
"./mvnw -s settings.xml clean dependency:list test -Dsort -U -B"
99102
}
100103
}
101104
}
@@ -117,7 +120,8 @@ pipeline {
117120
sh 'sleep 10'
118121
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
119122
sh 'sleep 15'
120-
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'
123+
sh 'MAVEN_OPTS="-Duser.name=spring-builds+jenkins -Duser.home=/tmp/jenkins-home" ' +
124+
'./mvnw -s settings.xml clean dependency:list test -Dsort -U -B'
121125
}
122126
}
123127
}
@@ -137,23 +141,21 @@ pipeline {
137141
label 'data'
138142
}
139143
options { timeout(time: 20, unit: 'MINUTES') }
140-
141144
environment {
142145
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
143146
}
144-
145147
steps {
146148
script {
147149
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
148-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -v'
149-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
150-
'-Dartifactory.server=https://repo.spring.io ' +
150+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
151+
"./mvnw -s settings.xml -Pci,artifactory " +
152+
"-Dartifactory.server=${p['artifactory.url']} " +
151153
"-Dartifactory.username=${ARTIFACTORY_USR} " +
152154
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
153-
"-Dartifactory.staging-repository=libs-snapshot-local " +
155+
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
154156
"-Dartifactory.build-name=spring-data-mongodb " +
155157
"-Dartifactory.build-number=${BUILD_NUMBER} " +
156-
'-Dmaven.test.skip=true clean deploy -U -B'
158+
"-Dmaven.test.skip=true clean deploy -U -B"
157159
}
158160
}
159161
}

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)