[Backport 7.x] Fix the OS sensing code in ClusterFormationTasks (#38457)
This fixes a bug in the sensing of the current OS family in the test cluster formation code. Previously all builds would assume every environment was windows and would jump to using the windows zip build. This fixes the OS sensing code as well as updates some tests to account for different build flavors. Backport of #38457
This commit is contained in:
parent
1897883adc
commit
e6a124c118
|
@ -20,6 +20,7 @@ package org.elasticsearch.gradle.doc
|
||||||
|
|
||||||
import org.elasticsearch.gradle.Version
|
import org.elasticsearch.gradle.Version
|
||||||
import org.elasticsearch.gradle.VersionProperties
|
import org.elasticsearch.gradle.VersionProperties
|
||||||
|
import org.elasticsearch.gradle.test.ClusterFormationTasks
|
||||||
import org.elasticsearch.gradle.test.RestTestPlugin
|
import org.elasticsearch.gradle.test.RestTestPlugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
|
@ -46,6 +47,7 @@ public class DocsTestPlugin extends RestTestPlugin {
|
||||||
'\\{version_qualified\\}': VersionProperties.elasticsearch,
|
'\\{version_qualified\\}': VersionProperties.elasticsearch,
|
||||||
'\\{lucene_version\\}' : VersionProperties.lucene.replaceAll('-snapshot-\\w+$', ''),
|
'\\{lucene_version\\}' : VersionProperties.lucene.replaceAll('-snapshot-\\w+$', ''),
|
||||||
'\\{build_flavor\\}' : project.integTestCluster.distribution,
|
'\\{build_flavor\\}' : project.integTestCluster.distribution,
|
||||||
|
'\\{build_type\\}' : ClusterFormationTasks.getOs().equals("windows") ? "zip" : "tar",
|
||||||
]
|
]
|
||||||
Task listSnippets = project.tasks.create('listSnippets', SnippetsTask)
|
Task listSnippets = project.tasks.create('listSnippets', SnippetsTask)
|
||||||
listSnippets.group 'Docs'
|
listSnippets.group 'Docs'
|
||||||
|
|
|
@ -274,7 +274,7 @@ class ClusterFormationTasks {
|
||||||
}
|
}
|
||||||
setup = configureCheckPreviousTask(taskName(prefix, node, 'checkPrevious'), project, setup, node)
|
setup = configureCheckPreviousTask(taskName(prefix, node, 'checkPrevious'), project, setup, node)
|
||||||
setup = configureStopTask(taskName(prefix, node, 'stopPrevious'), project, setup, node)
|
setup = configureStopTask(taskName(prefix, node, 'stopPrevious'), project, setup, node)
|
||||||
setup = configureExtractTask(taskName(prefix, node, 'extract'), project, setup, node, distribution)
|
setup = configureExtractTask(taskName(prefix, node, 'extract'), project, setup, node, distribution, config.distribution)
|
||||||
setup = configureWriteConfigTask(taskName(prefix, node, 'configure'), project, setup, node, writeConfig)
|
setup = configureWriteConfigTask(taskName(prefix, node, 'configure'), project, setup, node, writeConfig)
|
||||||
setup = configureCreateKeystoreTask(taskName(prefix, node, 'createKeystore'), project, setup, node)
|
setup = configureCreateKeystoreTask(taskName(prefix, node, 'createKeystore'), project, setup, node)
|
||||||
setup = configureAddKeystoreSettingTasks(prefix, project, setup, node)
|
setup = configureAddKeystoreSettingTasks(prefix, project, setup, node)
|
||||||
|
@ -343,14 +343,15 @@ class ClusterFormationTasks {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a task to extract the elasticsearch distribution */
|
/** Adds a task to extract the elasticsearch distribution */
|
||||||
static Task configureExtractTask(String name, Project project, Task setup, NodeInfo node, Configuration configuration) {
|
static Task configureExtractTask(String name, Project project, Task setup, NodeInfo node,
|
||||||
|
Configuration configuration, String distribution) {
|
||||||
List extractDependsOn = [configuration, setup]
|
List extractDependsOn = [configuration, setup]
|
||||||
/* configuration.singleFile will be an external artifact if this is being run by a plugin not living in the
|
/* configuration.singleFile will be an external artifact if this is being run by a plugin not living in the
|
||||||
elasticsearch source tree. If this is a plugin built in the elasticsearch source tree or this is a distro in
|
elasticsearch source tree. If this is a plugin built in the elasticsearch source tree or this is a distro in
|
||||||
the elasticsearch source tree then this should be the version of elasticsearch built by the source tree.
|
the elasticsearch source tree then this should be the version of elasticsearch built by the source tree.
|
||||||
If it isn't then Bad Things(TM) will happen. */
|
If it isn't then Bad Things(TM) will happen. */
|
||||||
Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) {
|
Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) {
|
||||||
if (getOs().equals("windows")) {
|
if (getOs().equals("windows") || distribution.equals("integ-test-zip") || node.nodeVersion.before("7.0.0")) {
|
||||||
from {
|
from {
|
||||||
project.zipTree(configuration.singleFile)
|
project.zipTree(configuration.singleFile)
|
||||||
}
|
}
|
||||||
|
@ -971,9 +972,9 @@ class ClusterFormationTasks {
|
||||||
/** Find the current OS */
|
/** Find the current OS */
|
||||||
static String getOs() {
|
static String getOs() {
|
||||||
String os = "linux"
|
String os = "linux"
|
||||||
if (Os.FAMILY_WINDOWS) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
os = "windows"
|
os = "windows"
|
||||||
} else if (Os.FAMILY_MAC) {
|
} else if (Os.isFamily(Os.FAMILY_MAC)) {
|
||||||
os = "darwin"
|
os = "darwin"
|
||||||
}
|
}
|
||||||
return os
|
return os
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
:jdk: 1.8.0_131
|
:jdk: 1.8.0_131
|
||||||
:jdk_major: 8
|
:jdk_major: 8
|
||||||
:build_flavor: default
|
:build_flavor: default
|
||||||
|
:build_type: tar
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
release-state can be: released | prerelease | unreleased
|
release-state can be: released | prerelease | unreleased
|
||||||
|
|
|
@ -374,7 +374,7 @@ This command should give you a JSON result:
|
||||||
"version" : {
|
"version" : {
|
||||||
"number" : "{version_qualified}",
|
"number" : "{version_qualified}",
|
||||||
"build_flavor" : "{build_flavor}",
|
"build_flavor" : "{build_flavor}",
|
||||||
"build_type" : "zip",
|
"build_type" : "{build_type}",
|
||||||
"build_hash" : "f27399d",
|
"build_hash" : "f27399d",
|
||||||
"build_date" : "2016-03-30T09:51:41.449Z",
|
"build_date" : "2016-03-30T09:51:41.449Z",
|
||||||
"build_snapshot" : false,
|
"build_snapshot" : false,
|
||||||
|
|
|
@ -143,7 +143,7 @@ The result will look similar to:
|
||||||
"ip": "192.168.17",
|
"ip": "192.168.17",
|
||||||
"version": "{version}",
|
"version": "{version}",
|
||||||
"build_flavor": "{build_flavor}",
|
"build_flavor": "{build_flavor}",
|
||||||
"build_type": "zip",
|
"build_type": "{build_type}",
|
||||||
"build_hash": "587409e",
|
"build_hash": "587409e",
|
||||||
"roles": [
|
"roles": [
|
||||||
"master",
|
"master",
|
||||||
|
@ -224,7 +224,7 @@ The result will look similar to:
|
||||||
"ip": "192.168.17",
|
"ip": "192.168.17",
|
||||||
"version": "{version}",
|
"version": "{version}",
|
||||||
"build_flavor": "{build_flavor}",
|
"build_flavor": "{build_flavor}",
|
||||||
"build_type": "zip",
|
"build_type": "{build_type}",
|
||||||
"build_hash": "587409e",
|
"build_hash": "587409e",
|
||||||
"roles": [],
|
"roles": [],
|
||||||
"attributes": {},
|
"attributes": {},
|
||||||
|
|
|
@ -20,7 +20,7 @@ which should give you a response something like this:
|
||||||
"version" : {
|
"version" : {
|
||||||
"number" : "{version_qualified}",
|
"number" : "{version_qualified}",
|
||||||
"build_flavor" : "{build_flavor}",
|
"build_flavor" : "{build_flavor}",
|
||||||
"build_type" : "zip",
|
"build_type" : "{build_type}",
|
||||||
"build_hash" : "f27399d",
|
"build_hash" : "f27399d",
|
||||||
"build_date" : "2016-03-30T09:51:41.449Z",
|
"build_date" : "2016-03-30T09:51:41.449Z",
|
||||||
"build_snapshot" : false,
|
"build_snapshot" : false,
|
||||||
|
|
Loading…
Reference in New Issue