Skip to content

Commit e167fb9

Browse files
Merge remote-tracking branch 'upstream/master' into long_sort_optimization
2 parents 33c8275 + 8195d68 commit e167fb9

File tree

4,772 files changed

+132206
-70746
lines changed

Some content is hidden

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

4,772 files changed

+132206
-70746
lines changed

.ci/build-cache.gradle

-18
This file was deleted.

.ci/bwcVersions

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
BWC_VERSION:
2+
- "7.0.0"
3+
- "7.0.1"
4+
- "7.1.0"
5+
- "7.1.1"
6+
- "7.2.0"
7+
- "7.2.1"
8+
- "7.3.0"
9+
- "7.3.1"
10+
- "7.4.0"
11+
- "8.0.0"

.ci/init.gradle

+91-37
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,100 @@
1-
if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFACTORY_TOKEN == null) {
2-
throw new GradleException("Using init script without configuration")
3-
} else {
4-
logger.info("Using elastic artifactory repos")
5-
settingsEvaluated { settings ->
6-
settings.pluginManagement {
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+
['VAULT_ADDR', 'VAULT_ROLE_ID', 'VAULT_SECRET_ID'].each {
14+
if (System.env."$it" == null) {
15+
throw new GradleException("$it must be set!")
16+
17+
}
18+
}
19+
20+
final String vaultToken = new Vault(
21+
new VaultConfig()
22+
.address(System.env.VAULT_ADDR)
23+
.engineVersion(1)
24+
.build()
25+
)
26+
.withRetries(5, 1000)
27+
.auth()
28+
.loginByAppRole("approle", System.env.VAULT_ROLE_ID, System.env.VAULT_SECRET_ID)
29+
.getAuthClientToken();
30+
31+
final Vault vault = new Vault(
32+
new VaultConfig()
33+
.address(System.env.VAULT_ADDR)
34+
.engineVersion(1)
35+
.token(vaultToken)
36+
.build()
37+
)
38+
.withRetries(5, 1000)
39+
40+
final Map<String,String> artifactoryCredentials = vault.logical()
41+
.read("secret/elasticsearch-ci/artifactory.elstc.co")
42+
.getData();
43+
44+
logger.info("Using elastic artifactory repos")
45+
Closure configCache = {
46+
return {
47+
name "artifactory-gradle-release"
48+
url "https://artifactory.elstc.co/artifactory/gradle-release"
49+
credentials {
50+
username artifactoryCredentials.get("username")
51+
password artifactoryCredentials.get("token")
52+
}
53+
}
54+
}
55+
settingsEvaluated { settings ->
56+
settings.pluginManagement {
57+
repositories {
58+
maven configCache()
59+
}
60+
}
61+
}
62+
projectsLoaded {
63+
allprojects {
64+
buildscript {
765
repositories {
8-
maven {
9-
name "artifactory-gradle-plugins"
10-
url "https://artifactory.elstc.co/artifactory/gradle-plugins"
11-
credentials {
12-
username System.env.ELASTIC_ARTIFACTORY_USERNAME
13-
password System.env.ELASTIC_ARTIFACTORY_TOKEN
14-
}
15-
}
16-
gradlePluginPortal()
66+
maven configCache()
1767
}
1868
}
69+
repositories {
70+
maven configCache()
71+
}
1972
}
20-
projectsLoaded {
21-
allprojects {
22-
buildscript {
23-
repositories {
24-
maven {
25-
name "artifactory-gradle-release"
26-
url "https://artifactory.elstc.co/artifactory/gradle-release/"
27-
credentials {
28-
username System.env.ELASTIC_ARTIFACTORY_USERNAME
29-
password System.env.ELASTIC_ARTIFACTORY_TOKEN
30-
}
31-
}
32-
}
33-
}
34-
repositories {
35-
maven {
36-
name "artifactory-gradle-release"
37-
url "https://artifactory.elstc.co/artifactory/gradle-release/"
38-
credentials {
39-
username System.env.ELASTIC_ARTIFACTORY_USERNAME
40-
password System.env.ELASTIC_ARTIFACTORY_TOKEN
41-
}
73+
rootProject {
74+
project.pluginManager.withPlugin('com.gradle.build-scan') {
75+
buildScan.server = 'https://gradle-enterprise.elastic.co'
76+
}
77+
}
78+
}
79+
80+
final String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url')
81+
final boolean buildCachePush = Boolean.valueOf(System.getProperty('org.elasticsearch.build.cache.push', 'false'))
82+
83+
if (buildCacheUrl) {
84+
final Map<String,String> buildCacheCredentials = vault.logical()
85+
.read("secret/elasticsearch-ci/gradle-build-cache")
86+
.getData();
87+
gradle.settingsEvaluated { settings ->
88+
settings.buildCache {
89+
remote(HttpBuildCache) {
90+
url = buildCacheUrl
91+
push = buildCachePush
92+
credentials {
93+
username = buildCacheCredentials.get("username")
94+
password = buildCacheCredentials.get("password")
4295
}
4396
}
4497
}
4598
}
4699
}
100+

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ html_docs
4141
# random old stuff that we should look at the necessity of...
4242
/tmp/
4343
eclipse-build
44+
45+
# projects using testfixtures
46+
testfixtures_shared/

LICENSE.txt

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
Source code in this repository is variously licensed under the Apache License
2-
Version 2.0, an Apache compatible license, or the Elastic License. Outside of
3-
the "x-pack" folder, source code in a given file is licensed under the Apache
4-
License Version 2.0, unless otherwise noted at the beginning of the file or a
5-
LICENSE file present in the directory subtree declares a separate license.
6-
Within the "x-pack" folder, source code in a given file is licensed under the
7-
Elastic License, unless otherwise noted at the beginning of the file or a
8-
LICENSE file present in the directory subtree declares a separate license.
1+
Source code in this repository is covered by one of three licenses: (i) the
2+
Apache License 2.0 (ii) an Apache License 2.0 compatible license (iii) the
3+
Elastic License. The default license throughout the repository is Apache License
4+
2.0 unless the header specifies another license. Elastic Licensed code is found
5+
only in the x-pack directory.
96

107
The build produces two sets of binaries - one set that falls under the Elastic
11-
License and another set that falls under Apache License Version 2.0. The
12-
binaries that contain `-oss` in the artifact name are licensed under the Apache
13-
License Version 2.0.
8+
License and another set that falls under Apache License 2.0. The binaries that
9+
contain `-oss` in the artifact name are licensed under Apache License 2.0 and
10+
these binaries do not package any code from the x-pack directory.

README.textile

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ Complete control on the index level is allowed. As an example, in the above case
155155
<pre>
156156
curl -XPUT http://localhost:9200/another_user?pretty -H 'Content-Type: application/json' -d '
157157
{
158-
"index" : {
159-
"number_of_shards" : 2,
160-
"number_of_replicas" : 1
158+
"settings" : {
159+
"index.number_of_shards" : 2,
160+
"index.number_of_replicas" : 1
161161
}
162162
}'
163163
</pre>

TESTING.asciidoc

+15-22
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,21 @@ In order to set an Elasticsearch setting, provide a setting with the following p
7676

7777
=== Test case filtering.
7878

79-
- `tests.class` is a class-filtering shell-like glob pattern,
80-
- `tests.method` is a method-filtering glob pattern.
79+
You can run a single test, provided that you specify the Gradle project. See the documentation on
80+
https://docs.gradle.org/current/userguide/userguide_single.html#simple_name_pattern[simple name pattern filtering].
8181

82-
Run a single test case (variants)
82+
Run a single test case in the `server` project:
8383

8484
----------------------------------------------------------
85-
./gradlew test -Dtests.class=org.elasticsearch.package.ClassName
86-
./gradlew test "-Dtests.class=*.ClassName"
85+
./gradlew :server:test --tests org.elasticsearch.package.ClassName
8786
----------------------------------------------------------
8887

89-
Run all tests in a package and its sub-packages
88+
Run all tests in a package and its sub-packages:
9089

9190
----------------------------------------------------
92-
./gradlew test "-Dtests.class=org.elasticsearch.package.*"
91+
./gradlew :server:test --tests 'org.elasticsearch.package.*'
9392
----------------------------------------------------
9493

95-
Run any test methods that contain 'esi' (like: ...r*esi*ze...)
96-
97-
-------------------------------
98-
./gradlew test "-Dtests.method=*esi*"
99-
-------------------------------
100-
10194
Run all tests that are waiting for a bugfix (disabled by default)
10295

10396
------------------------------------------------
@@ -118,7 +111,7 @@ Every test repetition will have a different method seed
118111
(derived from a single random master seed).
119112

120113
--------------------------------------------------
121-
./gradlew test -Dtests.iters=N -Dtests.class=*.ClassName
114+
./gradlew :server:test -Dtests.iters=N --tests org.elasticsearch.package.ClassName
122115
--------------------------------------------------
123116

124117
=== Repeats _all_ tests of ClassName N times.
@@ -127,7 +120,7 @@ Every test repetition will have exactly the same master (0xdead) and
127120
method-level (0xbeef) seed.
128121

129122
------------------------------------------------------------------------
130-
./gradlew test -Dtests.iters=N -Dtests.class=*.ClassName -Dtests.seed=DEAD:BEEF
123+
./gradlew :server:test -Dtests.iters=N -Dtests.seed=DEAD:BEEF --tests org.elasticsearch.package.ClassName
131124
------------------------------------------------------------------------
132125

133126
=== Repeats a given test N times
@@ -137,14 +130,14 @@ ie: testFoo[0], testFoo[1], etc... so using testmethod or tests.method
137130
ending in a glob is necessary to ensure iterations are run).
138131

139132
-------------------------------------------------------------------------
140-
./gradlew test -Dtests.iters=N -Dtests.class=*.ClassName -Dtests.method=mytest*
133+
./gradlew :server:test -Dtests.iters=N --tests org.elasticsearch.package.ClassName.methodName
141134
-------------------------------------------------------------------------
142135

143136
Repeats N times but skips any tests after the first failure or M initial failures.
144137

145138
-------------------------------------------------------------
146-
./gradlew test -Dtests.iters=N -Dtests.failfast=true -Dtestcase=...
147-
./gradlew test -Dtests.iters=N -Dtests.maxfailures=M -Dtestcase=...
139+
./gradlew test -Dtests.iters=N -Dtests.failfast=true ...
140+
./gradlew test -Dtests.iters=N -Dtests.maxfailures=M ...
148141
-------------------------------------------------------------
149142

150143
=== Test groups.
@@ -175,7 +168,7 @@ systemProp.tests.jvms=8
175168
----------------------------
176169

177170
Its difficult to pick the "right" number here. Hypercores don't count for CPU
178-
intensive tests and you should leave some slack for JVM-interal threads like
171+
intensive tests and you should leave some slack for JVM-internal threads like
179172
the garbage collector. And you have to have enough RAM to handle each JVM.
180173

181174
=== Test compatibility.
@@ -553,10 +546,10 @@ When running `./gradlew check`, minimal bwc checks are also run against compatib
553546
Sometimes a backward compatibility change spans two versions. A common case is a new functionality
554547
that needs a BWC bridge in an unreleased versioned of a release branch (for example, 5.x).
555548
To test the changes, you can instruct Gradle to build the BWC version from a another remote/branch combination instead of
556-
pulling the release branch from GitHub. You do so using the `tests.bwc.remote` and `tests.bwc.refspec.BRANCH` system properties:
549+
pulling the release branch from GitHub. You do so using the `bwc.remote` and `bwc.refspec.BRANCH` system properties:
557550

558551
-------------------------------------------------
559-
./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec.5.x=index_req_bwc_5.x
552+
./gradlew check -Dbwc.remote=${remote} -Dbwc.refspec.5.x=index_req_bwc_5.x
560553
-------------------------------------------------
561554

562555
The branch needs to be available on the remote that the BWC makes of the
@@ -571,7 +564,7 @@ will need to:
571564
will contain your change.
572565
. Create a branch called `index_req_bwc_5.x` off `5.x`. This will contain your bwc layer.
573566
. Push both branches to your remote repository.
574-
. Run the tests with `./gradlew check -Dtests.bwc.remote=${remote} -Dtests.bwc.refspec.5.x=index_req_bwc_5.x`.
567+
. Run the tests with `./gradlew check -Dbwc.remote=${remote} -Dbwc.refspec.5.x=index_req_bwc_5.x`.
575568

576569
==== Skip fetching latest
577570

Vagrantfile

+12-7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ Vagrant.configure(2) do |config|
4141
# the elasticsearch project called vagrant....
4242
config.vm.synced_folder '.', '/vagrant', disabled: true
4343
config.vm.synced_folder '.', '/elasticsearch'
44+
# TODO: make these syncs work for windows!!!
45+
config.vm.synced_folder "#{Dir.home}/.vagrant/gradle/caches/jars-3", "/root/.gradle/caches/jars-3",
46+
create: true,
47+
owner: "vagrant"
48+
config.vm.synced_folder "#{Dir.home}/.vagrant/gradle/caches/modules-2", "/root/.gradle/caches/modules-2",
49+
create: true,
50+
owner: "vagrant"
51+
config.vm.synced_folder "#{Dir.home}/.gradle/wrapper", "/root/.gradle/wrapper",
52+
create: true,
53+
owner: "vagrant"
4454

4555
# Expose project directory. Note that VAGRANT_CWD may not be the same as Dir.pwd
4656
PROJECT_DIR = ENV['VAGRANT_PROJECT_DIR'] || Dir.pwd
@@ -376,22 +386,17 @@ export ZIP=/elasticsearch/distribution/zip/build/distributions
376386
export TAR=/elasticsearch/distribution/tar/build/distributions
377387
export RPM=/elasticsearch/distribution/rpm/build/distributions
378388
export DEB=/elasticsearch/distribution/deb/build/distributions
379-
export BATS=/project/build/bats
380-
export BATS_UTILS=/project/build/packaging/bats/utils
381-
export BATS_TESTS=/project/build/packaging/bats/tests
382-
export PACKAGING_ARCHIVES=/project/build/packaging/archives
383389
export PACKAGING_TESTS=/project/build/packaging/tests
384390
VARS
385391
cat \<\<SUDOERS_VARS > /etc/sudoers.d/elasticsearch_vars
386392
Defaults env_keep += "ZIP"
387393
Defaults env_keep += "TAR"
388394
Defaults env_keep += "RPM"
389395
Defaults env_keep += "DEB"
390-
Defaults env_keep += "BATS"
391-
Defaults env_keep += "BATS_UTILS"
392-
Defaults env_keep += "BATS_TESTS"
393396
Defaults env_keep += "PACKAGING_ARCHIVES"
394397
Defaults env_keep += "PACKAGING_TESTS"
398+
Defaults env_keep += "BATS_UTILS"
399+
Defaults env_keep += "BATS_TESTS"
395400
Defaults env_keep += "JAVA_HOME"
396401
Defaults env_keep += "SYSTEM_JAVA_HOME"
397402
SUDOERS_VARS

0 commit comments

Comments
 (0)