Skip to content

Commit ae9bc41

Browse files
authored
Merge branch 'main' into mainIT-PR
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
2 parents 860e66e + 542b551 commit ae9bc41

File tree

600 files changed

+25790
-7071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

600 files changed

+25790
-7071
lines changed

.ci/bwcVersions

+2
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ BWC_VERSION:
4141
- "2.17.1"
4242
- "2.17.2"
4343
- "2.18.0"
44+
- "2.18.1"
45+
- "2.19.0"

.github/workflows/benchmark-pull-request.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ on:
44
types: [created]
55
jobs:
66
run-performance-benchmark-on-pull-request:
7-
if: ${{ (github.event.issue.pull_request) && (contains(github.event.comment.body, '"run-benchmark-test"')) }}
7+
if: |
8+
github.repository == 'opensearch-project/OpenSearch' &&
9+
github.event.issue.pull_request &&
10+
contains(github.event.comment.body, '"run-benchmark-test"')
811
runs-on: ubuntu-latest
912
permissions:
1013
id-token: write
@@ -111,7 +114,7 @@ jobs:
111114
uses: actions/github-script@v7
112115
with:
113116
github-token: ${{ secrets.GITHUB_TOKEN }}
114-
result-encoding: string
117+
result-encoding: json
115118
script: |
116119
// Get the collaborators - filtered to maintainer permissions
117120
const maintainersResponse = await github.request('GET /repos/{owner}/{repo}/collaborators', {
@@ -121,12 +124,12 @@ jobs:
121124
affiliation: 'all',
122125
per_page: 100
123126
});
124-
return maintainersResponse.data.map(item => item.login).join(', ');
127+
return maintainersResponse.data.map(item => item.login);
125128
- uses: trstringer/manual-approval@v1
126-
if: (!contains(steps.get_approvers.outputs.result, github.event.comment.user.login))
129+
if: ${{ !contains(fromJSON(steps.get_approvers.outputs.result), github.event.comment.user.login) }}
127130
with:
128131
secret: ${{ github.TOKEN }}
129-
approvers: ${{ steps.get_approvers.outputs.result }}
132+
approvers: ${{ join(fromJSON(steps.get_approvers.outputs.result), ', ') }}
130133
minimum-approvals: 1
131134
issue-title: 'Request to approve/deny benchmark run for PR #${{ env.PR_NUMBER }}'
132135
issue-body: "Please approve or deny the benchmark run for PR #${{ env.PR_NUMBER }}"

.github/workflows/detect-breaking-change.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
cache-disabled: true
1919
arguments: japicmp
20-
gradle-version: 8.7
20+
gradle-version: 8.11
2121
build-root-directory: server
2222
- if: failure()
2323
run: cat server/build/reports/java-compatibility/report.txt

.github/workflows/gradle-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
116116
- name: Upload Coverage Report
117117
if: success()
118-
uses: codecov/codecov-action@v4
118+
uses: codecov/codecov-action@v5
119119
with:
120120
token: ${{ secrets.CODECOV_TOKEN }}
121121
files: ./codeCoverage.xml

.github/workflows/links.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- name: lychee Link Checker
1515
id: lychee
16-
uses: lycheeverse/lychee-action@v2.0.2
16+
uses: lycheeverse/lychee-action@v2.2.0
1717
with:
1818
args: --accept=200,403,429 --exclude-mail **/*.html **/*.md **/*.txt **/*.json --exclude-file .lychee.excludes
1919
fail: true

CHANGELOG.md

+65-83
Large diffs are not rendered by default.

DEVELOPER_GUIDE.md

+10-23
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
- [Getting Started](#getting-started)
33
- [Git Clone OpenSearch Repo](#git-clone-opensearch-repo)
44
- [Install Prerequisites](#install-prerequisites)
5-
- [JDK 11](#jdk-11)
6-
- [JDK 14](#jdk-14)
7-
- [JDK 17](#jdk-17)
5+
- [JDK](#jdk)
86
- [Custom Runtime JDK](#custom-runtime-jdk)
97
- [Windows](#windows)
108
- [Docker](#docker)
@@ -76,35 +74,24 @@ Fork [opensearch-project/OpenSearch](https://github.com/opensearch-project/OpenS
7674

7775
### Install Prerequisites
7876

79-
#### JDK 11
77+
#### JDK
8078

81-
OpenSearch builds using Java 11 at a minimum, using the Adoptium distribution. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. This is configured in [buildSrc/build.gradle](buildSrc/build.gradle) and [distribution/tools/java-version-checker/build.gradle](distribution/tools/java-version-checker/build.gradle).
79+
OpenSearch recommends building with the [Temurin/Adoptium](https://adoptium.net/temurin/releases/) distribution. JDK 11 is the minimum supported, and JDK-23 is the newest supported. You must have a supported JDK installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.
8280

83-
```
84-
allprojects {
85-
targetCompatibility = JavaVersion.VERSION_11
86-
sourceCompatibility = JavaVersion.VERSION_11
87-
}
88-
```
81+
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
8982

90-
```
91-
sourceCompatibility = JavaVersion.VERSION_11
92-
targetCompatibility = JavaVersion.VERSION_11
93-
```
9483

95-
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
84+
In addition, certain backward compatibility tests check out and compile the previous major version of OpenSearch, and therefore require installing [JDK 11](https://adoptium.net/temurin/releases/?version=11) and [JDK 17](https://adoptium.net/temurin/releases/?version=17) and setting the `JAVA11_HOME` and `JAVA17_HOME` environment variables. More to that, since 8.10 release, Gradle has deprecated the usage of the any JDKs below JDK-16. For smooth development experience, the recommendation is to install at least [JDK 17](https://adoptium.net/temurin/releases/?version=17) or [JDK 21](https://adoptium.net/temurin/releases/?version=21). If you still want to build with JDK-11 only, please add `-Dorg.gradle.warning.mode=none` when invoking any Gradle build task from command line, for example:
9685

97-
#### JDK 14
98-
99-
To run the full suite of tests, download and install [JDK 14](https://jdk.java.net/archive/) and set `JAVA11_HOME`, and `JAVA14_HOME`. They are required by the [backwards compatibility test](./TESTING.md#testing-backwards-compatibility).
100-
101-
#### JDK 17
86+
```
87+
./gradlew check -Dorg.gradle.warning.mode=none
88+
```
10289

103-
By default, the test tasks use bundled JDK runtime, configured in [buildSrc/version.properties](buildSrc/version.properties), and set to JDK 17 (LTS).
90+
By default, the test tasks use bundled JDK runtime, configured in version catalog [gradle/libs.versions.toml](gradle/libs.versions.toml), and set to JDK 23 (non-LTS).
10491

10592
```
10693
bundled_jdk_vendor = adoptium
107-
bundled_jdk = 17.0.2+8
94+
bundled_jdk = 23.0.1+11
10895
```
10996

11097
#### Custom Runtime JDK

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
[![Security Vulnerabilities](https://img.shields.io/github/issues/opensearch-project/OpenSearch/security%20vulnerability?labelColor=red)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"security%20vulnerability")
88
[![Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch)](https://github.com/opensearch-project/OpenSearch/issues)
99
[![Open Pull Requests](https://img.shields.io/github/issues-pr/opensearch-project/OpenSearch)](https://github.com/opensearch-project/OpenSearch/pulls)
10-
[![2.18.0 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v2.18.0)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v2.18.0")
11-
[![2.17.2 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v2.17.2)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v2.17.2")
10+
[![2.19.0 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v2.19.0)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v2.19.0")
11+
[![2.18.1 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v2.18.1)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v2.18.1")
1212
[![3.0.0 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v3.0.0)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v3.0.0")
1313
[![GHA gradle check](https://github.com/opensearch-project/OpenSearch/actions/workflows/gradle-check.yml/badge.svg)](https://github.com/opensearch-project/OpenSearch/actions/workflows/gradle-check.yml)
1414
[![GHA validate pull request](https://github.com/opensearch-project/OpenSearch/actions/workflows/wrapper.yml/badge.svg)](https://github.com/opensearch-project/OpenSearch/actions/workflows/wrapper.yml)

build.gradle

+13-7
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,20 @@ Map<String, String> buildMetadataMap = buildMetadataValue.tokenize(';').collectE
162162
return [key, value]
163163
}
164164

165-
/**
166-
* Using 'git' command line (if available), tries to fetch the commit date of the current revision
167-
* @return commit date of the current revision or 0 if it is not available
168-
*/
165+
// See please https://docs.gradle.org/8.11/userguide/service_injection.html#execoperations
166+
interface InjectedExecOps {
167+
@Inject ExecOperations getExecOps()
168+
}
169+
170+
/**
171+
* Using 'git' command line (if available), tries to fetch the commit date of the current revision
172+
* @return commit date of the current revision or 0 if it is not available
173+
*/
169174
long gitRevisionDate = {
175+
def execOps = project.objects.newInstance(InjectedExecOps)
170176
// Try to get last commit date as Unix timestamp
171177
try (ByteArrayOutputStream stdout = new ByteArrayOutputStream()) {
172-
ExecResult result = project.exec(spec -> {
178+
ExecResult result = execOps.execOps.exec(spec -> {
173179
spec.setIgnoreExitValue(true);
174180
spec.setStandardOutput(stdout);
175181
spec.commandLine("git", "log", "-1", "--format=%ct");
@@ -362,7 +368,7 @@ allprojects {
362368
if ((dep instanceof ProjectDependency) == false) {
363369
return
364370
}
365-
Project upstreamProject = dep.dependencyProject
371+
Project upstreamProject = project.project(dep.path)
366372
if (upstreamProject == null) {
367373
return
368374
}
@@ -438,7 +444,7 @@ gradle.projectsEvaluated {
438444

439445
configurations.matching { it.canBeResolved }.all { Configuration configuration ->
440446
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
441-
Project upstreamProject = dep.dependencyProject
447+
Project upstreamProject = project.project(dep.path)
442448
if (upstreamProject != null) {
443449
if (project.path == upstreamProject.path) {
444450
// TODO: distribution integ tests depend on themselves (!), fix that

buildSrc/build.gradle

+12-8
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if (project == rootProject) {
5757
// we update the version property to reflect if we are building a snapshot or a release build
5858
// we write this back out below to load it in the Build.java which will be shown in rest main action
5959
// to indicate this being a snapshot build or a release build.
60-
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('version.properties'))
60+
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project)
6161
version = props.getProperty("opensearch")
6262

6363
def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) {
@@ -287,15 +287,19 @@ if (project != rootProject) {
287287
}
288288
}
289289

290-
// Define this here because we need it early.
290+
// Define this here because we need it early. It uses VersionCatalogsExtension to extract all versions
291+
// and converts to a Java Properties object
291292
class VersionPropertiesLoader {
292-
static Properties loadBuildSrcVersion(File input) throws IOException {
293+
static Properties loadBuildSrcVersion(Project project) throws IOException {
293294
Properties props = new Properties();
294-
InputStream is = new FileInputStream(input)
295-
try {
296-
props.load(is)
297-
} finally {
298-
is.close()
295+
296+
var catalogs = project.extensions.getByType(VersionCatalogsExtension)
297+
var libs = catalogs.named("libs")
298+
libs.getVersionAliases().forEach {
299+
libs.findVersion(it).ifPresent { v ->
300+
// Gradle replaces '_' with '.' so 'google_http_client' becomes 'google.http.client' instead
301+
props.setProperty(it.replaceAll("[.]", "_"), v.requiredVersion)
302+
}
299303
}
300304
loadBuildSrcVersion(props, System.getProperties())
301305
return props

buildSrc/settings.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@
1010
*/
1111

1212
include 'reaper'
13+
14+
dependencyResolutionManagement {
15+
versionCatalogs {
16+
libs {
17+
from(files("../gradle/libs.versions.toml"))
18+
}
19+
}
20+
}

buildSrc/src/main/groovy/org/opensearch/gradle/plugin/OptionalDependenciesPlugin.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class OptionalDependenciesPlugin implements Plugin<Project> {
7979

8080
if (foundDep) {
8181
if (foundDep.optional) {
82-
foundDep.optional.value = 'true'
82+
foundDep.optional*.value = 'true'
8383
} else {
8484
foundDep.appendNode(OPTIONAL_IDENTIFIER, 'true')
8585
}

buildSrc/src/main/groovy/org/opensearch/gradle/test/TestWithDependenciesPlugin.groovy

+6-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ class TestWithDependenciesPlugin implements Plugin<Project> {
5656

5757
project.configurations.testImplementation.dependencies.all { Dependency dep ->
5858
// this closure is run every time a compile dependency is added
59-
if (dep instanceof ProjectDependency && dep.dependencyProject.plugins.hasPlugin(PluginBuildPlugin)) {
60-
project.gradle.projectsEvaluated {
61-
addPluginResources(project, dep.dependencyProject)
59+
if (dep instanceof ProjectDependency) {
60+
Project dependencyProject = project.project(((ProjectDependency)dep).path)
61+
if (dependencyProject.plugins.hasPlugin(PluginBuildPlugin)) {
62+
project.gradle.projectsEvaluated {
63+
addPluginResources(project, dependencyProject)
64+
}
6265
}
6366
}
6467
}

buildSrc/src/main/java/org/opensearch/gradle/LoggedExec.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public class LoggedExec extends Exec implements FileSystemOperationsAware {
7171
private Consumer<Logger> outputLogger;
7272
private FileSystemOperations fileSystemOperations;
7373

74+
interface InjectedExecOps {
75+
@Inject
76+
ExecOperations getExecOps();
77+
}
78+
7479
@Inject
7580
public LoggedExec(FileSystemOperations fileSystemOperations) {
7681
this.fileSystemOperations = fileSystemOperations;
@@ -133,15 +138,17 @@ public void setSpoolOutput(boolean spoolOutput) {
133138
}
134139

135140
public static ExecResult exec(Project project, Action<ExecSpec> action) {
136-
return genericExec(project::exec, action);
141+
final InjectedExecOps execOps = project.getObjects().newInstance(InjectedExecOps.class);
142+
return exec(execOps.getExecOps(), action);
137143
}
138144

139145
public static ExecResult exec(ExecOperations execOperations, Action<ExecSpec> action) {
140146
return genericExec(execOperations::exec, action);
141147
}
142148

143149
public static ExecResult javaexec(Project project, Action<JavaExecSpec> action) {
144-
return genericExec(project::javaexec, action);
150+
final InjectedExecOps execOps = project.getObjects().newInstance(InjectedExecOps.class);
151+
return genericExec(execOps.getExecOps()::javaexec, action);
145152
}
146153

147154
/** Returns JVM arguments suitable for a short-lived forked task */

buildSrc/src/main/java/org/opensearch/gradle/PublishPlugin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public String call() throws Exception {
121121
Node dependencyNode = dependenciesNode.appendNode("dependency");
122122
dependencyNode.appendNode("groupId", dependency.getGroup());
123123
ProjectDependency projectDependency = (ProjectDependency) dependency;
124-
String artifactId = getArchivesBaseName(projectDependency.getDependencyProject());
124+
String artifactId = getArchivesBaseName(project.project(projectDependency.getPath()));
125125
dependencyNode.appendNode("artifactId", artifactId);
126126
dependencyNode.appendNode("version", dependency.getVersion());
127127
dependencyNode.appendNode("scope", "compile");

0 commit comments

Comments
 (0)