Skip to content

Commit c286096

Browse files
Merge remote-tracking branch 'origin/master' into enhance_reindex_shared_retry
2 parents 4943ab9 + 185c583 commit c286096

File tree

3,271 files changed

+65799
-30036
lines changed

Some content is hidden

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

3,271 files changed

+65799
-30036
lines changed

.ci/build-cache.gradle

-18
This file was deleted.

.ci/bwcVersions

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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.4.0"
10+
- "8.0.0"

.ci/init.gradle

+81-37
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,90 @@
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+
.auth()
27+
.loginByAppRole("approle", System.env.VAULT_ROLE_ID, System.env.VAULT_SECRET_ID)
28+
.getAuthClientToken();
29+
30+
final Vault vault = new Vault(
31+
new VaultConfig()
32+
.address(System.env.VAULT_ADDR)
33+
.engineVersion(1)
34+
.token(vaultToken)
35+
.build()
36+
)
37+
38+
final Map<String,String> artifactoryCredentials = vault.logical()
39+
.read("secret/elasticsearch-ci/artifactory.elstc.co")
40+
.getData();
41+
42+
logger.info("Using elastic artifactory repos")
43+
Closure configCache = {
44+
return {
45+
name "artifactory-gradle-release"
46+
url "https://artifactory.elstc.co/artifactory/gradle-release"
47+
credentials {
48+
username artifactoryCredentials.get("username")
49+
password artifactoryCredentials.get("token")
50+
}
51+
}
52+
}
53+
settingsEvaluated { settings ->
54+
settings.pluginManagement {
55+
repositories {
56+
maven configCache()
57+
}
58+
}
59+
}
60+
projectsLoaded {
61+
allprojects {
62+
buildscript {
763
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()
64+
maven configCache()
1765
}
1866
}
67+
repositories {
68+
maven configCache()
69+
}
1970
}
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-
}
71+
}
72+
73+
if (System.env.GRADLE_BUILD_CACHE_URL != null) {
74+
final Map<String,String> buildCacheCredentials = vault.logical()
75+
.read("secret/elasticsearch-ci/gradle-build-cache")
76+
.getData();
77+
gradle.settingsEvaluated { settings ->
78+
settings.buildCache {
79+
remote(HttpBuildCache) {
80+
url = System.getenv('GRADLE_BUILD_CACHE_URL')
81+
push = Boolean.valueOf(System.getenv('GRADLE_BUILD_CACHE_PUSH') ?: 'false')
82+
credentials {
83+
username = buildCacheCredentials.get("username")
84+
password = buildCacheCredentials.get("password")
4285
}
4386
}
4487
}
4588
}
4689
}
90+

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>

build.gradle

+21-8
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@ import org.gradle.util.DistributionLocator
2929
import org.gradle.plugins.ide.eclipse.model.SourceFolder
3030

3131
plugins {
32-
id 'com.gradle.build-scan' version '2.2.1'
32+
id 'com.gradle.build-scan' version '2.3'
3333
id 'base'
3434
id 'elasticsearch.global-build-info'
3535
}
36-
if (Boolean.valueOf(project.findProperty('org.elasticsearch.acceptScanTOS') ?: "false")) {
37-
buildScan {
38-
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
39-
termsOfServiceAgree = 'yes'
40-
}
41-
}
36+
37+
apply plugin: 'nebula.info-scm'
38+
apply from: 'gradle/build-scan.gradle'
4239

4340
// common maven publishing configuration
4441
allprojects {
@@ -49,7 +46,6 @@ allprojects {
4946

5047
BuildPlugin.configureRepositories(project)
5148

52-
apply plugin: 'nebula.info-scm'
5349
String licenseCommit
5450
if (VersionProperties.elasticsearch.toString().endsWith('-SNAPSHOT')) {
5551
licenseCommit = scminfo.change ?: "master" // leniency for non git builds
@@ -107,6 +103,17 @@ subprojects {
107103
* logic in VersionUtils.java. */
108104
BwcVersions versions = new BwcVersions(file('server/src/main/java/org/elasticsearch/Version.java').readLines('UTF-8'))
109105

106+
task updateCIBwcVersions() {
107+
doLast {
108+
File yml = file(".ci/bwcVersions")
109+
yml.text = ""
110+
yml << "BWC_VERSION:\n"
111+
versions.indexCompatible.each {
112+
yml << " - \"$it\"\n"
113+
}
114+
}
115+
}
116+
110117
// build metadata from previous build, contains eg hashes for bwc builds
111118
String buildMetadataValue = System.getenv('BUILD_METADATA')
112119
if (buildMetadataValue == null) {
@@ -150,6 +157,12 @@ task verifyVersions {
150157
.collect { Version.fromString(it) }
151158
)
152159
}
160+
String ciYml = file(".ci/bwcVersions").text
161+
bwcVersions.indexCompatible.each {
162+
if (ciYml.contains("\"$it\"\n") == false) {
163+
throw new Exception(".ci/bwcVersions is outdated, run `./gradlew updateCIBwcVersions` and check in the results");
164+
}
165+
}
153166
}
154167
}
155168

buildSrc/build.gradle

+12-3
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,30 @@ if (JavaVersion.current() < JavaVersion.VERSION_11) {
6666
throw new GradleException('At least Java 11 is required to build elasticsearch gradle tools')
6767
}
6868

69-
// Keep compatibility with Java 8 for external users of build-tools that haven't migrated to Java 11
70-
targetCompatibility = '11'
71-
sourceCompatibility = '11'
69+
allprojects {
70+
targetCompatibility = '11'
71+
sourceCompatibility = '11'
72+
}
7273

7374
sourceSets {
7475
// We have a few classes that need to be compiled for older java versions
7576
minimumRuntime { }
7677
}
7778

79+
configurations {
80+
reaper
81+
}
82+
7883
compileMinimumRuntimeJava {
7984
targetCompatibility = 8
8085
sourceCompatibility = 8
8186
}
8287

8388
jar {
8489
from sourceSets.minimumRuntime.output
90+
into('META-INF') {
91+
from configurations.reaper
92+
}
8593
}
8694

8795
javadoc {
@@ -119,6 +127,7 @@ dependencies {
119127
testCompile "junit:junit:${props.getProperty('junit')}"
120128
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
121129
testCompile 'com.github.tomakehurst:wiremock-jre8-standalone:2.23.2'
130+
reaper project('reaper')
122131
minimumRuntimeCompile "junit:junit:${props.getProperty('junit')}"
123132
minimumRuntimeCompile localGroovy()
124133
minimumRuntimeCompile gradleApi()

buildSrc/reaper/build.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apply plugin: 'java'
2+
3+
jar {
4+
manifest {
5+
attributes 'Main-Class': 'org.elasticsearch.gradle.reaper.Reaper'
6+
}
7+
}

0 commit comments

Comments
 (0)