Skip to content

Commit 9e4dff5

Browse files
committed
Merge branch 'refs/heads/main' into failures-of-aggregation-functions-outside-STATS
# Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/Eval.java
2 parents 9651f4c + 7a0a399 commit 9e4dff5

File tree

1,452 files changed

+27857
-13984
lines changed

Some content is hidden

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

1,452 files changed

+27857
-13984
lines changed

.buildkite/hooks/pre-command

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
9494
fi
9595
fi
9696

97+
# Authenticate to the Docker Hub public read-only registry
98+
if which docker > /dev/null 2>&1; then
99+
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
100+
DOCKERHUB_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
101+
102+
echo "$DOCKERHUB_REGISTRY_PASSWORD" | docker login --username "$DOCKERHUB_REGISTRY_USERNAME" --password-stdin docker.io
103+
fi
104+
97105
if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
98106
# Run in the background, while the job continues
99107
nohup .buildkite/scripts/setup-monitoring.sh </dev/null >/dev/null 2>&1 &

REST_API_COMPATIBILITY.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("limit
154154

155155
The above code checks the request's compatible version and if the request has the parameter in question. In this case the deprecation warning is not automatic and requires the developer to manually log the warning. `request.param` is also required since it consumes the value as to avoid the error of unconsumed parameters.
156156

157-
### Testing
157+
### Testing Backwards Compatibility
158158

159-
The primary means of testing compatibility is via the prior major version's YAML REST tests. The build system will download the latest prior version of the YAML rest tests and execute them against the current cluster version. Prior to execution the tests will be transformed by injecting the correct headers to enable compatibility as well as other custom changes to the tests to allow the tests to pass. These customizations are configured via the build.gradle and happen just prior to test execution. Since the compatibility tests are manipulated version of the tests stored in Github (via the past major version), it is important to find the local (on disk) version for troubleshooting compatibility tests.
159+
The primary means of testing compatibility is via the prior major version's YAML REST tests. The build system will download the latest prior version of the YAML rest tests and execute them against the current cluster version. For example if you are testing main versioned as 9.0.0 the build system will download the yaml tests in the 8.x branch and execute those against the current cluster version for 9.0.0.
160+
161+
Prior to execution the tests will be transformed by injecting the correct headers to enable compatibility as well as other custom changes to the tests to allow the tests to pass. These customizations are configured via the build.gradle and happen just prior to test execution. Since the compatibility tests are manipulated version of the tests stored in Github (via the past major version), it is important to find the local (on disk) version for troubleshooting compatibility tests.
160162

161163
The tests are wired into the `check` task, so that is the easiest way to test locally prior to committing. More specifically the task is called `yamlRestCompatTest`. These behave nearly identical to it's non-compat `yamlRestTest` task. The only variance is that the tests are sourced from the prior version branch and the tests go through a transformation phase before execution. The transformation task is `yamlRestCompatTestTransform`.
162164

@@ -170,6 +172,36 @@ Since these are a variation of backward compatibility testing, the entire suite
170172

171173
In some cases the prior version of the YAML REST tests are not sufficient to fully test changes. This can happen when the prior version has insufficient test coverage. In those cases, you can simply add more testing to the prior version or you can add custom REST tests that will run along side of the other compatibility tests. These custom tests can be found in the `yamlRestCompatTest` sourceset. Custom REST tests for compatibility will not be modified prior to execution, so the correct headers need to be manually added.
172174

175+
#### Breaking Changes
176+
177+
It is possible to be in a state where you have intentionally made a breaking change and the compatibility tests will fail irrespective of checks for `skip` or `requires` cluster or test features in the current version such as 9.0.0. In this state, assuming the breaking changes are reasonable and agreed upon by the breaking change committee, the correct behavior is to skip the test in the `build.gradle` in 9.0.0. For example, if you make a breaking change that causes the `range/20_synthetic_source/Date range` to break then this test can be disabled temporarily in this file `rest-api-spec/build.gradle` like within this snippet:
178+
179+
```groovy
180+
tasks.named("yamlRestCompatTestTransform").configure({task ->
181+
task.skipTest("range/20_synthetic_source/Date range", "date range breaking change causes tests to produce incorrect values for compatibility")
182+
task.skipTest("indices.sort/10_basic/Index Sort", "warning does not exist for compatibility")
183+
task.skipTest("search/330_fetch_fields/Test search rewrite", "warning does not exist for compatibility")
184+
task.skipTestsByFilePattern("indices.create/synthetic_source*.yml", "@UpdateForV9 -> tests do not pass after bumping API version to 9 [ES-9597]")
185+
})
186+
```
187+
188+
When skipping a test temporarily in 9.0.0, we have to implement the proper `skip` and `requires` conditions to previous branches, such as 8.latest. After these conditions are implemented in 8.latest, you can re-enable the test in 9.0.0 by removing the `skipTest` condition.
189+
190+
The team implementing the changes can decide how to clean up or modify tests based on how breaking changes were backported. e.g.:
191+
192+
In 8.latest:
193+
194+
* Add `skip` / `requires` conditions to existing tests that check the old behavior. This prevents those tests from failing during backward compatibility or upgrade testing from 8.latest to 9.0.0
195+
196+
In 9.0.0:
197+
198+
* Add `requires` conditions for new tests that validate the updated API or output format
199+
* Add `skip` conditions for older tests that would break in 9.0.0
200+
201+
#### Test Features
202+
203+
Both cluster and test features exist. Cluster features are meant for new capability and test features can specifically be used to gate and manage `skip` and `requires` yaml test operations. For more information, see [Versioning.md](docs/internal/Versioning.md#cluster-features). When backporting and using these features they can not overlap in name and must be consistent when backported so that clusters built with these features are compatible.
204+
173205
### Developer's workflow
174206

175207
There should not be much, if any, deviation in a developers normal workflow to introduce and back-port changes. Changes should be applied in main, then back ported as needed.

build-conventions/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
plugins {
11-
id "com.gradle.develocity" version "3.18.1"
11+
id "com.gradle.develocity" version "3.19.2"
1212
}
1313

1414
rootProject.name = 'build-conventions'

build-tools-internal/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pluginManagement {
99
}
1010

1111
plugins {
12-
id "com.gradle.develocity" version "3.18.1"
12+
id "com.gradle.develocity" version "3.19.2"
1313
}
1414

1515
dependencyResolutionManagement {

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import org.gradle.api.Task;
2020
import org.gradle.api.file.ArchiveOperations;
2121
import org.gradle.api.plugins.BasePlugin;
22+
import org.gradle.api.provider.ListProperty;
23+
import org.gradle.api.provider.Provider;
2224
import org.gradle.api.tasks.Copy;
2325
import org.gradle.api.tasks.TaskProvider;
2426

@@ -103,22 +105,26 @@ private static TaskProvider<Task> registerCheckMlCppNoticeTask(
103105
) {
104106
TaskProvider<Task> checkMlCppNoticeTask = project.getTasks().register("checkMlCppNotice", task -> {
105107
task.dependsOn(checkExtraction);
108+
final Provider<Path> noticePath = checkExtraction.map(
109+
c -> c.getDestinationDir()
110+
.toPath()
111+
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt")
112+
);
113+
ListProperty<String> expectedMlLicenses = extension.expectedMlLicenses;
106114
task.doLast(new Action<Task>() {
107115
@Override
108116
public void execute(Task task) {
109117
// this is just a small sample from the C++ notices,
110118
// the idea being that if we've added these lines we've probably added all the required lines
111-
final List<String> expectedLines = extension.expectedMlLicenses.get();
112-
final Path noticePath = checkExtraction.get()
113-
.getDestinationDir()
114-
.toPath()
115-
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt");
119+
final List<String> expectedLines = expectedMlLicenses.get();
116120
final List<String> actualLines;
117121
try {
118-
actualLines = Files.readAllLines(noticePath);
122+
actualLines = Files.readAllLines(noticePath.get());
119123
for (final String expectedLine : expectedLines) {
120124
if (actualLines.contains(expectedLine) == false) {
121-
throw new GradleException("expected [" + noticePath + " to contain [" + expectedLine + "] but it did not");
125+
throw new GradleException(
126+
"expected [" + noticePath.get() + " to contain [" + expectedLine + "] but it did not"
127+
);
122128
}
123129
}
124130
} catch (IOException ioException) {
@@ -133,43 +139,37 @@ public void execute(Task task) {
133139
private TaskProvider<Task> registerCheckNoticeTask(Project project, TaskProvider<Copy> checkExtraction) {
134140
return project.getTasks().register("checkNotice", task -> {
135141
task.dependsOn(checkExtraction);
136-
task.doLast(new Action<Task>() {
137-
@Override
138-
public void execute(Task task) {
139-
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2024 Elasticsearch");
140-
final Path noticePath = checkExtraction.get()
141-
.getDestinationDir()
142-
.toPath()
143-
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/NOTICE.txt");
144-
assertLinesInFile(noticePath, noticeLines);
145-
}
142+
var noticePath = checkExtraction.map(
143+
copy -> copy.getDestinationDir().toPath().resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/NOTICE.txt")
144+
);
145+
task.doLast(t -> {
146+
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2024 Elasticsearch");
147+
assertLinesInFile(noticePath.get(), noticeLines);
146148
});
147149
});
148150
}
149151

150152
private TaskProvider<Task> registerCheckLicenseTask(Project project, TaskProvider<Copy> checkExtraction) {
151153
TaskProvider<Task> checkLicense = project.getTasks().register("checkLicense", task -> {
152154
task.dependsOn(checkExtraction);
153-
task.doLast(new Action<Task>() {
154-
@Override
155-
public void execute(Task task) {
156-
String licenseFilename = null;
157-
if (project.getName().contains("oss-") || project.getName().equals("integ-test-zip")) {
158-
licenseFilename = "AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt";
159-
} else {
160-
licenseFilename = "ELASTIC-LICENSE-2.0.txt";
161-
}
162-
final List<String> licenseLines;
163-
try {
164-
licenseLines = Files.readAllLines(project.getRootDir().toPath().resolve("licenses/" + licenseFilename));
165-
final Path licensePath = checkExtraction.get()
166-
.getDestinationDir()
167-
.toPath()
168-
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/LICENSE.txt");
169-
assertLinesInFile(licensePath, licenseLines);
170-
} catch (IOException ioException) {
171-
ioException.printStackTrace();
172-
}
155+
String projectName = project.getName();
156+
Provider<Path> licensePathProvider = checkExtraction.map(
157+
copy -> copy.getDestinationDir().toPath().resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/LICENSE.txt")
158+
);
159+
File rootDir = project.getLayout().getSettingsDirectory().getAsFile();
160+
task.doLast(t -> {
161+
String licenseFilename = null;
162+
if (projectName.contains("oss-") || projectName.equals("integ-test-zip")) {
163+
licenseFilename = "AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt";
164+
} else {
165+
licenseFilename = "ELASTIC-LICENSE-2.0.txt";
166+
}
167+
final List<String> licenseLines;
168+
try {
169+
licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename));
170+
assertLinesInFile(licensePathProvider.get(), licenseLines);
171+
} catch (IOException ioException) {
172+
ioException.printStackTrace();
173173
}
174174
});
175175
});

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/toolchain/ArchivedOracleJdkToolchainResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
public abstract class ArchivedOracleJdkToolchainResolver extends AbstractCustomJavaToolchainResolver {
3131

32-
private static final Map<Integer, String> ARCHIVED_BASE_VERSIONS = Maps.of(20, "20.0.2", 19, "19.0.2", 18, "18.0.2.1");
32+
private static final Map<Integer, String> ARCHIVED_BASE_VERSIONS = Maps.of(21, "21.0.6", 20, "20.0.2", 19, "19.0.2", 18, "18.0.2.1");
3333

3434
@Override
3535
public Optional<JavaToolchainDownload> resolve(JavaToolchainRequest request) {

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/toolchain/OracleOpenJdkToolchainResolver.java

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ public String url(String os, String arch, String extension) {
5858
}
5959
}
6060

61-
record EarlyAccessJdkBuild(JavaLanguageVersion languageVersion) implements JdkBuild {
61+
record EarlyAccessJdkBuild(JavaLanguageVersion languageVersion, String buildNumber) implements JdkBuild {
6262
@Override
6363
public String url(String os, String arch, String extension) {
64-
String buildNumber = resolveBuildNumber(languageVersion.asInt());
6564
return "https://download.java.net/java/early_access/jdk"
6665
+ languageVersion.asInt()
6766
+ "/"
@@ -77,29 +76,6 @@ public String url(String os, String arch, String extension) {
7776
+ "_bin."
7877
+ extension;
7978
}
80-
81-
private static String resolveBuildNumber(int version) {
82-
String buildNumber = System.getProperty("runtime.java." + version + ".build");
83-
if (buildNumber != null) {
84-
System.out.println("buildNumber = " + buildNumber);
85-
return buildNumber;
86-
}
87-
buildNumber = System.getProperty("runtime.java.build");
88-
if (buildNumber != null) {
89-
System.out.println("buildNumber2 = " + buildNumber);
90-
return buildNumber;
91-
}
92-
93-
switch (version) {
94-
case 24:
95-
// latest explicitly found build number for 24
96-
return "29";
97-
case 25:
98-
return "3";
99-
default:
100-
throw new IllegalArgumentException("Unsupported version " + version);
101-
}
102-
}
10379
}
10480

10581
private static final Pattern VERSION_PATTERN = Pattern.compile(
@@ -114,15 +90,20 @@ private static String resolveBuildNumber(int version) {
11490

11591
// package private so it can be replaced by tests
11692
List<JdkBuild> builds = List.of(
117-
getBundledJdkBuild(),
118-
// release candidate of JDK 24
119-
new ReleaseJdkBuild(JavaLanguageVersion.of(24), "download.java.net", "24", "36", "1f9ff9062db4449d8ca828c504ffae90"),
120-
new EarlyAccessJdkBuild(JavaLanguageVersion.of(25))
93+
getBundledJdkBuild(VersionProperties.getBundledJdkVersion(), VersionProperties.getBundledJdkMajorVersion()),
94+
getEarlyAccessBuild(JavaLanguageVersion.of(25), "3")
12195
);
12296

123-
private JdkBuild getBundledJdkBuild() {
124-
String bundledJdkVersion = VersionProperties.getBundledJdkVersion();
125-
JavaLanguageVersion bundledJdkMajorVersion = JavaLanguageVersion.of(VersionProperties.getBundledJdkMajorVersion());
97+
static EarlyAccessJdkBuild getEarlyAccessBuild(JavaLanguageVersion languageVersion, String buildNumber) {
98+
// first try the unversioned override, then the versioned override which has higher precedence
99+
buildNumber = System.getProperty("runtime.java.build", buildNumber);
100+
buildNumber = System.getProperty("runtime.java." + languageVersion.asInt() + ".build", buildNumber);
101+
102+
return new EarlyAccessJdkBuild(languageVersion, buildNumber);
103+
}
104+
105+
static JdkBuild getBundledJdkBuild(String bundledJdkVersion, String bundledJkdMajorVersionString) {
106+
JavaLanguageVersion bundledJdkMajorVersion = JavaLanguageVersion.of(bundledJkdMajorVersionString);
126107
Matcher jdkVersionMatcher = VERSION_PATTERN.matcher(bundledJdkVersion);
127108
if (jdkVersionMatcher.matches() == false) {
128109
throw new IllegalStateException("Unable to parse bundled JDK version " + bundledJdkVersion);

0 commit comments

Comments
 (0)