Skip to content

Commit d99d0fa

Browse files
jasontedorrjernst
authored andcommitted
Add distribution type to startup scripts
This commit adds the distribution type to the startup scripts so that we can discern from log output and the main response the type of the distribution (deb/rpm/tar/zip).
1 parent c7f6b35 commit d99d0fa

Some content is hidden

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

43 files changed

+180
-36
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public void testInfo() throws IOException {
4242
// only check node name existence, might be a different one from what was hit by low level client in multi-node cluster
4343
assertNotNull(info.getNodeName());
4444
Map<String, Object> versionMap = (Map<String, Object>) infoAsMap.get("version");
45+
assertEquals(versionMap.get("build_flavor"), info.getBuild().flavor().displayName());
46+
assertEquals(versionMap.get("build_type"), info.getBuild().type().displayName());
4547
assertEquals(versionMap.get("build_hash"), info.getBuild().shortHash());
4648
assertEquals(versionMap.get("build_date"), info.getBuild().date());
4749
assertEquals(versionMap.get("build_snapshot"), info.getBuild().isSnapshot());

distribution/archives/build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ task createPluginsDir(type: EmptyDirTask) {
4242
dirMode 0755
4343
}
4444

45-
CopySpec archiveFiles(CopySpec modulesFiles, boolean oss) {
45+
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, boolean oss) {
4646
return copySpec {
4747
into("elasticsearch-${version}") {
4848
with libFiles
4949
into('config') {
5050
dirMode 0750
5151
fileMode 0660
52-
with configFiles('def', oss)
52+
with configFiles(distributionType, oss)
5353
}
5454
into('bin') {
55-
with binFiles('def', oss)
55+
with binFiles(distributionType, oss)
5656
with copySpec {
5757
from('../src/bin') {
5858
include '*.bat'
5959
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
6060
}
61-
MavenFilteringHack.filter(it, expansionsForDistribution('def', oss))
61+
MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss))
6262
}
6363
}
6464
into('') {
@@ -101,15 +101,15 @@ tasks.withType(AbstractArchiveTask) {
101101
}
102102

103103
task buildIntegTestZip(type: Zip) {
104-
with archiveFiles(transportModulesFiles, false)
104+
with archiveFiles(transportModulesFiles, 'zip', false)
105105
}
106106

107107
task buildZip(type: Zip) {
108-
with archiveFiles(modulesFiles(false), false)
108+
with archiveFiles(modulesFiles(false), 'zip', false)
109109
}
110110

111111
task buildOssZip(type: Zip) {
112-
with archiveFiles(modulesFiles(true), true)
112+
with archiveFiles(modulesFiles(true), 'zip', true)
113113
}
114114

115115
Closure commonTarConfig = {
@@ -121,12 +121,12 @@ Closure commonTarConfig = {
121121

122122
task buildTar(type: Tar) {
123123
configure(commonTarConfig)
124-
with archiveFiles(modulesFiles(false), false)
124+
with archiveFiles(modulesFiles(false), 'tar', false)
125125
}
126126

127127
task buildOssTar(type: Tar) {
128128
configure(commonTarConfig)
129-
with archiveFiles(modulesFiles(true), true)
129+
with archiveFiles(modulesFiles(true), 'tar', true)
130130
}
131131

132132
// This configures the default artifact for the distribution specific

distribution/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,14 @@ subprojects {
434434
'def': oss ? 'oss' : 'default'
435435
],
436436

437+
438+
'es.distribution.type': [
439+
'deb': 'deb',
440+
'rpm': 'rpm',
441+
'tar': 'tar',
442+
'zip': 'zip'
443+
],
444+
437445
'license.name': [
438446
'deb': oss ? 'ASL-2.0' : 'Elastic-License'
439447
],

distribution/src/bin/elasticsearch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null;
2929
-Des.path.home="$ES_HOME" \
3030
-Des.path.conf="$ES_PATH_CONF" \
3131
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
32+
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
3233
-cp "$ES_CLASSPATH" \
3334
org.elasticsearch.bootstrap.Elasticsearch \
3435
"$@"
@@ -39,6 +40,7 @@ else
3940
-Des.path.home="$ES_HOME" \
4041
-Des.path.conf="$ES_PATH_CONF" \
4142
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
43+
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
4244
-cp "$ES_CLASSPATH" \
4345
org.elasticsearch.bootstrap.Elasticsearch \
4446
"$@" \

distribution/src/bin/elasticsearch-env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fi
7878
ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`
7979

8080
ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
81+
ES_DISTRIBUTION_TYPE=${es.distribution.type}
8182

8283
if [ -z "$ES_TMPDIR" ]; then
8384
set +e

distribution/src/bin/elasticsearch-env.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ rem now make ES_PATH_CONF absolute
5454
for %%I in ("%ES_PATH_CONF%..") do set ES_PATH_CONF=%%~dpfI
5555

5656
set ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
57+
set ES_DISTRIBUTION_TYPE=${es.distribution.type}
5758

5859
if not defined ES_TMPDIR (
5960
set ES_TMPDIR=!TMP!\elasticsearch

distribution/src/bin/elasticsearch-keystore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ exec \
88
-Des.path.home="$ES_HOME" \
99
-Des.path.conf="$ES_PATH_CONF" \
1010
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
11+
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
1112
-cp "$ES_CLASSPATH" \
1213
org.elasticsearch.common.settings.KeyStoreCli \
1314
"$@"

distribution/src/bin/elasticsearch-keystore.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
1010
-Des.path.home="%ES_HOME%" ^
1111
-Des.path.conf="%ES_PATH_CONF%" ^
1212
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
13+
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
1314
-cp "%ES_CLASSPATH%" ^
1415
org.elasticsearch.common.settings.KeyStoreCli ^
1516
%*

distribution/src/bin/elasticsearch-plugin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ exec \
88
-Des.path.home="$ES_HOME" \
99
-Des.path.conf="$ES_PATH_CONF" \
1010
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
11+
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
1112
-cp "$ES_CLASSPATH" \
1213
org.elasticsearch.plugins.PluginCli \
1314
"$@"

distribution/src/bin/elasticsearch-plugin.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1
1010
-Des.path.home="%ES_HOME%" ^
1111
-Des.path.conf="%ES_PATH_CONF%" ^
1212
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
13+
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
1314
-cp "%ES_CLASSPATH%" ^
1415
org.elasticsearch.plugins.PluginCli ^
1516
%*

0 commit comments

Comments
 (0)