Skip to content

Commit bf095d9

Browse files
Merge remote-tracking branch 'elastic/master' into deduplicate-index-metadata
2 parents 179654f + b68bd78 commit bf095d9

File tree

895 files changed

+16971
-18563
lines changed

Some content is hidden

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

895 files changed

+16971
-18563
lines changed

.ci/bwcVersions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ BWC_VERSION:
1919
- "7.6.2"
2020
- "7.7.0"
2121
- "7.7.1"
22+
- "7.7.2"
2223
- "7.8.0"
2324
- "7.9.0"
2425
- "8.0.0"

CONTRIBUTING.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,20 @@ onwards and Eclipse 2020-3 and onwards.
115115

116116
./gradlew :run
117117

118-
You can access Elasticsearch with:
118+
That'll spend a while building Elasticsearch and then it'll start Elasticsearch,
119+
writing its log above Gradle's status message. We log a lot of stuff on startup,
120+
specifically these lines tell you that Elasticsearch is ready:
121+
122+
[2020-05-29T14:50:35,167][INFO ][o.e.h.AbstractHttpServerTransport] [runTask-0] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
123+
[2020-05-29T14:50:35,169][INFO ][o.e.n.Node ] [runTask-0] started
124+
125+
But to be honest its typically easier to wait until the console stopps scrolling
126+
and then run `curl` in another window like this:
119127

120128
curl -u elastic:password localhost:9200
121129

130+
131+
122132
### Importing the project into IntelliJ IDEA
123133

124134
Elasticsearch builds using Java 14. When importing into IntelliJ you will need

build.gradle

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ apply from: 'gradle/ide.gradle'
4646
apply from: 'gradle/forbidden-dependencies.gradle'
4747
apply from: 'gradle/formatting.gradle'
4848
apply from: 'gradle/local-distribution.gradle'
49+
apply from: 'gradle/fips.gradle'
50+
apply from: 'gradle/run.gradle'
4951

5052
// common maven publishing configuration
5153
allprojects {
@@ -374,43 +376,6 @@ allprojects {
374376
tasks.named('eclipse') { dependsOn 'cleanEclipse', 'copyEclipseSettings' }
375377
}
376378

377-
// we need to add the same --debug-jvm option as
378-
// the real RunTask has, so we can pass it through
379-
class Run extends DefaultTask {
380-
boolean debug = false
381-
382-
@Option(
383-
option = "debug-jvm",
384-
description = "Enable debugging configuration, to allow attaching a debugger to elasticsearch."
385-
)
386-
public void setDebug(boolean enabled) {
387-
project.project(':distribution').run.debug = enabled
388-
}
389-
390-
@Option(
391-
option = "data-dir",
392-
description = "Override the base data directory used by the testcluster"
393-
)
394-
public void setDataDir(String dataDirStr) {
395-
project.project(':distribution').run.dataDir = dataDirStr
396-
}
397-
398-
@Option(
399-
option = "keystore-password",
400-
description = "Set the elasticsearch keystore password"
401-
)
402-
public void setKeystorePassword(String password) {
403-
project.project(':distribution').run.keystorePassword = password
404-
}
405-
}
406-
407-
tasks.register("run", Run) {
408-
dependsOn ':distribution:run'
409-
description = 'Runs elasticsearch in the foreground'
410-
group = 'Verification'
411-
impliesSubProjects = true
412-
}
413-
414379
wrapper {
415380
distributionType = 'ALL'
416381
doLast {

buildSrc/build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ if (project != rootProject) {
174174
'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')
175175
jarHell.enabled = false
176176
thirdPartyAudit.enabled = false
177-
if (Boolean.parseBoolean(System.getProperty("tests.fips.enabled"))) {
177+
if (org.elasticsearch.gradle.info.BuildParams.inFipsJvm) {
178+
// We don't support running gradle with a JVM that is in FIPS 140 mode, so we don't test it.
179+
// WaitForHttpResourceTests tests would fail as they use JKS/PKCS12 keystores
178180
test.enabled = false
181+
testingConventions.enabled = false
179182
}
180183

181-
configurations {
182-
distribution
183-
reaper
184-
}
184+
configurations.register("distribution")
185+
configurations.register("reaper")
185186

186187
dependencies {
187188
reaper project('reaper')
@@ -221,6 +222,8 @@ if (project != rootProject) {
221222
forbiddenPatterns {
222223
exclude '**/*.wav'
223224
exclude '**/*.p12'
225+
exclude '**/*.jks'
226+
exclude '**/*.crt'
224227
// the file that actually defines nocommit
225228
exclude '**/ForbiddenPatternsTask.java'
226229
exclude '**/*.bcfks'

buildSrc/src/integTest/java/org/elasticsearch/gradle/ExportElasticsearchBuildResourcesTaskIT.java

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,20 @@ public void testUpToDateWithSourcesConfigured() {
3232
BuildResult result = getGradleRunner(PROJECT_NAME).withArguments("buildResources", "-s", "-i").build();
3333
assertTaskSuccessful(result, ":buildResources");
3434
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle.xml");
35-
36-
// using task avoidance api means the task configuration of the sample task is never triggered
37-
assertBuildFileDoesNotExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
35+
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
3836

3937
result = getGradleRunner(PROJECT_NAME).withArguments("buildResources", "-s", "-i").build();
4038
assertTaskUpToDate(result, ":buildResources");
4139
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle.xml");
42-
43-
// using task avoidance api means the task configuration of the sample task is never triggered
44-
assertBuildFileDoesNotExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
45-
}
46-
47-
public void testImplicitTaskDependencyCopy() {
48-
BuildResult result = getGradleRunner(PROJECT_NAME).withArguments("clean", "sampleCopyAll", "-s", "-i").build();
49-
50-
assertTaskSuccessful(result, ":buildResources");
51-
assertTaskSuccessful(result, ":sampleCopyAll");
52-
assertBuildFileExists(result, PROJECT_NAME, "sampleCopyAll/checkstyle.xml");
53-
54-
// using task avoidance api means the task configuration of the sample task is never triggered
55-
// which means buildResource is not configured to copy this file
56-
assertBuildFileDoesNotExists(result, PROJECT_NAME, "sampleCopyAll/checkstyle_suppressions.xml");
40+
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
5741
}
5842

59-
public void testImplicitTaskDependencyInputFileOfOther() {
60-
BuildResult result = getGradleRunner(PROJECT_NAME).withArguments("clean", "sample", "-s", "-i").build();
43+
public void testOutputAsInput() {
44+
BuildResult result = getGradleRunner(PROJECT_NAME).withArguments("clean", "sampleCopy", "-s", "-i").build();
6145

62-
assertTaskSuccessful(result, ":sample");
63-
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle.xml");
64-
assertBuildFileExists(result, PROJECT_NAME, "build-tools-exported/checkstyle_suppressions.xml");
46+
assertTaskSuccessful(result, ":sampleCopy");
47+
assertBuildFileExists(result, PROJECT_NAME, "sampleCopy/checkstyle.xml");
48+
assertBuildFileExists(result, PROJECT_NAME, "sampleCopy/checkstyle_suppressions.xml");
6549
}
6650

6751
public void testIncorrectUsage() {

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,15 @@
1919
package org.elasticsearch.gradle
2020

2121
import groovy.transform.CompileStatic
22-
import org.apache.commons.io.IOUtils
2322
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
2423
import org.elasticsearch.gradle.precommit.PrecommitTasks
25-
import org.elasticsearch.gradle.test.ErrorReportingTestListener
26-
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster
27-
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
28-
import org.elasticsearch.gradle.util.GradleUtils
29-
import org.gradle.api.*
30-
import org.gradle.api.artifacts.Configuration
31-
import org.gradle.api.artifacts.Dependency
32-
import org.gradle.api.artifacts.ModuleDependency
33-
import org.gradle.api.artifacts.ProjectDependency
34-
import org.gradle.api.artifacts.dsl.RepositoryHandler
35-
import org.gradle.api.artifacts.repositories.ExclusiveContentRepository
36-
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
37-
import org.gradle.api.artifacts.repositories.IvyPatternRepositoryLayout
38-
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
39-
import org.gradle.api.credentials.HttpHeaderCredentials
40-
import org.gradle.api.execution.TaskActionListener
24+
import org.gradle.api.GradleException
25+
import org.gradle.api.InvalidUserDataException
26+
import org.gradle.api.Plugin
27+
import org.gradle.api.Project
4128
import org.gradle.api.file.CopySpec
4229
import org.gradle.api.plugins.ExtraPropertiesExtension
43-
import org.gradle.api.plugins.JavaPlugin
4430
import org.gradle.api.tasks.bundling.Jar
45-
import org.gradle.api.tasks.testing.Test
46-
import org.gradle.util.GradleVersion
47-
48-
import java.nio.charset.StandardCharsets
4931

5032
/**
5133
* Encapsulates build configuration for elasticsearch projects.
@@ -68,59 +50,8 @@ class BuildPlugin implements Plugin<Project> {
6850
project.pluginManager.apply('elasticsearch.publish')
6951
project.pluginManager.apply(DependenciesInfoPlugin)
7052

71-
project.getTasks().register("buildResources", ExportElasticsearchBuildResourcesTask)
72-
7353
project.extensions.getByType(ExtraPropertiesExtension).set('versions', VersionProperties.versions)
7454
PrecommitTasks.create(project, true)
75-
configureFips140(project)
76-
}
77-
78-
static void configureFips140(Project project) {
79-
// Common config when running with a FIPS-140 runtime JVM
80-
if (inFipsJvm()) {
81-
ExportElasticsearchBuildResourcesTask buildResources = project.tasks.getByName('buildResources') as ExportElasticsearchBuildResourcesTask
82-
File securityProperties = buildResources.copy("fips_java.security")
83-
File securityPolicy = buildResources.copy("fips_java.policy")
84-
File bcfksKeystore = buildResources.copy("cacerts.bcfks")
85-
// This configuration can be removed once system modules are available
86-
GradleUtils.maybeCreate(project.configurations, 'extraJars') {
87-
project.dependencies.add('extraJars', "org.bouncycastle:bc-fips:1.0.1")
88-
project.dependencies.add('extraJars', "org.bouncycastle:bctls-fips:1.0.9")
89-
}
90-
project.pluginManager.withPlugin("elasticsearch.testclusters") {
91-
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = project.extensions.findByName(TestClustersPlugin.EXTENSION_NAME) as NamedDomainObjectContainer<ElasticsearchCluster>
92-
testClusters.all { ElasticsearchCluster cluster ->
93-
for (File dep : project.getConfigurations().getByName("extraJars").getFiles()){
94-
cluster.extraJarFile(dep)
95-
}
96-
cluster.extraConfigFile("fips_java.security", securityProperties)
97-
cluster.extraConfigFile("fips_java.policy", securityPolicy)
98-
cluster.extraConfigFile("cacerts.bcfks", bcfksKeystore)
99-
cluster.systemProperty('java.security.properties', '=${ES_PATH_CONF}/fips_java.security')
100-
cluster.systemProperty('java.security.policy', '=${ES_PATH_CONF}/fips_java.policy')
101-
cluster.systemProperty('javax.net.ssl.trustStore', '${ES_PATH_CONF}/cacerts.bcfks')
102-
cluster.systemProperty('javax.net.ssl.trustStorePassword', 'password')
103-
cluster.systemProperty('javax.net.ssl.keyStorePassword', 'password')
104-
cluster.systemProperty('javax.net.ssl.keyStoreType', 'BCFKS')
105-
}
106-
}
107-
project.tasks.withType(Test).configureEach { Test task ->
108-
task.dependsOn(buildResources)
109-
task.systemProperty('javax.net.ssl.trustStorePassword', 'password')
110-
task.systemProperty('javax.net.ssl.keyStorePassword', 'password')
111-
task.systemProperty('javax.net.ssl.trustStoreType', 'BCFKS')
112-
// Using the key==value format to override default JVM security settings and policy
113-
// see also: https://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html
114-
task.systemProperty('java.security.properties', String.format(Locale.ROOT, "=%s", securityProperties.toString()))
115-
task.systemProperty('java.security.policy', String.format(Locale.ROOT, "=%s", securityPolicy.toString()))
116-
task.systemProperty('javax.net.ssl.trustStore', bcfksKeystore.toString())
117-
}
118-
119-
}
120-
}
121-
122-
private static inFipsJvm(){
123-
return Boolean.parseBoolean(System.getProperty("tests.fips.enabled"));
12455
}
12556

12657
static void configureLicenseAndNotice(Project project) {

0 commit comments

Comments
 (0)