Skip to content

Commit 1312ae2

Browse files
committed
Test against Java 20 on CI.
See #4350.
1 parent 894acbb commit 1312ae2

File tree

4 files changed

+196
-3
lines changed

4 files changed

+196
-3
lines changed

Jenkinsfile

Lines changed: 126 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,67 @@ pipeline {
7777
}
7878
}
7979
}
80+
stage('Publish JDK (Java 20) + MongoDB 4.4') {
81+
when {
82+
anyOf {
83+
changeset "ci/openjdk20-mongodb-4.4/**"
84+
changeset "ci/pipeline.properties"
85+
}
86+
}
87+
agent { label 'data' }
88+
options { timeout(time: 30, unit: 'MINUTES') }
89+
90+
steps {
91+
script {
92+
def image = docker.build("springci/spring-data-with-mongodb-4.4:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg MONGODB=${p['docker.mongodb.4.4.version']} ci/openjdk20-mongodb-4.4/")
93+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
94+
image.push()
95+
}
96+
}
97+
}
98+
}
99+
stage('Publish JDK (Java 20) + MongoDB 5.0') {
100+
when {
101+
anyOf {
102+
changeset "ci/openjdk20-mongodb-5.0/**"
103+
changeset "ci/pipeline.properties"
104+
}
105+
}
106+
agent { label 'data' }
107+
options { timeout(time: 30, unit: 'MINUTES') }
108+
109+
steps {
110+
script {
111+
def image = docker.build("springci/spring-data-with-mongodb-5.0:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg MONGODB=${p['docker.mongodb.5.0.version']} ci/openjdk20-mongodb-5.0/")
112+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
113+
image.push()
114+
}
115+
}
116+
}
117+
}
118+
stage('Publish JDK (Java 20) + MongoDB 6.0') {
119+
when {
120+
anyOf {
121+
changeset "ci/openjdk20-mongodb-6.0/**"
122+
changeset "ci/pipeline.properties"
123+
}
124+
}
125+
agent { label 'data' }
126+
options { timeout(time: 30, unit: 'MINUTES') }
127+
128+
steps {
129+
script {
130+
def image = docker.build("springci/spring-data-with-mongodb-6.0:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg MONGODB=${p['docker.mongodb.6.0.version']} ci/openjdk20-mongodb-6.0/")
131+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
132+
image.push()
133+
}
134+
}
135+
}
136+
}
80137
}
81138
}
82139

83-
stage("test: baseline (Java 17)") {
140+
stage("test: baseline (main)") {
84141
when {
85142
beforeAgent(true)
86143
anyOf {
@@ -119,7 +176,73 @@ pipeline {
119176
}
120177
parallel {
121178

122-
stage("test: MongoDB 5.0 (Java 17)") {
179+
stage("test: MongoDB 5.0 (main)") {
180+
agent {
181+
label 'data'
182+
}
183+
options { timeout(time: 30, unit: 'MINUTES') }
184+
environment {
185+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
186+
}
187+
steps {
188+
script {
189+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-mongodb-5.0:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
190+
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
191+
sh 'mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
192+
sh 'sleep 10'
193+
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
194+
sh 'sleep 15'
195+
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'
196+
}
197+
}
198+
}
199+
}
200+
201+
stage("test: MongoDB 6.0 (main)") {
202+
agent {
203+
label 'data'
204+
}
205+
options { timeout(time: 30, unit: 'MINUTES') }
206+
environment {
207+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
208+
}
209+
steps {
210+
script {
211+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-mongodb-6.0:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
212+
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
213+
sh 'mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
214+
sh 'sleep 10'
215+
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
216+
sh 'sleep 15'
217+
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'
218+
}
219+
}
220+
}
221+
}
222+
223+
stage("test: MongoDB 4.4 (next)") {
224+
agent {
225+
label 'data'
226+
}
227+
options { timeout(time: 30, unit: 'MINUTES') }
228+
environment {
229+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
230+
}
231+
steps {
232+
script {
233+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-mongodb-5.0:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
234+
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
235+
sh 'mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
236+
sh 'sleep 10'
237+
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
238+
sh 'sleep 15'
239+
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'
240+
}
241+
}
242+
}
243+
}
244+
245+
stage("test: MongoDB 5.0 (next)") {
123246
agent {
124247
label 'data'
125248
}
@@ -141,7 +264,7 @@ pipeline {
141264
}
142265
}
143266

144-
stage("test: MongoDB 6.0 (Java 17)") {
267+
stage("test: MongoDB 6.0 (next)") {
145268
agent {
146269
label 'data'
147270
}

ci/openjdk20-mongodb-4.4/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ARG BASE
2+
FROM ${BASE}
3+
# Any ARG statements before FROM are cleared.
4+
ARG MONGODB
5+
6+
ENV TZ=Etc/UTC
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
RUN set -eux; \
10+
sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
11+
sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
12+
sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
13+
sed -i -e 's/http/https/g' /etc/apt/sources.list && \
14+
apt-get update && apt-get install -y apt-transport-https apt-utils gnupg2 && \
15+
apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --recv 656408E390CFB1F5 && \
16+
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list && \
17+
echo ${TZ} > /etc/timezone
18+
19+
RUN apt-get update && \
20+
apt-get install -y mongodb-org=${MONGODB} mongodb-org-server=${MONGODB} mongodb-org-shell=${MONGODB} mongodb-org-mongos=${MONGODB} mongodb-org-tools=${MONGODB} && \
21+
apt-get clean && \
22+
rm -rf /var/lib/apt/lists/*

ci/openjdk20-mongodb-5.0/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG BASE
2+
FROM ${BASE}
3+
# Any ARG statements before FROM are cleared.
4+
ARG MONGODB
5+
6+
ENV TZ=Etc/UTC
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
RUN set -eux; \
10+
sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
11+
sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
12+
sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
13+
sed -i -e 's/http/https/g' /etc/apt/sources.list && \
14+
apt-get update && apt-get install -y apt-transport-https apt-utils gnupg2 wget && \
15+
# MongoDB 5.0 release signing key
16+
apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --recv B00A0BD1E2C63C11 && \
17+
# Needed when MongoDB creates a 5.0 folder.
18+
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list && \
19+
echo ${TZ} > /etc/timezone
20+
21+
RUN apt-get update && \
22+
apt-get install -y mongodb-org=${MONGODB} mongodb-org-server=${MONGODB} mongodb-org-shell=${MONGODB} mongodb-org-mongos=${MONGODB} mongodb-org-tools=${MONGODB} && \
23+
apt-get clean && \
24+
rm -rf /var/lib/apt/lists/*

ci/openjdk20-mongodb-6.0/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ARG BASE
2+
FROM ${BASE}
3+
# Any ARG statements before FROM are cleared.
4+
ARG MONGODB
5+
6+
ENV TZ=Etc/UTC
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
RUN set -eux; \
10+
sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
11+
sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
12+
sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \
13+
sed -i -e 's/http/https/g' /etc/apt/sources.list && \
14+
apt-get update && apt-get install -y apt-transport-https apt-utils gnupg2 wget && \
15+
# MongoDB 6.0 release signing key
16+
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add - && \
17+
# Needed when MongoDB creates a 6.0 folder.
18+
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list && \
19+
echo ${TZ} > /etc/timezone
20+
21+
RUN apt-get update && \
22+
apt-get install -y mongodb-org=${MONGODB} mongodb-org-server=${MONGODB} mongodb-org-shell=${MONGODB} mongodb-org-mongos=${MONGODB} mongodb-org-tools=${MONGODB} && \
23+
apt-get clean && \
24+
rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)