Skip to content

Commit 0923e08

Browse files
authored
Use all lucene index compatible versions for bwc version generation (elastic#87133)
The updateCIBwcVersions task regenerates the list of versions that are tested in CI. This task internally calls a filter method which filters out incompatible versions for the local system. That means it can change depending on the type of system the task is run on. This commit adds a new variant of the internal method to return all actual index compatible versions, and renames the existing method to make it clear it is for running actual tests on the local system.
1 parent 15b8fc3 commit 0923e08

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcVersions.java

+14-3
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,21 @@ private List<Version> getReleased() {
229229
return versions.stream().map(v -> v.elasticsearch).filter(v -> unreleased.containsKey(v) == false).toList();
230230
}
231231

232+
/**
233+
* Return versions of Elasticsearch which are index compatible with the current version, and also work on the local machine.
234+
*/
232235
public List<Version> getIndexCompatible() {
233-
return filterSupportedVersions(
234-
versions.stream().filter(v -> v.lucene.getMajor() >= (currentVersion.lucene.getMajor() - 1)).map(v -> v.elasticsearch).toList()
235-
);
236+
return filterSupportedVersions(getAllIndexCompatible());
237+
}
238+
239+
/**
240+
* Return all versions of Elasticsearch which are index compatible with the current version.
241+
*/
242+
public List<Version> getAllIndexCompatible() {
243+
return versions.stream()
244+
.filter(v -> v.lucene.getMajor() >= (currentVersion.lucene.getMajor() - 1))
245+
.map(v -> v.elasticsearch)
246+
.toList();
236247
}
237248

238249
public void withIndexCompatible(BiConsumer<Version, String> versionAction) {

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ tasks.register("updateCIBwcVersions") {
7676
}
7777
}
7878
doLast {
79-
writeVersions(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
79+
writeVersions(file(".ci/bwcVersions"), BuildParams.bwcVersions.allIndexCompatible)
8080
writeVersions(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
8181
}
8282
}
@@ -105,7 +105,7 @@ tasks.register("verifyVersions") {
105105
.collect { Version.fromString(it) }
106106
)
107107
}
108-
verifyCiYaml(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
108+
verifyCiYaml(file(".ci/bwcVersions"), BuildParams.bwcVersions.allIndexCompatible)
109109
verifyCiYaml(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
110110

111111
// Make sure backport bot config file is up to date

0 commit comments

Comments
 (0)