Skip to content

Commit e71befa

Browse files
committed
Merge remote-tracking branch 'upstream/main' into entitlement/test-resolver
2 parents 89f117e + c3a1d58 commit e71befa

File tree

779 files changed

+12509
-3500
lines changed

Some content is hidden

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

779 files changed

+12509
-3500
lines changed

README.asciidoc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ From the `elastic-start-local` folder, check the connection to Elasticsearch usi
9797
source .env
9898
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
9999
----
100+
101+
To use the password for the `elastic` user, set and export the `ES_LOCAL_PASSWORD` environment variable. For example:
102+
103+
[source,sh]
104+
----
105+
source .env
106+
export ES_LOCAL_PASSWORD
107+
----
108+
100109
// NOTCONSOLE
101110

102111
=== Send requests to Elasticsearch
@@ -112,22 +121,23 @@ Here's an example curl command to create a new Elasticsearch index, using basic
112121

113122
[source,sh]
114123
----
115-
curl -u elastic:$ELASTIC_PASSWORD \
124+
curl -u elastic:$ES_LOCAL_PASSWORD \
116125
-X PUT \
117126
http://localhost:9200/my-new-index \
118127
-H 'Content-Type: application/json'
119128
----
129+
120130
// NOTCONSOLE
121131

122132
==== Using a language client
123133

124-
To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password you set in the environment variable.
134+
To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password stored in the `ES_LOCAL_PASSWORD` environment variable.
125135

126136
You'll use the following connection details:
127137

128138
* **Elasticsearch endpoint**: `http://localhost:9200`
129139
* **Username**: `elastic`
130-
* **Password**: `$ELASTIC_PASSWORD` (Value you set in the environment variable)
140+
* **Password**: `$ES_LOCAL_PASSWORD` (Value you set in the environment variable)
131141

132142
For example, to connect with the Python `elasticsearch` client:
133143

@@ -137,7 +147,7 @@ import os
137147
from elasticsearch import Elasticsearch
138148
139149
username = 'elastic'
140-
password = os.getenv('ELASTIC_PASSWORD') # Value you set in the environment variable
150+
password = os.getenv('ES_LOCAL_PASSWORD') # Value you set in the environment variable
141151
142152
client = Elasticsearch(
143153
"http://localhost:9200",

TESTING.asciidoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,8 @@ run it using Gradle:
4646
==== Launching and debugging from an IDE
4747

4848
If you want to run and debug Elasticsearch from your IDE, the `./gradlew run` task
49-
supports a remote debugging option. Run the following from your terminal:
50-
51-
---------------------------------------------------------------------------
52-
./gradlew run --debug-jvm
53-
---------------------------------------------------------------------------
54-
55-
Next start the "Debug Elasticsearch" run configuration in IntelliJ. This will enable the IDE to connect to the process and allow debug functionality.
56-
49+
supports a remote debugging option. Start the "Debug Elasticsearch" run configuration in IntelliJ. This will enable the
50+
IDE to connect to the process and allow debug functionality.
5751

5852
As such the IDE needs to be instructed to listen for connections on the debug port.
5953
Since we might run multiple JVMs as part of configuring and starting the cluster it's
@@ -64,6 +58,12 @@ NOTE: If you have imported the project into IntelliJ according to the instructio
6458
link:/CONTRIBUTING.md#importing-the-project-into-intellij-idea[CONTRIBUTING.md] then a debug run configuration
6559
named "Debug Elasticsearch" will be created for you and configured appropriately.
6660

61+
Next run the following from your terminal:
62+
63+
---------------------------------------------------------------------------
64+
./gradlew run --debug-jvm
65+
---------------------------------------------------------------------------
66+
6767
===== Debugging the CLI launcher
6868

6969
The gradle task does not start the Elasticsearch server process directly; like in the Elasticsearch distribution,

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.19.2"
11+
id "com.gradle.develocity" version "4.0.1"
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.19.2"
12+
id "com.gradle.develocity" version "4.0.1"
1313
}
1414

1515
dependencyResolutionManagement {

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,27 @@
1414
*/
1515
public enum DockerBase {
1616
// "latest" here is intentional, since the image name specifies "9"
17-
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "Dockerfile.default"),
17+
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "dockerfiles/default/Dockerfile"),
1818

1919
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
2020
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum", "Dockerfile"),
2121

2222
// Chainguard based wolfi image with latest jdk
23-
// This is usually updated via renovatebot
24-
// spotless:off
2523
WOLFI(
26-
"docker.elastic.co/wolfi/chainguard-base:latest@sha256:29150cd940cc7f69407d978d5a19c86f4d9e67cf44e4d6ded787a497e8f27c9a",
24+
null,
2725
"-wolfi",
2826
"apk",
29-
"Dockerfile"
27+
"dockerfiles/wolfi/Dockerfile"
3028
),
31-
// spotless:on
3229
// Based on WOLFI above, with more extras. We don't set a base image because
3330
// we programmatically extend from the wolfi image.
3431
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.ess"),
3532

3633
CLOUD_ESS_FIPS(
37-
"docker.elastic.co/wolfi/chainguard-base-fips:sha256-ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7@sha256:ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7",
34+
null,
3835
"-cloud-ess-fips",
3936
"apk",
40-
"Dockerfile.ess-fips"
37+
"dockerfiles/cloud_ess_fips/Dockerfile"
4138
);
4239

4340
private final String image;

build-tools/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ gradlePlugin {
5151
id = 'elasticsearch.stable-esplugin'
5252
implementationClass = 'org.elasticsearch.gradle.plugin.StablePluginBuildPlugin'
5353
}
54+
testBuildInfo {
55+
id = 'elasticsearch.test-build-info'
56+
implementationClass = 'org.elasticsearch.gradle.test.TestBuildInfoPlugin'
57+
}
5458
javaRestTest {
5559
id = 'elasticsearch.java-rest-test'
5660
implementationClass = 'org.elasticsearch.gradle.test.JavaRestTestPlugin'

build-tools/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pluginManagement {
1010
includeBuild "../build-conventions"
1111
}
1212
plugins {
13-
id "com.gradle.develocity" version "3.19.2"
13+
id "com.gradle.develocity" version "4.0.1"
1414
}
1515
include 'reaper'
1616

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package org.elasticsearch.gradle.test
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper
4+
5+
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
6+
import org.gradle.testkit.runner.TaskOutcome
7+
8+
class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
9+
def "works"() {
10+
given:
11+
file("src/main/java/com/example/Example.java") << """
12+
package com.example;
13+
14+
public class Example {
15+
}
16+
"""
17+
18+
file("src/main/java/module-info.java") << """
19+
module com.example {
20+
exports com.example;
21+
}
22+
"""
23+
24+
buildFile << """
25+
import org.elasticsearch.gradle.plugin.GenerateTestBuildInfoTask;
26+
27+
plugins {
28+
id 'java'
29+
id 'elasticsearch.test-build-info'
30+
}
31+
32+
repositories {
33+
mavenCentral()
34+
}
35+
36+
tasks.withType(GenerateTestBuildInfoTask.class) {
37+
componentName = 'example-component'
38+
outputFile = new File('build/generated-build-info/plugin-test-build-info.json')
39+
}
40+
"""
41+
42+
when:
43+
def result = gradleRunner('generateTestBuildInfo').build()
44+
def task = result.task(":generateTestBuildInfo")
45+
46+
47+
then:
48+
task.outcome == TaskOutcome.SUCCESS
49+
50+
def output = file("build/generated-build-info/plugin-test-build-info.json")
51+
output.exists() == true
52+
53+
def location = Map.of(
54+
"module", "com.example",
55+
"representative_class", "com/example/Example.class"
56+
)
57+
def expectedOutput = Map.of(
58+
"component", "example-component",
59+
"locations", List.of(location)
60+
)
61+
new ObjectMapper().readValue(output, Map.class) == expectedOutput
62+
}
63+
}

build-tools/src/main/java/org/elasticsearch/gradle/plugin/BasePluginBuildPlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ private TaskProvider<Zip> createBundleTasks(final Project project, PluginPropert
121121
task.getIsLicensed().set(providerFactory.provider(extension::isLicensed));
122122

123123
var mainSourceSet = project.getExtensions().getByType(SourceSetContainer.class).getByName(SourceSet.MAIN_SOURCE_SET_NAME);
124-
FileCollection moduleInfoFile = mainSourceSet.getOutput().getAsFileTree().matching(p -> p.include("module-info.class"));
124+
FileCollection moduleInfoFile = mainSourceSet.getOutput()
125+
.getClassesDirs()
126+
.getAsFileTree()
127+
.matching(p -> p.include("module-info.class"));
125128
task.getModuleInfoFile().setFrom(moduleInfoFile);
126129

127130
});

0 commit comments

Comments
 (0)