Skip to content

Commit 521c852

Browse files
Merge branch 'main' into makeContentOptionalUnifiedInferenceApi
2 parents 6ce7ac6 + 6983f9a commit 521c852

File tree

351 files changed

+8919
-1931
lines changed

Some content is hidden

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

351 files changed

+8919
-1931
lines changed

.ci/init.gradle

Lines changed: 2 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,3 @@
1-
import com.bettercloud.vault.VaultConfig
2-
import com.bettercloud.vault.Vault
3-
4-
initscript {
5-
repositories {
6-
mavenCentral()
7-
}
8-
dependencies {
9-
classpath 'com.bettercloud:vault-java-driver:4.1.0'
10-
}
11-
}
12-
13-
boolean USE_ARTIFACTORY = false
14-
15-
if (System.getenv('VAULT_ADDR') == null) {
16-
// When trying to reproduce errors outside of CI, it can be useful to allow this to just return rather than blowing up
17-
if (System.getenv('CI') == null) {
18-
return
19-
}
20-
21-
throw new GradleException("You must set the VAULT_ADDR environment variable to use this init script.")
22-
}
23-
24-
if (System.getenv('VAULT_ROLE_ID') == null && System.getenv('VAULT_SECRET_ID') == null && System.getenv('VAULT_TOKEN') == null) {
25-
// When trying to reproduce errors outside of CI, it can be useful to allow this to just return rather than blowing up
26-
if (System.getenv('CI') == null) {
27-
return
28-
}
29-
30-
throw new GradleException("You must set either the VAULT_ROLE_ID and VAULT_SECRET_ID environment variables, " +
31-
"or the VAULT_TOKEN environment variable to use this init script.")
32-
}
33-
34-
final String vaultPathPrefix = System.getenv('VAULT_ADDR') ==~ /.+vault-ci.+\.dev.*/ ? "secret/ci/elastic-elasticsearch/migrated" : "secret/elasticsearch-ci"
35-
36-
final String vaultToken = System.getenv('VAULT_TOKEN') ?: new Vault(
37-
new VaultConfig()
38-
.address(System.env.VAULT_ADDR)
39-
.engineVersion(1)
40-
.build()
41-
)
42-
.withRetries(5, 1000)
43-
.auth()
44-
.loginByAppRole("approle", System.env.VAULT_ROLE_ID, System.env.VAULT_SECRET_ID)
45-
.getAuthClientToken()
46-
47-
final Vault vault = new Vault(
48-
new VaultConfig()
49-
.address(System.env.VAULT_ADDR)
50-
.engineVersion(1)
51-
.token(vaultToken)
52-
.build()
53-
)
54-
.withRetries(5, 1000)
55-
56-
57-
if (USE_ARTIFACTORY) {
58-
final Map<String, String> artifactoryCredentials = vault.logical()
59-
.read("${vaultPathPrefix}/artifactory.elstc.co")
60-
.getData()
61-
logger.info("Using elastic artifactory repos")
62-
Closure configCache = {
63-
return {
64-
name "artifactory-gradle-release"
65-
url "https://artifactory.elstc.co/artifactory/gradle-release"
66-
credentials {
67-
username artifactoryCredentials.get("username")
68-
password artifactoryCredentials.get("token")
69-
}
70-
}
71-
}
72-
settingsEvaluated { settings ->
73-
settings.pluginManagement {
74-
repositories {
75-
maven configCache()
76-
}
77-
}
78-
}
79-
projectsLoaded {
80-
allprojects {
81-
buildscript {
82-
repositories {
83-
maven configCache()
84-
}
85-
}
86-
repositories {
87-
maven configCache()
88-
}
89-
}
90-
}
91-
}
92-
931
gradle.settingsEvaluated { settings ->
942
settings.pluginManager.withPlugin("com.gradle.develocity") {
953
settings.develocity {
@@ -98,14 +6,10 @@ gradle.settingsEvaluated { settings ->
986
}
997
}
1008

101-
1029
final String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url')
10310
final boolean buildCachePush = Boolean.valueOf(System.getProperty('org.elasticsearch.build.cache.push', 'false'))
10411

10512
if (buildCacheUrl) {
106-
final Map<String, String> buildCacheCredentials = System.getenv("GRADLE_BUILD_CACHE_USERNAME") ? [:] : vault.logical()
107-
.read("${vaultPathPrefix}/gradle-build-cache")
108-
.getData()
10913
gradle.settingsEvaluated { settings ->
11014
settings.buildCache {
11115
local {
@@ -116,11 +20,10 @@ if (buildCacheUrl) {
11620
url = buildCacheUrl
11721
push = buildCachePush
11822
credentials {
119-
username = System.getenv("GRADLE_BUILD_CACHE_USERNAME") ?: buildCacheCredentials.get("username")
120-
password = System.getenv("GRADLE_BUILD_CACHE_PASSWORD") ?: buildCacheCredentials.get("password")
23+
username = System.getenv("GRADLE_BUILD_CACHE_USERNAME")
24+
password = System.getenv("GRADLE_BUILD_CACHE_PASSWORD")
12125
}
12226
}
12327
}
12428
}
12529
}
126-

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@ testfixtures_shared/
6969
# Generated
7070
checkstyle_ide.xml
7171
x-pack/plugin/esql/src/main/generated-src/generated/
72+
73+
# JEnv
74+
.java-version

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@
3131
import org.gradle.api.tasks.bundling.Jar;
3232
import org.gradle.api.tasks.javadoc.Javadoc;
3333
import org.gradle.external.javadoc.CoreJavadocOptions;
34+
import org.gradle.jvm.toolchain.JavaLanguageVersion;
35+
import org.gradle.jvm.toolchain.JavaToolchainService;
3436
import org.gradle.language.base.plugins.LifecycleBasePlugin;
3537

3638
import java.io.File;
3739
import java.util.Map;
3840

41+
import javax.inject.Inject;
42+
3943
import static org.elasticsearch.gradle.internal.conventions.util.Util.toStringable;
4044
import static org.elasticsearch.gradle.internal.util.ParamsUtils.loadBuildParams;
4145

@@ -44,6 +48,14 @@
4448
* common configuration for production code.
4549
*/
4650
public class ElasticsearchJavaPlugin implements Plugin<Project> {
51+
52+
private final JavaToolchainService javaToolchains;
53+
54+
@Inject
55+
ElasticsearchJavaPlugin(JavaToolchainService javaToolchains) {
56+
this.javaToolchains = javaToolchains;
57+
}
58+
4759
@Override
4860
public void apply(Project project) {
4961
project.getRootProject().getPlugins().apply(GlobalBuildInfoPlugin.class);
@@ -55,7 +67,7 @@ public void apply(Project project) {
5567
// configureConfigurations(project);
5668
configureJars(project, buildParams.get());
5769
configureJarManifest(project, buildParams.get());
58-
configureJavadoc(project);
70+
configureJavadoc(project, buildParams.get());
5971
testCompileOnlyDeps(project);
6072
}
6173

@@ -128,14 +140,18 @@ private static void configureJarManifest(Project project, BuildParameterExtensio
128140
project.getPluginManager().apply("nebula.info-jar");
129141
}
130142

131-
private static void configureJavadoc(Project project) {
143+
private void configureJavadoc(Project project, BuildParameterExtension buildParams) {
132144
project.getTasks().withType(Javadoc.class).configureEach(javadoc -> {
133145
/*
134146
* Generate docs using html5 to suppress a warning from `javadoc`
135147
* that the default will change to html5 in the future.
136148
*/
137149
CoreJavadocOptions javadocOptions = (CoreJavadocOptions) javadoc.getOptions();
138150
javadocOptions.addBooleanOption("html5", true);
151+
152+
javadoc.getJavadocTool().set(javaToolchains.javadocToolFor(spec -> {
153+
spec.getLanguageVersion().set(JavaLanguageVersion.of(buildParams.getMinimumRuntimeVersion().getMajorVersion()));
154+
}));
139155
});
140156

141157
TaskProvider<Javadoc> javadoc = project.getTasks().withType(Javadoc.class).named("javadoc");

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

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
import org.gradle.api.Plugin;
1818
import org.gradle.api.Project;
1919
import org.gradle.api.Task;
20+
import org.gradle.api.file.FileSystemOperations;
2021
import org.gradle.api.file.ProjectLayout;
2122
import org.gradle.api.model.ObjectFactory;
2223
import org.gradle.api.plugins.JvmToolchainsPlugin;
2324
import org.gradle.api.provider.Provider;
2425
import org.gradle.api.provider.ProviderFactory;
25-
import org.gradle.api.tasks.Copy;
2626
import org.gradle.api.tasks.PathSensitivity;
2727
import org.gradle.api.tasks.TaskProvider;
2828
import org.gradle.jvm.toolchain.JavaToolchainService;
@@ -54,11 +54,17 @@ public class InternalDistributionBwcSetupPlugin implements Plugin<Project> {
5454
private final ObjectFactory objectFactory;
5555
private ProviderFactory providerFactory;
5656
private JavaToolchainService toolChainService;
57+
private FileSystemOperations fileSystemOperations;
5758

5859
@Inject
59-
public InternalDistributionBwcSetupPlugin(ObjectFactory objectFactory, ProviderFactory providerFactory) {
60+
public InternalDistributionBwcSetupPlugin(
61+
ObjectFactory objectFactory,
62+
ProviderFactory providerFactory,
63+
FileSystemOperations fileSystemOperations
64+
) {
6065
this.objectFactory = objectFactory;
6166
this.providerFactory = providerFactory;
67+
this.fileSystemOperations = fileSystemOperations;
6268
}
6369

6470
@Override
@@ -76,7 +82,8 @@ public void apply(Project project) {
7682
providerFactory,
7783
objectFactory,
7884
toolChainService,
79-
isCi
85+
isCi,
86+
fileSystemOperations
8087
);
8188
});
8289
}
@@ -88,7 +95,8 @@ private static void configureBwcProject(
8895
ProviderFactory providerFactory,
8996
ObjectFactory objectFactory,
9097
JavaToolchainService toolChainService,
91-
Boolean isCi
98+
Boolean isCi,
99+
FileSystemOperations fileSystemOperations
92100
) {
93101
ProjectLayout layout = project.getLayout();
94102
Provider<BwcVersions.UnreleasedVersionInfo> versionInfoProvider = providerFactory.provider(() -> versionInfo);
@@ -120,11 +128,18 @@ private static void configureBwcProject(
120128
List<DistributionProject> distributionProjects = resolveArchiveProjects(checkoutDir.get(), bwcVersion.get());
121129

122130
// Setup gradle user home directory
123-
project.getTasks().register("setupGradleUserHome", Copy.class, copy -> {
124-
copy.into(project.getGradle().getGradleUserHomeDir().getAbsolutePath() + "-" + project.getName());
125-
copy.from(project.getGradle().getGradleUserHomeDir().getAbsolutePath(), copySpec -> {
126-
copySpec.include("gradle.properties");
127-
copySpec.include("init.d/*");
131+
// We don't use a normal `Copy` task here as snapshotting the entire gradle user home is very expensive. This task is cheap, so
132+
// up-to-date checking doesn't buy us much
133+
project.getTasks().register("setupGradleUserHome", task -> {
134+
task.doLast(t -> {
135+
fileSystemOperations.copy(copy -> {
136+
String gradleUserHome = project.getGradle().getGradleUserHomeDir().getAbsolutePath();
137+
copy.into(gradleUserHome + "-" + project.getName());
138+
copy.from(gradleUserHome, copySpec -> {
139+
copySpec.include("gradle.properties");
140+
copySpec.include("init.d/*");
141+
});
142+
});
128143
});
129144
});
130145

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ public void apply(Project project) {
8686
configurePreviewFeatures(project, javaExtension.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME), 21);
8787
for (int javaVersion : mainVersions) {
8888
String mainSourceSetName = SourceSet.MAIN_SOURCE_SET_NAME + javaVersion;
89-
SourceSet mainSourceSet = addSourceSet(project, javaExtension, mainSourceSetName, mainSourceSets, javaVersion);
89+
SourceSet mainSourceSet = addSourceSet(project, javaExtension, mainSourceSetName, mainSourceSets, javaVersion, true);
9090
configureSourceSetInJar(project, mainSourceSet, javaVersion);
9191
addJar(project, mainSourceSet, javaVersion);
9292
mainSourceSets.add(mainSourceSetName);
9393
testSourceSets.add(mainSourceSetName);
9494

9595
String testSourceSetName = SourceSet.TEST_SOURCE_SET_NAME + javaVersion;
96-
SourceSet testSourceSet = addSourceSet(project, javaExtension, testSourceSetName, testSourceSets, javaVersion);
96+
SourceSet testSourceSet = addSourceSet(project, javaExtension, testSourceSetName, testSourceSets, javaVersion, false);
9797
testSourceSets.add(testSourceSetName);
9898
createTestTask(project, buildParams, testSourceSet, javaVersion, mainSourceSets);
9999
}
@@ -121,7 +121,8 @@ private SourceSet addSourceSet(
121121
JavaPluginExtension javaExtension,
122122
String sourceSetName,
123123
List<String> parentSourceSets,
124-
int javaVersion
124+
int javaVersion,
125+
boolean isMainSourceSet
125126
) {
126127
SourceSet sourceSet = javaExtension.getSourceSets().maybeCreate(sourceSetName);
127128
for (String parentSourceSetName : parentSourceSets) {
@@ -135,6 +136,13 @@ private SourceSet addSourceSet(
135136
CompileOptions compileOptions = compileTask.getOptions();
136137
compileOptions.getRelease().set(javaVersion);
137138
});
139+
if (isMainSourceSet) {
140+
project.getTasks().create(sourceSet.getJavadocTaskName(), Javadoc.class, javadocTask -> {
141+
javadocTask.getJavadocTool().set(javaToolchains.javadocToolFor(spec -> {
142+
spec.getLanguageVersion().set(JavaLanguageVersion.of(javaVersion));
143+
}));
144+
});
145+
}
138146
configurePreviewFeatures(project, sourceSet, javaVersion);
139147

140148
// Since we configure MRJAR sourcesets to allow preview apis, class signatures for those

distribution/src/config/jvm.options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## should create one or more files in the jvm.options.d
1010
## directory containing your adjustments.
1111
##
12-
## See https://www.elastic.co/guide/en/elasticsearch/reference/@project.minor.version@/jvm-options.html
12+
## See https://www.elastic.co/guide/en/elasticsearch/reference/@project.minor.version@/advanced-configuration.html#set-jvm-options
1313
## for more information.
1414
##
1515
################################################################

docs/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ testClusters.matching { it.name == "yamlRestTest"}.configureEach {
130130
setting 'xpack.security.enabled', 'true'
131131
setting 'xpack.security.authc.api_key.enabled', 'true'
132132
setting 'xpack.security.authc.token.enabled', 'true'
133-
// disable the ILM history for doc tests to avoid potential lingering tasks that'd cause test flakiness
133+
// disable the ILM and SLM history for doc tests to avoid potential lingering tasks that'd cause test flakiness
134134
setting 'indices.lifecycle.history_index_enabled', 'false'
135+
setting 'slm.history_index_enabled', 'false'
135136
setting 'xpack.license.self_generated.type', 'trial'
136137
setting 'xpack.security.authc.realms.file.file.order', '0'
137138
setting 'xpack.security.authc.realms.native.native.order', '1'

docs/changelog/116687.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 116687
2+
summary: Add LogsDB option to route on sort fields
3+
area: Logs
4+
type: enhancement
5+
issues: []

docs/changelog/118266.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118266
2+
summary: Prevent data nodes from sending stack traces to coordinator when `error_trace=false`
3+
area: Search
4+
type: enhancement
5+
issues: []

docs/changelog/118353.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118353
2+
summary: Epoch Millis Rounding Down and Not Up 2
3+
area: Infra/Core
4+
type: bug
5+
issues: []

0 commit comments

Comments
 (0)