Browse Source

Add CI matrix configuration for snapshot BWC versions (#83990)

Mark Vieira 3 years ago
parent
commit
2aab7cc868
2 changed files with 24 additions and 12 deletions
  1. 5 0
      .ci/snapshotBwcVersions
  2. 19 12
      build.gradle

+ 5 - 0
.ci/snapshotBwcVersions

@@ -0,0 +1,5 @@
+BWC_VERSION:
+  - "7.17.1"
+  - "8.0.1"
+  - "8.1.0"
+  - "8.2.0"

+ 19 - 12
build.gradle

@@ -68,17 +68,28 @@ ext.testArtifact = { p, String name = "test" ->
 }
 
 tasks.register("updateCIBwcVersions") {
-  doLast {
-    File yml = file(".ci/bwcVersions")
-    yml.text = ""
-    yml << "BWC_VERSION:\n"
-    BuildParams.bwcVersions.indexCompatible.each {
-      yml << "  - \"$it\"\n"
+  def writeVersions = { File file, List<Version> versions ->
+    file.text = ""
+    file << "BWC_VERSION:\n"
+    versions.each {
+      file << "  - \"$it\"\n"
     }
   }
+  doLast {
+    writeVersions(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
+    writeVersions(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
+  }
 }
 
 tasks.register("verifyVersions") {
+  def verifyCiYaml = { File file, List<Version> versions ->
+    String ciYml = file.text
+    versions.each {
+      if (ciYml.contains("\"$it\"\n") == false) {
+        throw new Exception("${file} is outdated, run `./gradlew updateCIBwcVersions` and check in the results")
+      }
+    }
+  }
   doLast {
     if (gradle.startParameter.isOffline()) {
       throw new GradleException("Must run in online mode to verify versions")
@@ -94,12 +105,8 @@ tasks.register("verifyVersions") {
           .collect { Version.fromString(it) }
       )
     }
-    String ciYml = file(".ci/bwcVersions").text
-    BuildParams.bwcVersions.indexCompatible.each {
-      if (ciYml.contains("\"$it\"\n") == false) {
-        throw new Exception(".ci/bwcVersions is outdated, run `./gradlew updateCIBwcVersions` and check in the results");
-      }
-    }
+    verifyCiYaml(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
+    verifyCiYaml(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
 
     // Make sure backport bot config file is up to date
     JsonNode backportConfig = new ObjectMapper().readTree(file(".backportrc.json"))