Skip to content

Commit 1cef721

Browse files
committed
Add CI matrix configuration for snapshot BWC versions (elastic#83990)
# Conflicts: # build.gradle
1 parent eedb9b1 commit 1cef721

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

.ci/snapshotBwcVersions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BWC_VERSION:
2+
- "6.8.24"

build.gradle

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,28 @@ ext.testArtifact = { p, String name = "test" ->
6767
}
6868

6969
tasks.register("updateCIBwcVersions") {
70-
doLast {
71-
File yml = file(".ci/bwcVersions")
72-
yml.text = ""
73-
yml << "BWC_VERSION:\n"
74-
BuildParams.bwcVersions.indexCompatible.each {
75-
yml << " - \"$it\"\n"
70+
def writeVersions = { File file, List<Version> versions ->
71+
file.text = ""
72+
file << "BWC_VERSION:\n"
73+
versions.each {
74+
file << " - \"$it\"\n"
7675
}
7776
}
77+
doLast {
78+
writeVersions(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
79+
writeVersions(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
80+
}
7881
}
7982

8083
tasks.register("verifyVersions") {
84+
def verifyCiYaml = { File file, List<Version> versions ->
85+
String ciYml = file.text
86+
versions.each {
87+
if (ciYml.contains("\"$it\"\n") == false) {
88+
throw new Exception("${file} is outdated, run `./gradlew updateCIBwcVersions` and check in the results")
89+
}
90+
}
91+
}
8192
doLast {
8293
if (gradle.startParameter.isOffline()) {
8394
throw new GradleException("Must run in online mode to verify versions")
@@ -93,12 +104,8 @@ tasks.register("verifyVersions") {
93104
.collect { Version.fromString(it) }
94105
)
95106
}
96-
String ciYml = file(".ci/bwcVersions").text
97-
BuildParams.bwcVersions.indexCompatible.each {
98-
if (ciYml.contains("\"$it\"\n") == false) {
99-
throw new Exception(".ci/bwcVersions is outdated, run `./gradlew updateCIBwcVersions` and check in the results");
100-
}
101-
}
107+
verifyCiYaml(file(".ci/bwcVersions"), BuildParams.bwcVersions.indexCompatible)
108+
verifyCiYaml(file(".ci/snapshotBwcVersions"), BuildParams.bwcVersions.unreleasedIndexCompatible)
102109
}
103110
}
104111

0 commit comments

Comments
 (0)