Skip to content

Commit

Permalink
Fix verifyVersions gradle task and cleanup bwcVersions (#1878)
Browse files Browse the repository at this point in the history
Signed-off-by: Rabi Panda <[email protected]>
  • Loading branch information
adnapibar authored Jan 11, 2022
1 parent 40442aa commit 8fbd8cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 58 deletions.
48 changes: 0 additions & 48 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
@@ -1,50 +1,4 @@
BWC_VERSION:
- "6.0.0"
- "6.0.1"
- "6.1.0"
- "6.1.1"
- "6.1.2"
- "6.1.3"
- "6.1.4"
- "6.2.0"
- "6.2.1"
- "6.2.2"
- "6.2.3"
- "6.2.4"
- "6.3.0"
- "6.3.1"
- "6.3.2"
- "6.4.0"
- "6.4.1"
- "6.4.2"
- "6.4.3"
- "6.5.0"
- "6.5.1"
- "6.5.2"
- "6.5.3"
- "6.5.4"
- "6.6.0"
- "6.6.1"
- "6.6.2"
- "6.7.0"
- "6.7.1"
- "6.7.2"
- "6.8.0"
- "6.8.1"
- "6.8.2"
- "6.8.3"
- "6.8.4"
- "6.8.5"
- "6.8.6"
- "6.8.7"
- "6.8.8"
- "6.8.9"
- "6.8.10"
- "6.8.11"
- "6.8.12"
- "6.8.13"
- "6.8.14"
- "6.8.15"
- "7.0.0"
- "7.0.1"
- "7.1.0"
Expand Down Expand Up @@ -75,9 +29,7 @@ BWC_VERSION:
- "7.10.1"
- "7.10.2"
- "1.0.0"
- "1.0.1"
- "1.1.0"
- "1.1.1"
- "1.2.0"
- "1.2.1"
- "1.2.2"
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ tasks.register("verifyVersions") {
// Read the list from maven central.
// Fetch the metadata and parse the xml into Version instances because it's more straight forward here
// rather than bwcVersion ( VersionCollection ).
//TODO OpenSearch - Update the maven repo URL for OpenSearch when available.
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
new URL('https://repo1.maven.org/maven2/org/opensearch/opensearch/maven-metadata.xml').openStream().withStream { s ->
BuildParams.bwcVersions.compareToAuthoritative(
new XmlParser().parse(s)
.versioning.versions.version
Expand Down Expand Up @@ -433,11 +432,11 @@ allprojects {
tasks.named('cleanEclipse') { dependsOn 'wipeEclipseSettings' }
// otherwise the eclipse merging is *super confusing*
tasks.named('eclipse') { dependsOn 'cleanEclipse', 'copyEclipseSettings' }

afterEvaluate {
tasks.findByName("eclipseJdt")?.configure {
dependsOn 'copyEclipseSettings'
}
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/java/org/opensearch/gradle/BwcVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ private List<Version> getReleased() {
.stream()
.flatMap(Collection::stream)
.filter(each -> unreleased.contains(each) == false)
// this is to make sure we only consider OpenSearch versions
// TODO remove this filter once legacy ES versions are no longer supported
.filter(v -> v.onOrAfter("1.0.0"))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,14 +716,14 @@ public void testGetGradleProjectPath() {
}

public void testCompareToAuthoritative() {
List<String> listOfVersions = asList("7.0.0", "7.0.1", "7.1.0", "7.1.1", "7.2.0", "7.3.0", "8.0.0");
List<Version> authoritativeReleasedVersions = Stream.of("7.0.0", "7.0.1", "7.1.0")
List<String> listOfVersions = asList("1.0.0", "1.0.1", "1.1.0", "1.1.1", "1.2.0", "1.3.0", "2.0.0");
List<Version> authoritativeReleasedVersions = Stream.of("1.0.0", "1.0.1", "1.1.0")
.map(Version::fromString)
.collect(Collectors.toList());

BwcVersions vc = new BwcVersions(
listOfVersions.stream().map(this::formatVersionToLine).collect(Collectors.toList()),
Version.fromString("8.0.0")
Version.fromString("2.0.0")
);
vc.compareToAuthoritative(authoritativeReleasedVersions);
}
Expand All @@ -744,11 +744,11 @@ public void testCompareToAuthoritativeUnreleasedActuallyReleased() {
}

public void testCompareToAuthoritativeNotReallyRelesed() {
List<String> listOfVersions = asList("7.0.0", "7.0.1", "7.1.0", "7.1.1", "7.2.0", "7.3.0", "8.0.0");
List<Version> authoritativeReleasedVersions = Stream.of("7.0.0", "7.0.1").map(Version::fromString).collect(Collectors.toList());
List<String> listOfVersions = asList("1.0.0", "1.0.1", "1.1.0", "1.1.1", "1.2.0", "1.3.0", "2.0.0");
List<Version> authoritativeReleasedVersions = Stream.of("1.0.0", "1.0.1").map(Version::fromString).collect(Collectors.toList());
BwcVersions vc = new BwcVersions(
listOfVersions.stream().map(this::formatVersionToLine).collect(Collectors.toList()),
Version.fromString("8.0.0")
Version.fromString("2.0.0")
);
expectedEx.expect(IllegalStateException.class);
expectedEx.expectMessage("not really released");
Expand Down

0 comments on commit 8fbd8cd

Please sign in to comment.