Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into HEAD
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Dec 1, 2022
2 parents acb5e4d + 31bcda6 commit 67843d9
Show file tree
Hide file tree
Showing 128 changed files with 2,778 additions and 629 deletions.
43 changes: 0 additions & 43 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
@@ -1,47 +1,4 @@
BWC_VERSION:
- "7.0.0"
- "7.0.1"
- "7.1.0"
- "7.1.1"
- "7.2.0"
- "7.2.1"
- "7.3.0"
- "7.3.1"
- "7.3.2"
- "7.4.0"
- "7.4.1"
- "7.4.2"
- "7.5.0"
- "7.5.1"
- "7.5.2"
- "7.6.0"
- "7.6.1"
- "7.6.2"
- "7.7.0"
- "7.7.1"
- "7.8.0"
- "7.8.1"
- "7.9.0"
- "7.9.1"
- "7.9.2"
- "7.9.3"
- "7.10.0"
- "7.10.1"
- "7.10.2"
- "1.0.0"
- "1.1.0"
- "1.2.0"
- "1.2.1"
- "1.2.2"
- "1.2.3"
- "1.2.4"
- "1.2.5"
- "1.3.0"
- "1.3.1"
- "1.3.2"
- "1.3.3"
- "1.3.4"
- "1.3.5"
- "2.0.0"
- "2.0.1"
- "2.0.2"
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ on:
types:
- completed

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
gradle-check:
permissions:
contents: read # to fetch code (actions/checkout)
pull-requests: write # to create or update comment (peter-evans/create-or-update-comment)

runs-on: ubuntu-latest
timeout-minutes: 130
steps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Link Checker
on:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
linkchecker:
if: github.repository == 'opensearch-project/OpenSearch'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
tags:
- '*.*.*'

permissions: {}
jobs:
build:
runs-on: ubuntu-latest
Expand Down
162 changes: 0 additions & 162 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,11 @@ subprojects {
apply plugin: "org.gradle.test-retry"
tasks.withType(Test).configureEach {
retry {
if (BuildParams.isCi()) {
maxRetries = 3
maxFailures = 10
}
failOnPassedAfterRetry = false
maxRetries = 3
maxFailures = 10
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dependencies {
api 'commons-codec:commons-codec:1.15'
api 'org.apache.commons:commons-compress:1.21'
api 'org.apache.ant:ant:1.10.12'
api 'com.netflix.nebula:gradle-extra-configurations-plugin:7.0.0'
api 'com.netflix.nebula:gradle-extra-configurations-plugin:8.0.0'
api 'com.netflix.nebula:nebula-publishing-plugin:4.6.0'
api 'com.netflix.nebula:gradle-info-plugin:11.3.3'
api 'org.apache.rat:apache-rat:0.13'
Expand All @@ -118,7 +118,7 @@ dependencies {
api 'com.avast.gradle:gradle-docker-compose-plugin:0.15.2'
api "org.yaml:snakeyaml:${props.getProperty('snakeyaml')}"
api 'org.apache.maven:maven-model:3.6.2'
api 'com.networknt:json-schema-validator:1.0.69'
api 'com.networknt:json-schema-validator:1.0.73'
api "com.fasterxml.jackson.core:jackson-databind:${props.getProperty('jackson_databind')}"

testFixturesApi "junit:junit:${props.getProperty('junit')}"
Expand All @@ -127,7 +127,7 @@ dependencies {
testFixturesApi gradleTestKit()
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:2.33.2'
testImplementation "org.mockito:mockito-core:${props.getProperty('mockito')}"
integTestImplementation('org.spockframework:spock-core:2.1-groovy-3.0') {
integTestImplementation('org.spockframework:spock-core:2.3-groovy-3.0') {
exclude module: "groovy"
}
}
Expand Down
64 changes: 11 additions & 53 deletions buildSrc/src/main/java/org/opensearch/gradle/BwcVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class BwcVersions {
private final Map<Integer, List<Version>> groupByMajor;
private final Map<Version, UnreleasedVersionInfo> unreleased;

public class UnreleasedVersionInfo {
public static class UnreleasedVersionInfo {
public final Version version;
public final String branch;
public final String gradleProjectPath;
Expand Down Expand Up @@ -149,13 +149,7 @@ public BwcVersions(SortedSet<Version> allVersions, Version currentVersionPropert

groupByMajor = allVersions.stream()
// We only care about the last 2 majors when it comes to BWC.
// It might take us time to remove the older ones from versionLines, so we allow them to exist.
// Adjust the major number since OpenSearch 1.x is released after predecessor version 7.x
.filter(
version -> (version.getMajor() == 1 ? 7 : version.getMajor()) > (currentVersion.getMajor() == 1
? 7
: currentVersion.getMajor()) - 2
)
.filter(version -> version.getMajor() > currentVersion.getMajor() - 2)
.collect(Collectors.groupingBy(Version::getMajor, Collectors.toList()));

assertCurrentVersionMatchesParsed(currentVersionProperty);
Expand All @@ -174,9 +168,7 @@ public BwcVersions(SortedSet<Version> allVersions, Version currentVersionPropert

private void assertNoOlderThanTwoMajors() {
Set<Integer> majors = groupByMajor.keySet();
// until OpenSearch 3.0 we will need to carry three major support
// (1, 7, 6) && (2, 1, 7) since OpenSearch 1.0 === Legacy 7.x
int numSupportedMajors = (currentVersion.getMajor() < 3) ? 3 : 2;
int numSupportedMajors = 2;
if (majors.size() != numSupportedMajors && currentVersion.getMinor() != 0 && currentVersion.getRevision() != 0) {
throw new IllegalStateException("Expected exactly 2 majors in parsed versions but found: " + majors);
}
Expand Down Expand Up @@ -207,7 +199,7 @@ public void forPreviousUnreleased(Consumer<UnreleasedVersionInfo> consumer) {
.map(version -> new UnreleasedVersionInfo(version, getBranchFor(version), getGradleProjectPathFor(version)))
.collect(Collectors.toList());

collect.forEach(uvi -> consumer.accept(uvi));
collect.forEach(consumer);
}

private String getGradleProjectPathFor(Version version) {
Expand Down Expand Up @@ -271,18 +263,9 @@ public List<Version> getUnreleased() {
// The current version is being worked, is always unreleased
unreleased.add(currentVersion);

// No unreleased versions for 1.0.0
// todo remove this hack
if (currentVersion.equals(Version.fromString("1.0.0"))) {
return unmodifiableList(unreleased);
}

// the tip of the previous major is unreleased for sure, be it a minor or a bugfix
if (currentVersion.getMajor() != 1) {
final Version latestOfPreviousMajor = getLatestVersionByKey(
this.groupByMajor,
currentVersion.getMajor() == 1 ? 7 : currentVersion.getMajor() - 1
);
final Version latestOfPreviousMajor = getLatestVersionByKey(this.groupByMajor, currentVersion.getMajor() - 1);
unreleased.add(latestOfPreviousMajor);
if (latestOfPreviousMajor.getRevision() == 0) {
// if the previous major is a x.y.0 release, then the tip of the minor before that (y-1) is also unreleased
Expand Down Expand Up @@ -311,7 +294,7 @@ public List<Version> getUnreleased() {
}
}

return unmodifiableList(unreleased.stream().sorted().distinct().collect(Collectors.toList()));
return unreleased.stream().sorted().distinct().collect(Collectors.toUnmodifiableList());
}

private Version getLatestInMinor(int major, int minor) {
Expand Down Expand Up @@ -342,7 +325,7 @@ private Map<Integer, List<Version>> getReleasedMajorGroupedByMinor() {

public void compareToAuthoritative(List<Version> authoritativeReleasedVersions) {
Set<Version> notReallyReleased = new HashSet<>(getReleased());
notReallyReleased.removeAll(authoritativeReleasedVersions);
authoritativeReleasedVersions.forEach(notReallyReleased::remove);
if (notReallyReleased.isEmpty() == false) {
throw new IllegalStateException(
"out-of-date released versions"
Expand Down Expand Up @@ -370,32 +353,21 @@ 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());
}

public List<Version> getIndexCompatible() {
int currentMajor = currentVersion.getMajor();
int prevMajor = getPreviousMajor(currentMajor);
List<Version> result = Stream.concat(groupByMajor.get(prevMajor).stream(), groupByMajor.get(currentMajor).stream())
return Stream.concat(groupByMajor.get(prevMajor).stream(), groupByMajor.get(currentMajor).stream())
.filter(version -> version.equals(currentVersion) == false)
.collect(Collectors.toList());
if (currentMajor == 1) {
// add 6.x compatible for OpenSearch 1.0.0
return unmodifiableList(Stream.concat(groupByMajor.get(prevMajor - 1).stream(), result.stream()).collect(Collectors.toList()));
} else if (currentMajor == 2) {
// add 7.x compatible for OpenSearch 2.0.0
return unmodifiableList(Stream.concat(groupByMajor.get(7).stream(), result.stream()).collect(Collectors.toList()));
}
return unmodifiableList(result);
.collect(Collectors.toUnmodifiableList());
}

public List<Version> getWireCompatible() {
List<Version> wireCompat = new ArrayList<>();
int currentMajor = currentVersion.getMajor();
int lastMajor = currentMajor == 1 ? 6 : currentMajor == 2 ? 7 : currentMajor - 1;
int lastMajor = currentMajor - 1;
List<Version> lastMajorList = groupByMajor.get(lastMajor);
if (lastMajorList == null) {
throw new IllegalStateException("Expected to find a list of versions for version: " + lastMajor);
Expand All @@ -405,20 +377,6 @@ public List<Version> getWireCompatible() {
wireCompat.add(lastMajorList.get(i));
}

// if current is OpenSearch 1.0.0 add all of the 7.x line:
if (currentMajor == 1) {
List<Version> previousMajor = groupByMajor.get(7);
for (Version v : previousMajor) {
wireCompat.add(v);
}
} else if (currentMajor == 2) {
// add all of the 1.x line:
List<Version> previousMajor = groupByMajor.get(1);
for (Version v : previousMajor) {
wireCompat.add(v);
}
}

wireCompat.addAll(groupByMajor.get(currentMajor));
wireCompat.remove(currentVersion);
wireCompat.sort(Version::compareTo);
Expand All @@ -438,7 +396,7 @@ public List<Version> getUnreleasedWireCompatible() {
}

private int getPreviousMajor(int currentMajor) {
return currentMajor == 1 ? 7 : currentMajor - 1;
return currentMajor - 1;
}

}

This file was deleted.

8 changes: 4 additions & 4 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ bundled_jdk = 19.0.1+10
# optional dependencies
spatial4j = 0.7
jts = 1.15.0
jackson = 2.14.0
jackson_databind = 2.14.0
jackson = 2.14.1
jackson_databind = 2.14.1
snakeyaml = 1.32
icu4j = 70.1
supercsv = 2.4.0
Expand All @@ -28,8 +28,8 @@ netty = 4.1.84.Final
joda = 2.10.13

# client dependencies
httpclient5 = 5.1.3
httpcore5 = 5.1.4
httpclient5 = 5.1.4
httpcore5 = 5.1.5
httpclient = 4.5.13
httpcore = 4.4.15
httpasyncclient = 4.1.5
Expand Down
Loading

0 comments on commit 67843d9

Please sign in to comment.