|
@@ -7,11 +7,14 @@
|
|
|
*/
|
|
|
|
|
|
import com.avast.gradle.dockercompose.tasks.ComposePull
|
|
|
+import com.fasterxml.jackson.databind.JsonNode
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper
|
|
|
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
|
|
import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
|
|
|
import org.elasticsearch.gradle.internal.BuildPlugin
|
|
|
import org.elasticsearch.gradle.Version
|
|
|
import org.elasticsearch.gradle.VersionProperties
|
|
|
+import org.elasticsearch.gradle.internal.BwcVersions
|
|
|
import org.elasticsearch.gradle.internal.info.BuildParams
|
|
|
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
|
|
|
import org.gradle.plugins.ide.eclipse.model.AccessRule
|
|
@@ -107,6 +110,28 @@ tasks.register("verifyVersions") {
|
|
|
throw new Exception(".ci/bwcVersions is outdated, run `./gradlew updateCIBwcVersions` and check in the results");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // Make sure backport bot config file is up to date
|
|
|
+ JsonNode backportConfig = new ObjectMapper().readTree(file(".backportrc.json"))
|
|
|
+ List<BwcVersions.UnreleasedVersionInfo> unreleased = BuildParams.bwcVersions.unreleased.collect { BuildParams.bwcVersions.unreleasedInfo(it) }
|
|
|
+ unreleased.each { unreleasedVersion ->
|
|
|
+ boolean valid = backportConfig.get("targetBranchChoices").elements().any { branchChoice ->
|
|
|
+ if (branchChoice.isObject()) {
|
|
|
+ return branchChoice.get("name").textValue() == unreleasedVersion.branch
|
|
|
+ } else {
|
|
|
+ return branchChoice.textValue() == unreleasedVersion.branch
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (valid == false) {
|
|
|
+ throw new GradleException("No branch choice exists for development branch ${unreleasedVersion.branch} in .backportrc.json.")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BwcVersions.UnreleasedVersionInfo nextMinor = unreleased.find { it.branch.endsWith("x") }
|
|
|
+ String versionMapping = backportConfig.get("branchLabelMapping").fields().find { it.value.textValue() == nextMinor.branch }.key
|
|
|
+ if (versionMapping != "^v${nextMinor.version}\$") {
|
|
|
+ throw new GradleException("Backport label mapping for branch ${nextMinor.branch} is '${versionMapping}' but should be " +
|
|
|
+ "'^v${nextMinor.version}\$'. Update .backportrc.json.")
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|