-
Notifications
You must be signed in to change notification settings - Fork 31
/
build.gradle
133 lines (115 loc) · 4.73 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.test.RestIntegTestTask
version = '6.2.2'
buildscript {
repositories {
jcenter()
maven {
url "https://artifacts.elastic.co/maven"
}
}
dependencies {
classpath "org.elasticsearch.gradle:build-tools:6.2.2"
}
}
apply plugin: 'elasticsearch.build'
apply plugin: 'idea'
apply plugin: 'eclipse'
repositories {
jcenter()
maven {
url "https://artifacts.elastic.co/maven"
}
}
ext.projectSubstitutions = [:]
project.licenseFile = project.rootProject.file("LICENSE.txt")
project.noticeFile = project.rootProject.file("NOTICE.txt")
configurations {
all*.exclude group: 'org.elasticsearch.plugin', module:'tribe'
}
dependencies {
compileOnly "org.elasticsearch:elasticsearch:${version}"
compileOnly "org.elasticsearch.plugin:x-pack-api:${version}"
compileOnly "org.elasticsearch:jna:4.5.1"
testCompile "org.elasticsearch.test:framework:${version}"
testCompile "org.elasticsearch.client:x-pack-transport:${version}"
testCompile "org.apache.lucene:lucene-test-framework:${versions.lucene}"
testCompile "org.apache.logging.log4j:log4j-api:${versions.log4j}"
testCompile "org.apache.logging.log4j:log4j-core:${versions.log4j}"
testRuntime "org.elasticsearch.plugin:x-pack:${version}@zip"
}
Map generateSubstitutions() {
def stringSnap = { version ->
if (version.endsWith("-SNAPSHOT")) {
return version.substring(0, version.length() - 9)
}
return version
}
return [
'version': stringSnap(version),
'xpack.version': stringSnap(VersionProperties.elasticsearch),
'java.version': targetCompatibility as String
]
}
processResources {
MavenFilteringHack.filter(it, generateSubstitutions())
}
task buildZip(type:Zip, dependsOn: [jar]) {
from 'build/resources/main/x-pack-extension-descriptor.properties'
from project.jar
}
RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class) {
runner.systemProperty 'tests.security.manager', 'false'
}
integTest.mustRunAfter(project.precommit, project.test)
project.check.dependsOn(integTest)
integTestCluster {
dependsOn buildZip
setting "xpack.monitoring.enabled", "false" // monitoring depends on painless which is not available to us
setting "xpack.ml.enabled", "false" // ml has named writeables and the check for cluster state consistency doesn't know about them
setting "xpack.security.authc.realms.custom.order", "0"
setting "xpack.security.authc.realms.custom.type", "custom"
setting "xpack.security.authc.realms.custom.users.user1.password", "changeme"
setting "xpack.security.authc.realms.custom.users.user1.roles", "superuser"
setting "xpack.security.authc.realms.custom.users.user2.password", "changeme"
setting "xpack.security.authc.realms.custom.users.user2.roles", "superuser"
setting "xpack.security.authc.realms.custom.users.user3.password", "changeme"
setting "xpack.security.authc.realms.custom.users.user3.roles", "superuser"
setting "xpack.security.authc.realms.file.order", "1"
setting "xpack.security.authc.realms.file.type", "file"
setupCommand 'installXPackPlugin',
'bin/elasticsearch-plugin', 'install', configurations.testRuntime.filter { File file -> file.getName().equals ("x-pack-${version}.zip".toString()) }.getSingleFile().toURI().toString()
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser'
setupCommand 'installExtension',
'bin/x-pack/extension', 'install', 'file:' + buildZip.archivePath
waitCondition = { node, ant ->
File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://${node.httpUri()}",
dest: tmpFile.toString(),
username: 'test_user',
password: 'changeme',
ignoreerrors: true,
retries: 10)
return tmpFile.exists()
}
}