Skip to content

Commit 63e3abd

Browse files
mark-vieirageorgewallace
authored andcommitted
Add build artifact containing json file of all wire compatible versions (elastic#123740)
1 parent b43d7af commit 63e3abd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,22 @@ tasks.register("verifyVersions") {
229229
}
230230
}
231231

232+
def generateUpgradeCompatibilityFile = tasks.register("generateUpgradeCompatibilityFile") {
233+
def outputFile = project.layout.buildDirectory.file("rolling-upgrade-compatible-${VersionProperties.elasticsearch}.json")
234+
def rollingUpgradeCompatibleVersions = buildParams.bwcVersions.wireCompatible - VersionProperties.elasticsearchVersion
235+
inputs.property("rollingUpgradeCompatibleVersions", rollingUpgradeCompatibleVersions)
236+
outputs.file(outputFile)
237+
doLast {
238+
def versionsString = rollingUpgradeCompatibleVersions.collect { "\"${it.toString()}\"" }.join(', ')
239+
outputFile.get().asFile.write("""{"rolling_upgrade_compatible_versions" : [${versionsString}]}""")
240+
}
241+
}
242+
243+
def upgradeCompatibilityZip = tasks.register("upgradeCompatibilityZip", Zip) {
244+
archiveFile.set(project.layout.buildDirectory.file("rolling-upgrade-compatible-${VersionProperties.elasticsearch}.zip"))
245+
from(generateUpgradeCompatibilityFile)
246+
}
247+
232248
// TODO: This flag existed as a mechanism to disable bwc tests during a backport. It is no
233249
// longer used for that purpose, but instead a way to run only functional tests. We should
234250
// rework the functionalTests task to be more explicit about which tasks it wants to run
@@ -483,6 +499,7 @@ tasks.register("buildReleaseArtifacts").configure {
483499
}
484500
.collect { GradleUtils.findByName(it.tasks, 'assemble') }
485501
.findAll { it != null }
502+
dependsOn upgradeCompatibilityZip
486503
}
487504

488505
tasks.register("spotlessApply").configure {

0 commit comments

Comments
 (0)