Browse Source

Use all lucene index compatible versions for bwc version generation (#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.
Ryan Ernst 3 năm trước cách đây
mục cha
commit
0923e08226

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

@@ -229,10 +229,21 @@ public class BwcVersions {
         return versions.stream().map(v -> v.elasticsearch).filter(v -> unreleased.containsKey(v) == false).toList();
     }
 
+    /**
+     * Return versions of Elasticsearch which are index compatible with the current version, and also work on the local machine.
+     */
     public List<Version> getIndexCompatible() {
-        return filterSupportedVersions(
-            versions.stream().filter(v -> v.lucene.getMajor() >= (currentVersion.lucene.getMajor() - 1)).map(v -> v.elasticsearch).toList()
-        );
+        return filterSupportedVersions(getAllIndexCompatible());
+    }
+
+    /**
+     * Return all versions of Elasticsearch which are index compatible with the current version.
+     */
+    public List<Version> getAllIndexCompatible() {
+        return versions.stream()
+            .filter(v -> v.lucene.getMajor() >= (currentVersion.lucene.getMajor() - 1))
+            .map(v -> v.elasticsearch)
+            .toList();
     }
 
     public void withIndexCompatible(BiConsumer<Version, String> versionAction) {

+ 2 - 2
build.gradle

@@ -76,7 +76,7 @@ tasks.register("updateCIBwcVersions") {
     }
   }
   doLast {
-    writeVersions(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
+    writeVersions(file(".ci/bwcVersions"), BuildParams.bwcVersions.allIndexCompatible)
     writeVersions(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
   }
 }
@@ -105,7 +105,7 @@ tasks.register("verifyVersions") {
           .collect { Version.fromString(it) }
       )
     }
-    verifyCiYaml(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
+    verifyCiYaml(file(".ci/bwcVersions"), BuildParams.bwcVersions.allIndexCompatible)
     verifyCiYaml(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
 
     // Make sure backport bot config file is up to date