43
Jenkinsfile
vendored
43
Jenkinsfile
vendored
@@ -58,6 +58,25 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish JDK (Java 17) + MongoDB 6.0') {
|
||||
when {
|
||||
anyOf {
|
||||
changeset "ci/openjdk17-mongodb-6.0/**"
|
||||
changeset "ci/pipeline.properties"
|
||||
}
|
||||
}
|
||||
agent { label 'data' }
|
||||
options { timeout(time: 30, unit: 'MINUTES') }
|
||||
|
||||
steps {
|
||||
script {
|
||||
def image = docker.build("springci/spring-data-with-mongodb-6.0:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg MONGODB=${p['docker.mongodb.6.0.version']} ci/openjdk17-mongodb-6.0/")
|
||||
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
|
||||
image.push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +119,7 @@ pipeline {
|
||||
}
|
||||
parallel {
|
||||
|
||||
stage("test: mongodb 5.0 (Java 17)") {
|
||||
stage("test: MongoDB 5.0 (Java 17)") {
|
||||
agent {
|
||||
label 'data'
|
||||
}
|
||||
@@ -121,6 +140,28 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("test: MongoDB 6.0 (Java 17)") {
|
||||
agent {
|
||||
label 'data'
|
||||
}
|
||||
options { timeout(time: 30, unit: 'MINUTES') }
|
||||
environment {
|
||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
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']) {
|
||||
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
|
||||
sh 'mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
|
||||
sh 'sleep 10'
|
||||
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
|
||||
sh 'sleep 15'
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
23
ci/openjdk17-mongodb-6.0/Dockerfile
Normal file
23
ci/openjdk17-mongodb-6.0/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
ARG BASE
|
||||
FROM ${BASE}
|
||||
# Any ARG statements before FROM are cleared.
|
||||
ARG MONGODB
|
||||
|
||||
ENV TZ=Etc/UTC
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN set -eux && \
|
||||
sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
|
||||
sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \
|
||||
sed -i -e 's/http/https/g' /etc/apt/sources.list && \
|
||||
apt-get update && apt-get install -y apt-transport-https apt-utils gnupg2 wget && \
|
||||
# MongoDB 6.0 release signing key
|
||||
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add - && \
|
||||
# Needed when MongoDB creates a 6.0 folder.
|
||||
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list && \
|
||||
echo ${TZ} > /etc/timezone
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y mongodb-org=${MONGODB} mongodb-org-server=${MONGODB} mongodb-org-shell=${MONGODB} mongodb-org-mongos=${MONGODB} mongodb-org-tools=${MONGODB} && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
@@ -7,6 +7,7 @@ docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/ecli
|
||||
# Supported versions of MongoDB
|
||||
docker.mongodb.4.4.version=4.4.12
|
||||
docker.mongodb.5.0.version=5.0.6
|
||||
docker.mongodb.6.0.version=6.0.0
|
||||
|
||||
# Supported versions of Redis
|
||||
docker.redis.6.version=6.2.6
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.data.mongodb.core.aggregation;
|
||||
|
||||
import static org.springframework.data.domain.Sort.Direction.*;
|
||||
import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;
|
||||
import static org.springframework.data.mongodb.core.aggregation.Fields.*;
|
||||
import static org.springframework.data.mongodb.core.query.Criteria.*;
|
||||
import static org.springframework.data.mongodb.test.util.Assertions.*;
|
||||
|
||||
@@ -42,8 +41,6 @@ import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.assertj.core.data.Offset;
|
||||
import org.bson.Document;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
@@ -73,6 +70,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.NearQuery;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.repository.Person;
|
||||
import org.springframework.data.mongodb.test.util.EnableIfMongoServerVersion;
|
||||
import org.springframework.data.mongodb.test.util.MongoTemplateExtension;
|
||||
import org.springframework.data.mongodb.test.util.MongoTestTemplate;
|
||||
import org.springframework.data.mongodb.test.util.MongoVersion;
|
||||
@@ -100,7 +98,6 @@ import com.mongodb.client.model.WriteModel;
|
||||
public class AggregationTests {
|
||||
|
||||
private static final String INPUT_COLLECTION = "aggregation_test_collection";
|
||||
private static final Log LOGGER = LogFactory.getLog(AggregationTests.class);
|
||||
|
||||
private static boolean initialized = false;
|
||||
|
||||
@@ -318,6 +315,7 @@ public class AggregationTests {
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1391
|
||||
@EnableIfMongoServerVersion(isLessThan = "6.0") // $sort does not seem to have an effect on $unwind
|
||||
void shouldUnwindPreserveEmpty() {
|
||||
|
||||
MongoCollection<Document> coll = mongoTemplate.getCollection(INPUT_COLLECTION);
|
||||
@@ -1375,7 +1373,8 @@ public class AggregationTests {
|
||||
|
||||
mongoTemplate.dropCollection(ObjectWithDate.class);
|
||||
|
||||
ZonedDateTime dateTime = ZonedDateTime.of(LocalDateTime.of(LocalDate.of(2014, 2, 7), LocalTime.of(3, 4, 5, 6)), ZoneId.of("UTC"));
|
||||
ZonedDateTime dateTime = ZonedDateTime.of(LocalDateTime.of(LocalDate.of(2014, 2, 7), LocalTime.of(3, 4, 5, 6)),
|
||||
ZoneId.of("UTC"));
|
||||
|
||||
ObjectWithDate owd = new ObjectWithDate(Date.from(dateTime.toInstant()));
|
||||
mongoTemplate.insert(owd);
|
||||
@@ -1706,10 +1705,8 @@ public class AggregationTests {
|
||||
.forExpression(ConditionalOperators.Cond.when("applyDiscount").then(0.9D).otherwise(1.0D));
|
||||
|
||||
TypedAggregation<Sales2> agg = Aggregation.newAggregation(Sales2.class,
|
||||
Aggregation.project()
|
||||
.and(VariableOperators.Let.define(total, discounted).andApply(
|
||||
ArithmeticOperators.valueOf("total").multiplyBy("discounted")))
|
||||
.as("finalTotal"));
|
||||
Aggregation.project().and(VariableOperators.Let.define(total, discounted)
|
||||
.andApply(ArithmeticOperators.valueOf("total").multiplyBy("discounted"))).as("finalTotal"));
|
||||
|
||||
AggregationResults<Document> result = mongoTemplate.aggregate(agg, Document.class);
|
||||
assertThat(result.getMappedResults()).contains(new Document("_id", "1").append("finalTotal", 9.450000000000001D),
|
||||
|
||||
@@ -61,8 +61,8 @@ See also the https://www.mongodb.com/docs/drivers/java/sync/current/compatibilit
|
||||
|
||||
|2022.0
|
||||
|4.0.x
|
||||
|4.6.x
|
||||
|5.0.x
|
||||
|4.7.x
|
||||
|6.0.x
|
||||
|
||||
|2021.2
|
||||
|3.4.x
|
||||
|
||||
Reference in New Issue
Block a user