Skip to content

Commit dc6227e

Browse files
committed
Use Docker hub credentials for all CI jobs.
Original: DATAREST-1584 Closes #1942
1 parent dcfdbdb commit dc6227e

File tree

2 files changed

+46
-37
lines changed

2 files changed

+46
-37
lines changed

Jenkinsfile

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,22 @@ pipeline {
2121
}
2222
}
2323
agent {
24-
docker {
25-
image 'springci/spring-data-openjdk8-with-mongodb-4.2.0:latest'
26-
label 'data'
27-
args '-v $HOME:/tmp/jenkins-home'
28-
}
24+
label 'data'
2925
}
3026
options { timeout(time: 30, unit: 'MINUTES') }
3127
steps {
32-
sh 'rm -rf ?'
33-
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
34-
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
35-
sh 'sleep 10'
36-
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
37-
sh 'sleep 15'
38-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean dependency:list test -Dsort -U -B -Pit'
28+
script {
29+
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
30+
docker.image('springci/spring-data-openjdk8-with-mongodb-4.2.0:latest').inside('-v $HOME:/tmp/jenkins-home') {
31+
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
32+
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
33+
sh 'sleep 10'
34+
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
35+
sh 'sleep 15'
36+
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean dependency:list test -Dsort -U -B -Pit'
37+
}
38+
}
39+
}
3940
}
4041
}
4142

@@ -47,11 +48,7 @@ pipeline {
4748
}
4849
}
4950
agent {
50-
docker {
51-
image 'adoptopenjdk/openjdk8:latest'
52-
label 'data'
53-
args '-v $HOME:/tmp/jenkins-home'
54-
}
51+
label 'data'
5552
}
5653
options { timeout(time: 20, unit: 'MINUTES') }
5754

@@ -60,27 +57,28 @@ pipeline {
6057
}
6158

6259
steps {
63-
sh 'rm -rf ?'
64-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,artifactory ' +
65-
'-Dartifactory.server=https://repo.spring.io ' +
66-
"-Dartifactory.username=${ARTIFACTORY_USR} " +
67-
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
68-
"-Dartifactory.staging-repository=libs-snapshot-local " +
69-
"-Dartifactory.build-name=spring-data-rest " +
70-
"-Dartifactory.build-number=${BUILD_NUMBER} " +
71-
'-Dmaven.test.skip=true clean deploy -U -B'
60+
script {
61+
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
62+
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
63+
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,artifactory ' +
64+
'-Dartifactory.server=https://repo.spring.io ' +
65+
"-Dartifactory.username=${ARTIFACTORY_USR} " +
66+
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
67+
"-Dartifactory.staging-repository=libs-snapshot-local " +
68+
"-Dartifactory.build-name=spring-data-rest " +
69+
"-Dartifactory.build-number=${BUILD_NUMBER} " +
70+
'-Dmaven.test.skip=true clean deploy -U -B'
71+
}
72+
}
73+
}
7274
}
7375
}
7476
stage('Publish documentation') {
7577
when {
7678
branch '3.2.x'
7779
}
7880
agent {
79-
docker {
80-
image 'adoptopenjdk/openjdk8:latest'
81-
label 'data'
82-
args '-v $HOME:/tmp/jenkins-home'
83-
}
81+
label 'data'
8482
}
8583
options { timeout(time: 20, unit: 'MINUTES') }
8684

@@ -89,12 +87,18 @@ pipeline {
8987
}
9088

9189
steps {
92-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,distribute ' +
93-
'-Dartifactory.server=https://repo.spring.io ' +
94-
"-Dartifactory.username=${ARTIFACTORY_USR} " +
95-
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
96-
"-Dartifactory.distribution-repository=temp-private-local " +
97-
'-Dmaven.test.skip=true clean deploy -U -B'
90+
script {
91+
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
92+
docker.image('adoptopenjdk/openjdk8:latest').inside('-v $HOME:/tmp/jenkins-home') {
93+
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pci,distribute ' +
94+
'-Dartifactory.server=https://repo.spring.io ' +
95+
"-Dartifactory.username=${ARTIFACTORY_USR} " +
96+
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
97+
"-Dartifactory.distribution-repository=temp-private-local " +
98+
'-Dmaven.test.skip=true clean deploy -U -B'
99+
}
100+
}
101+
}
98102
}
99103
}
100104
}

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@
140140
<id>spring-plugins-release</id>
141141
<url>https://repo.spring.io/plugins-release</url>
142142
</pluginRepository>
143+
<pluginRepository>
144+
<id>bintray-plugins</id>
145+
<name>bintray-plugins</name>
146+
<url>https://jcenter.bintray.com</url>
147+
</pluginRepository>
143148
</pluginRepositories>
144149

145150
</project>

0 commit comments

Comments
 (0)