Skip to content

Commit 703e2f5

Browse files
committed
Merge branch 'main' into lucene_snapshot
2 parents f65477e + 98c1708 commit 703e2f5

File tree

286 files changed

+8979
-2032
lines changed

Some content is hidden

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

286 files changed

+8979
-2032
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,13 @@ You can import the Elasticsearch project into IntelliJ IDEA via:
168168

169169
#### Checkstyle
170170

171-
If you have the [Checkstyle] plugin installed, you can configure IntelliJ to
172-
check the Elasticsearch code. However, the Checkstyle configuration file does
173-
not work by default with the IntelliJ plugin, so instead an IDE-specific config
174-
file is generated automatically after IntelliJ finishes syncing. You can
175-
manually generate the file with `./gradlew configureIdeCheckstyle` in case
176-
it is removed due to a `./gradlew clean` or other action.
177-
178-
IntelliJ should be automatically configured to use the generated rules after
179-
import via the `.idea/checkstyle-idea.xml` configuration file. No further
180-
action is required.
171+
IntelliJ should automatically configure checkstyle. It does so by running
172+
`configureIdeCheckstyle` on import. That makes `.idea/checkstyle-idea.xml`
173+
configuration file. IntelliJ points checkstyle at that.
174+
175+
Things like `./gradlew clean` or `git clean -xdf` can nuke the file. You can
176+
regenerate it by running `./gradlew -Didea.active=true configureIdeCheckstyle`,
177+
but generally shouldn't have to.
181178

182179
#### Formatting
183180

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/PublishPluginFuncTest.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99

1010
package org.elasticsearch.gradle.internal
1111

12+
import spock.lang.IgnoreIf
13+
1214
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
1315
import org.gradle.testkit.runner.TaskOutcome
1416
import org.xmlunit.builder.DiffBuilder
1517
import org.xmlunit.builder.Input
1618

19+
// Ignoring this test on windows due to what appears to be a bug in the gradle testkit runner.
20+
// https://github.com/elastic/elasticsearch/issues/129100
21+
@IgnoreIf({ os.isWindows() })
1722
class PublishPluginFuncTest extends AbstractGradleFuncTest {
1823

1924
def setup() {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import org.elasticsearch.gradle.Version
11+
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
12+
13+
tasks.register("bcUpgradeTest", StandaloneRestIntegTestTask) {
14+
// We use a phony version here as the real version is provided via `tests.bwc.main.version` system property
15+
usesBwcDistribution(Version.fromString("0.0.0"))
16+
systemProperty("tests.old_cluster_version", "0.0.0")
17+
onlyIf("tests.bwc.main.version system property exists") { System.getProperty("tests.bwc.main.version") != null }
18+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
package org.elasticsearch.gradle.internal.dependencies.patches.hdfs;
10+
package org.elasticsearch.gradle.internal.dependencies.patches;
1111

1212
import org.objectweb.asm.MethodVisitor;
1313
import org.objectweb.asm.Opcodes;
@@ -16,7 +16,7 @@ public class MethodReplacement extends MethodVisitor {
1616
private final MethodVisitor delegate;
1717
private final Runnable bodyWriter;
1818

19-
MethodReplacement(MethodVisitor delegate, Runnable bodyWriter) {
19+
public MethodReplacement(MethodVisitor delegate, Runnable bodyWriter) {
2020
super(Opcodes.ASM9);
2121
this.delegate = delegate;
2222
this.bodyWriter = bodyWriter;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.gradle.internal.dependencies.patches.azurecore;
11+
12+
import org.elasticsearch.gradle.internal.dependencies.patches.PatcherInfo;
13+
import org.elasticsearch.gradle.internal.dependencies.patches.Utils;
14+
import org.gradle.api.artifacts.transform.CacheableTransform;
15+
import org.gradle.api.artifacts.transform.InputArtifact;
16+
import org.gradle.api.artifacts.transform.TransformAction;
17+
import org.gradle.api.artifacts.transform.TransformOutputs;
18+
import org.gradle.api.artifacts.transform.TransformParameters;
19+
import org.gradle.api.file.FileSystemLocation;
20+
import org.gradle.api.provider.Provider;
21+
import org.gradle.api.tasks.Classpath;
22+
import org.jetbrains.annotations.NotNull;
23+
24+
import java.io.File;
25+
import java.util.List;
26+
import java.util.regex.Pattern;
27+
28+
import static org.elasticsearch.gradle.internal.dependencies.patches.PatcherInfo.classPatcher;
29+
30+
@CacheableTransform
31+
public abstract class AzureCoreClassPatcher implements TransformAction<TransformParameters.None> {
32+
33+
private static final String JAR_FILE_TO_PATCH = "azure-core-[\\d.]*\\.jar";
34+
35+
private static final List<PatcherInfo> CLASS_PATCHERS = List.of(
36+
classPatcher(
37+
"com/azure/core/implementation/ImplUtils.class",
38+
"7beda5bdff5ea460cfc08721a188cf07d16e0c987dae45401fca7abf4e6e6c0e",
39+
ImplUtilsPatcher::new
40+
)
41+
);
42+
43+
@Classpath
44+
@InputArtifact
45+
public abstract Provider<FileSystemLocation> getInputArtifact();
46+
47+
@Override
48+
public void transform(@NotNull TransformOutputs outputs) {
49+
File inputFile = getInputArtifact().get().getAsFile();
50+
51+
if (Pattern.matches(JAR_FILE_TO_PATCH, inputFile.getName())) {
52+
System.out.println("Patching " + inputFile.getName());
53+
File outputFile = outputs.file(inputFile.getName().replace(".jar", "-patched.jar"));
54+
Utils.patchJar(inputFile, outputFile, CLASS_PATCHERS, true);
55+
} else {
56+
System.out.println("Skipping " + inputFile.getName());
57+
outputs.file(getInputArtifact());
58+
}
59+
}
60+
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.gradle.internal.dependencies.patches.azurecore;
11+
12+
import org.elasticsearch.gradle.internal.dependencies.patches.MethodReplacement;
13+
import org.objectweb.asm.ClassVisitor;
14+
import org.objectweb.asm.MethodVisitor;
15+
import org.objectweb.asm.Opcodes;
16+
17+
class ImplUtilsPatcher extends ClassVisitor {
18+
ImplUtilsPatcher(ClassVisitor classVisitor) {
19+
super(Opcodes.ASM9, classVisitor);
20+
}
21+
22+
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
23+
MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions);
24+
// `addShutdownHook` invokes `java.lang.Runtime.addShutdownHook`, which is forbidden (i.e. it will throw an Entitlements error).
25+
// We replace the method body here with `return null`.
26+
if (name.equals("addShutdownHookSafely")) {
27+
return new MethodReplacement(mv, () -> {
28+
mv.visitInsn(Opcodes.ACONST_NULL);
29+
mv.visitInsn(Opcodes.ARETURN);
30+
});
31+
}
32+
return mv;
33+
}
34+
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/dependencies/patches/hdfs/ShellPatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.gradle.internal.dependencies.patches.hdfs;
1111

12+
import org.elasticsearch.gradle.internal.dependencies.patches.MethodReplacement;
1213
import org.objectweb.asm.ClassVisitor;
1314
import org.objectweb.asm.ClassWriter;
1415
import org.objectweb.asm.MethodVisitor;

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/dependencies/patches/hdfs/ShutdownHookManagerPatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.gradle.internal.dependencies.patches.hdfs;
1111

12+
import org.elasticsearch.gradle.internal.dependencies.patches.MethodReplacement;
1213
import org.objectweb.asm.ClassVisitor;
1314
import org.objectweb.asm.ClassWriter;
1415
import org.objectweb.asm.MethodVisitor;

distribution/docker/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ dependencies {
117117
log4jConfig project(path: ":distribution", configuration: 'log4jConfig')
118118
tini "krallin:tini:0.19.0:${tiniArch}"
119119
allPlugins project(path: ':plugins', configuration: 'allPlugins')
120+
allPlugins project(path: ':x-pack:extras:plugins', configuration: 'allPlugins')
120121
filebeat_aarch64 "beats:filebeat:${VersionProperties.elasticsearch}:[email protected]"
121122
filebeat_x86_64 "beats:filebeat:${VersionProperties.elasticsearch}:[email protected]"
122123
filebeat_fips_aarch64 "beats:filebeat-fips:${VersionProperties.elasticsearch}:[email protected]"

distribution/docker/src/docker/dockerfiles/cloud_ess_fips/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ RUN cat <<EOF > /usr/share/elasticsearch/config/jvm.options.d/fips.options
172172
-Dorg.bouncycastle.fips.approved_only=true
173173
-Djava.security.properties=config/fips_java.security
174174
-Djava.security.policy=config/fips_java.policy
175+
-Djavax.net.ssl.trustStoreType=BCFKS
175176
-Djavax.net.ssl.trustStore=config/cacerts.bcfks
176177
-Djavax.net.ssl.trustStorePassword=passwordcacert
178+
177179
EOF
178180

179181
EXPOSE 9200 9300

0 commit comments

Comments
 (0)