Skip to content

Commit f9cb278

Browse files
committed
Polishing.
Remove lingering dockerfiles. Use custom docker image for Cassandra build and OpenJDK 17 image for artifact deployment. Apply consistent formatting. Add missing since tag. See #1170
1 parent 8cf07ed commit f9cb278

File tree

8 files changed

+23
-120
lines changed

8 files changed

+23
-120
lines changed

Diff for: Jenkinsfile

+7-37
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pipeline {
33

44
triggers {
55
pollSCM 'H/10 * * * *'
6-
upstream(upstreamProjects: "spring-data-commons/main", threshold: hudson.model.Result.SUCCESS)
6+
upstream(upstreamProjects: "spring-data-commons/3.0.x", threshold: hudson.model.Result.SUCCESS)
77
}
88

99
options {
@@ -16,14 +16,14 @@ pipeline {
1616
parallel {
1717
stage('Publish JDK 17 + Cassandra 3.11') {
1818
when {
19-
changeset "ci/openjdk17-cassandra-3.11/**"
19+
changeset "ci/openjdk17-8-cassandra-3.11/**"
2020
}
2121
agent { label 'data' }
2222
options { timeout(time: 30, unit: 'MINUTES') }
2323

2424
steps {
2525
script {
26-
def image = docker.build("springci/spring-data-openjdk17-cassandra-3.11", "ci/openjdk17-cassandra-3.11/")
26+
def image = docker.build("springci/spring-data-openjdk17-8-cassandra-3.11", "ci/openjdk17-8-cassandra-3.11/")
2727
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
2828
image.push()
2929
}
@@ -33,7 +33,7 @@ pipeline {
3333
}
3434
}
3535

36-
stage("test: baseline (jdk17)") {
36+
stage("test: baseline (Java 17)") {
3737
when {
3838
beforeAgent(true)
3939
anyOf {
@@ -51,9 +51,9 @@ pipeline {
5151
steps {
5252
script {
5353
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
54-
docker.image('springci/spring-data-openjdk17-cassandra-3.11:latest').inside('-u root -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v $HOME:/tmp/jenkins-home') {
54+
docker.image('springci/spring-data-openjdk17-8-cassandra-3.11:latest').inside('-v $HOME:/tmp/jenkins-home') {
5555
sh 'mkdir -p /tmp/jenkins-home'
56-
sh 'JAVA_HOME=/opt/java/openjdk /opt/cassandra/bin/cassandra -R &'
56+
sh 'JAVA_HOME=/opt/java/openjdk8 /opt/cassandra/bin/cassandra -R &'
5757
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,external-cassandra clean dependency:list verify -Dsort -U -B'
5858
}
5959
}
@@ -81,7 +81,7 @@ pipeline {
8181
steps {
8282
script {
8383
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
84-
docker.image('adoptopenjdk/openjdk17:latest').inside('-u root -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v $HOME:/tmp/jenkins-home') {
84+
docker.image('openjdk:17-bullseye').inside('-v $HOME:/tmp/jenkins-home') {
8585
sh 'mkdir -p /tmp/jenkins-home'
8686
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory ' +
8787
'-Dartifactory.server=https://repo.spring.io ' +
@@ -96,36 +96,6 @@ pipeline {
9696
}
9797
}
9898
}
99-
100-
stage('Publish documentation') {
101-
when {
102-
branch 'main'
103-
}
104-
agent {
105-
label 'data'
106-
}
107-
options { timeout(time: 20, unit: 'MINUTES') }
108-
109-
environment {
110-
ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c')
111-
}
112-
113-
steps {
114-
script {
115-
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
116-
docker.image('adoptopenjdk/openjdk17:latest').inside('-u root -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v $HOME:/tmp/jenkins-home') {
117-
sh 'mkdir -p /tmp/jenkins-home'
118-
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,distribute ' +
119-
'-Dartifactory.server=https://repo.spring.io ' +
120-
"-Dartifactory.username=${ARTIFACTORY_USR} " +
121-
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
122-
"-Dartifactory.distribution-repository=temp-private-local " +
123-
'-Dmaven.test.skip=true clean deploy -U -B'
124-
}
125-
}
126-
}
127-
}
128-
}
12999
}
130100

131101
post {

Diff for: ci/openjdk11-8-cassandra-3.11/Dockerfile

-24
This file was deleted.

Diff for: ci/openjdk17-8-cassandra-3.11/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM openjdk:17-bullseye
22

33
RUN set -eux; \
4-
CASSANDRA_URL='https://archive.apache.org/dist/cassandra/3.11.10/apache-cassandra-3.11.10-bin.tar.gz'; \
4+
CASSANDRA_URL='https://archive.apache.org/dist/cassandra/3.11.11/apache-cassandra-3.11.11-bin.tar.gz'; \
55
sed -i -e 's/http/https/g' /etc/apt/sources.list ; \
66
curl -LfsSo /tmp/cassandra.tar.gz ${CASSANDRA_URL}; \
77
mkdir -p /opt/cassandra /opt/cassandra/data /opt/cassandra/logs; \

Diff for: ci/openjdk17-cassandra-3.11/Dockerfile

-23
This file was deleted.

Diff for: ci/openjdk8-cassandra-3.11/Dockerfile

-15
This file was deleted.

Diff for: spring-data-cassandra/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<groupId>org.apache.geronimo.specs</groupId>
113113
<artifactId>geronimo-jcdi_2.0_spec</artifactId>
114114
<version>1.0.1</version>
115-
<scope>test</scope>
115+
<scope>provided</scope>
116116
</dependency>
117117

118118
<dependency>

Diff for: spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/convert/QueryMapper.java

+9-15
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ public Filter getMappedObject(Filter filter, CassandraPersistentEntity<?> entity
121121

122122
field.getProperty().filter(CassandraPersistentProperty::isCompositePrimaryKey).ifPresent(it -> {
123123
throw new IllegalArgumentException(
124-
"Cannot use composite primary key directly. Reference a property of the composite primary key");
124+
"Cannot use composite primary key directly. Reference a property of the composite primary key");
125125
});
126126

127127
field.getProperty().filter(CassandraPersistentProperty::hasOrdinal).ifPresent(it -> {
128128
throw new IllegalArgumentException(
129-
String.format("Cannot reference tuple value elements, property [%s]", field.getMappedKey()));
129+
String.format("Cannot reference tuple value elements, property [%s]", field.getMappedKey()));
130130
});
131131

132132
Predicate predicate = criteriaDefinition.getPredicate();
@@ -224,9 +224,7 @@ private Selector getMappedSelector(Selector selector, CqlIdentifier cqlIdentifie
224224

225225
}).toArray());
226226

227-
return functionCall.getAlias()
228-
.map(mappedFunctionCall::as)
229-
.orElse(mappedFunctionCall);
227+
return functionCall.getAlias().map(mappedFunctionCall::as).orElse(mappedFunctionCall);
230228
}
231229

232230
throw new IllegalArgumentException(String.format("Selector [%s] not supported", selector));
@@ -345,18 +343,16 @@ private List<CqlIdentifier> getCqlIdentifier(ColumnName column, Field field) {
345343

346344
Field createPropertyField(@Nullable CassandraPersistentEntity<?> entity, ColumnName key) {
347345

348-
return Optional.ofNullable(entity)
349-
.<Field>map(e -> new MetadataBackedField(key, e, getMappingContext()))
350-
.orElseGet(() -> new Field(key));
346+
return Optional.ofNullable(entity).<Field> map(e -> new MetadataBackedField(key, e, getMappingContext()))
347+
.orElseGet(() -> new Field(key));
351348
}
352349

353350
ColumnType getColumnType(Field field, @Nullable Object value, ColumnTypeTransformer operator) {
354351

355352
ColumnTypeResolver resolver = converter.getColumnTypeResolver();
356353

357-
return field.getProperty()
358-
.map(it -> operator.transform(resolver.resolve(it), it))
359-
.orElseGet(() -> resolver.resolve(value));
354+
return field.getProperty().map(it -> operator.transform(resolver.resolve(it), it))
355+
.orElseGet(() -> resolver.resolve(value));
360356
}
361357

362358
/**
@@ -462,10 +458,8 @@ ColumnType transform(ColumnType typeDescriptor, CassandraPersistentProperty prop
462458
static ColumnTypeTransformer of(Field field, CriteriaDefinition.Operator operator) {
463459

464460
if (operator == CriteriaDefinition.Operators.CONTAINS) {
465-
return field.getProperty()
466-
.filter(CassandraPersistentProperty::isMapLike)
467-
.map(it -> MAP_VALUE_TYPE)
468-
.orElse(COLLECTION_COMPONENT_TYPE);
461+
return field.getProperty().filter(CassandraPersistentProperty::isMapLike).map(it -> MAP_VALUE_TYPE)
462+
.orElse(COLLECTION_COMPONENT_TYPE);
469463
}
470464

471465
if (operator == CriteriaDefinition.Operators.CONTAINS_KEY) {

Diff for: spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraPersistentProperty.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,13 @@ default int getRequiredOrdinal() {
125125
}
126126

127127
/**
128-
* Determines whether this {@link CassandraPersistentProperty} is persisted (mapped) to an element ordinal
129-
* when the owning type is a mapped tuple.
128+
* Determines whether this {@link CassandraPersistentProperty} is persisted (mapped) to an element ordinal when the
129+
* owning type is a mapped tuple.
130130
*
131-
* @return a boolean value indicating whether this {@link CassandraPersistentProperty} is persisted (mapped) to
132-
* an element ordinal when the owning type is a mapped tuple.
131+
* @return a boolean value indicating whether this {@link CassandraPersistentProperty} is persisted (mapped) to an
132+
* element ordinal when the owning type is a mapped tuple.
133133
* @see #getOrdinal()
134+
* @since 4.0
134135
*/
135136
default boolean hasOrdinal() {
136137
return getOrdinal() != null;

0 commit comments

Comments
 (0)