summaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2017-06-01 10:29:51 -0700
committerGitHub <noreply@github.com>2017-06-01 10:29:51 -0700
commit160a0499308b47eda65872d24ad29d9ac9c0c938 (patch)
tree4a6c94d9874c2082e838cea767c11cb44c09f079 /build.gradle
parent4fcead9a650560fa6047752cab64edbcefa2cc71 (diff)
Build: Move verifyVersions to new branchConsistency task (#25009)
This commit adds a new `branchConsistency` task which will run in CI once a day, instead of on every commit. This allows `verifyVersions` to not break immediately once a new version is released in maven.
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle36
1 files changed, 16 insertions, 20 deletions
diff --git a/build.gradle b/build.gradle
index 3b4e8db3be..00d1730a26 100644
--- a/build.gradle
+++ b/build.gradle
@@ -123,43 +123,39 @@ allprojects {
}
}
-task('verifyVersions') {
- description 'Verifies that all released versions that are indexed compatible are listed in Version.java.'
- group 'Verification'
- enabled = false == gradle.startParameter.isOffline()
+task verifyVersions {
doLast {
+ if (gradle.startParameter.isOffline()) {
+ throw new GradleException("Must run in online mode to verify versions")
+ }
// Read the list from maven central
Node xml
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
xml = new XmlParser().parse(s)
}
- Set<String> knownVersions = new TreeSet<>(xml.versioning.versions.version.collect { it.text() }.findAll { it ==~ /\d\.\d\.\d/ })
+ Set<Version> knownVersions = new TreeSet<>(xml.versioning.versions.version.collect { it.text() }.findAll { it ==~ /\d\.\d\.\d/ }.collect { Version.fromString(it) })
- // Limit the known versions to those that should be index compatible
- knownVersions = knownVersions.findAll { Integer.parseInt(it.split('\\.')[0]) >= prevMajor }
+ // Limit the known versions to those that should be index compatible, and are not future versions
+ knownVersions = knownVersions.findAll { it.major >= prevMajor && it.before(VersionProperties.elasticsearch) }
/* Limit the listed versions to those that have been marked as released.
* Versions not marked as released don't get the same testing and we want
* to make sure that we flip all unreleased versions to released as soon
* as possible after release. */
- Set<String> actualVersions = new TreeSet<>(
- indexCompatVersions
- .findAll { false == it.snapshot }
- .collect { it.toString() })
-
- // TODO this is almost certainly going to fail on 5.4 when we release 5.5.0
+ Set<Version> actualVersions = new TreeSet<>(indexCompatVersions.findAll { false == it.snapshot })
// Finally, compare!
- if (!knownVersions.equals(actualVersions)) {
- throw new GradleException("out-of-date released versions\nActual :" +
- actualVersions + "\nExpected:" + knownVersions +
- "\nUpdate Version.java. Note that Version.CURRENT doesn't count " +
- "because it is not released.")
+ if (knownVersions.equals(actualVersions) == false) {
+ throw new GradleException("out-of-date released versions\nActual :" + actualVersions + "\nExpected:" + knownVersions +
+ "\nUpdate Version.java. Note that Version.CURRENT doesn't count because it is not released.")
}
}
}
-task('precommit') {
- dependsOn(verifyVersions)
+
+task branchConsistency {
+ description 'Ensures this branch is internally consistent. For example, that versions constants match released versions.'
+ group 'Verification'
+ dependsOn verifyVersions
}
subprojects {