Skip to content

Remove flavor from build #85796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.http.HttpEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Build;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.action.ActionListener;
Expand Down Expand Up @@ -2591,17 +2590,6 @@ private Optional<String> getVersionValidation(Response response) throws IOExcept
return Optional.of("Invalid or missing tagline [" + mainResponse.getTagline() + "]");
}

if (major == 7) {
// >= 7.0 and < 7.14
String responseFlavor = mainResponse.getVersion().getBuildFlavor();
if ("default".equals(responseFlavor) == false) {
// Flavor is unknown when running tests, and non-mocked responses will return an unknown flavor
if (Build.CURRENT.flavor() != Build.Flavor.UNKNOWN || "unknown".equals(responseFlavor) == false) {
return Optional.of("Invalid or missing build flavor [" + responseFlavor + "]");
}
}
}

return Optional.empty();
}

Expand Down
4 changes: 0 additions & 4 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,6 @@ subprojects {
'def': footer
],

'es.distribution.flavor': [
'def': 'default'
],

'es.distribution.type': [
'deb': 'deb',
'rpm': 'rpm',
Expand Down
2 changes: 0 additions & 2 deletions distribution/src/bin/elasticsearch
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ if [[ $DAEMONIZE = false ]]; then
$ES_JAVA_OPTS \
-Des.path.home="$ES_HOME" \
-Des.path.conf="$ES_PATH_CONF" \
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
-cp "$ES_CLASSPATH" \
org.elasticsearch.bootstrap.Elasticsearch \
Expand All @@ -125,7 +124,6 @@ else
$ES_JAVA_OPTS \
-Des.path.home="$ES_HOME" \
-Des.path.conf="$ES_PATH_CONF" \
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
-cp "$ES_CLASSPATH" \
org.elasticsearch.bootstrap.Elasticsearch \
Expand Down
1 change: 0 additions & 1 deletion distribution/src/bin/elasticsearch-cli
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ exec \
$ES_JAVA_OPTS \
-Des.path.home="$ES_HOME" \
-Des.path.conf="$ES_PATH_CONF" \
-Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
-cp "$ES_CLASSPATH" \
"$ES_MAIN_CLASS" \
Expand Down
1 change: 0 additions & 1 deletion distribution/src/bin/elasticsearch-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ set ES_JAVA_OPTS=-Xms4m -Xmx64m -XX:+UseSerialGC %ES_JAVA_OPTS%
%ES_JAVA_OPTS% ^
-Des.path.home="%ES_HOME%" ^
-Des.path.conf="%ES_PATH_CONF%" ^
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
-cp "%ES_CLASSPATH%" ^
"%ES_MAIN_CLASS%" ^
Expand Down
1 change: 0 additions & 1 deletion distribution/src/bin/elasticsearch-env
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ fi
# now make ES_PATH_CONF absolute
ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`

ES_DISTRIBUTION_FLAVOR=@es.distribution.flavor@
ES_DISTRIBUTION_TYPE=@es.distribution.type@

if [[ "$ES_DISTRIBUTION_TYPE" == "docker" ]]; then
Expand Down
1 change: 0 additions & 1 deletion distribution/src/bin/elasticsearch-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if not defined ES_PATH_CONF (
rem now make ES_PATH_CONF absolute
for %%I in ("%ES_PATH_CONF%..") do set ES_PATH_CONF=%%~dpfI

set ES_DISTRIBUTION_FLAVOR=@es.distribution.flavor@
set ES_DISTRIBUTION_TYPE=@es.distribution.type@

cd /d "%ES_HOME%"
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/elasticsearch-service.bat
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ if "%JVM_SS%" == "" (
set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:"=%
set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:~1%

set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%"
set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%"

if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0
Expand Down
3 changes: 0 additions & 3 deletions distribution/src/bin/elasticsearch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ IF "%attemptautoconfig%"=="Y" (
ECHO.!KEYSTORE_PASSWORD!| %JAVA% %ES_JAVA_OPTS% ^
-Des.path.home="%ES_HOME%" ^
-Des.path.conf="%ES_PATH_CONF%" ^
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
-cp "!ES_CLASSPATH!;!ES_HOME!/lib/tools/security-cli/*;!ES_HOME!/modules/x-pack-core/*;!ES_HOME!/modules/x-pack-security/*" "org.elasticsearch.xpack.security.cli.AutoConfigureNode" !newparams!
SET SHOULDEXIT=Y
Expand All @@ -122,7 +121,6 @@ IF "!enrolltocluster!"=="Y" (
ECHO.!KEYSTORE_PASSWORD!| %JAVA% %ES_JAVA_OPTS% ^
-Des.path.home="%ES_HOME%" ^
-Des.path.conf="%ES_PATH_CONF%" ^
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
-cp "!ES_CLASSPATH!;!ES_HOME!/lib/tools/security-cli/*;!ES_HOME!/modules/x-pack-core/*;!ES_HOME!/modules/x-pack-security/*" "org.elasticsearch.xpack.security.cli.AutoConfigureNode" ^
!newparams! --enrollment-token %enrollmenttoken%
Expand Down Expand Up @@ -154,7 +152,6 @@ if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (

ECHO.!KEYSTORE_PASSWORD!| %JAVA% %ES_JAVA_OPTS% -Delasticsearch ^
-Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" ^
-Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
-cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void execute(List<PluginDescriptor> plugins) throws Exception {
terminal.println(logPrefix + "Installing " + pluginId);
try {
if ("x-pack".equals(pluginId)) {
handleInstallXPack(buildFlavor());
throw new UserException(ExitCodes.CONFIG, "this distribution of Elasticsearch contains X-Pack by default");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need to handle this anymore at this point. The "x-pack" plugin hasn't been a thing for many versions. I assume this was only added to ease migration after x-pack was folded into ES.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a fair point, but I would like to think about that separately. We certainly might get users who have used ES before trying to install x-pack, though at some point we should definitely remove this.

}

if (PLUGINS_CONVERTED_TO_MODULES.contains(pluginId)) {
Expand Down Expand Up @@ -276,21 +276,6 @@ public void execute(List<PluginDescriptor> plugins) throws Exception {
}
}

Build.Flavor buildFlavor() {
return Build.CURRENT.flavor();
}

private static void handleInstallXPack(final Build.Flavor flavor) throws UserException {
switch (flavor) {
case DEFAULT -> throw new UserException(ExitCodes.CONFIG, "this distribution of Elasticsearch contains X-Pack by default");
case OSS -> throw new UserException(
ExitCodes.CONFIG,
"X-Pack is not available with the oss distribution; to use X-Pack features use the default distribution"
);
case UNKNOWN -> throw new IllegalStateException("your distribution is broken");
}
}

/**
* Downloads the plugin and returns the file it was downloaded to.
*/
Expand Down Expand Up @@ -923,7 +908,6 @@ void jarHellCheck(PluginInfo candidateInfo, Path candidateDir, Path pluginsDir,
*/
private PluginInfo installPlugin(PluginDescriptor descriptor, Path tmpRoot, List<Path> deleteOnFailure) throws Exception {
final PluginInfo info = loadPluginInfo(tmpRoot);
checkCanInstallationProceed(terminal, Build.CURRENT.flavor(), info);
PluginPolicyInfo pluginPolicy = PolicyUtil.getPluginPolicyInfo(tmpRoot, env.tmpFile());
if (pluginPolicy != null) {
Set<String> permissions = PluginSecurity.getPermissionDescriptions(pluginPolicy, env.tmpFile());
Expand Down Expand Up @@ -1092,25 +1076,4 @@ private static void setFileAttributes(final Path path, final Set<PosixFilePermis
public void close() throws IOException {
IOUtils.rm(pathsToDeleteOnShutdown.toArray(new Path[0]));
}

public static void checkCanInstallationProceed(Terminal terminal, Build.Flavor flavor, PluginInfo info) throws Exception {
if (info.isLicensed() == false) {
return;
}

if (flavor == Build.Flavor.DEFAULT) {
return;
}

List.of(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
"@ ERROR: This is a licensed plugin @",
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
"",
"This plugin is covered by the Elastic license, but this",
"installation of Elasticsearch is: [" + flavor + "]."
).forEach(terminal::errorPrintln);

throw new UserException(ExitCodes.NOPERM, "Plugin license is incompatible with [" + flavor + "] installation");
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -818,27 +818,10 @@ public void testOfficialPluginsHelpSortedAndMissingObviouslyWrongPlugins() throw
}

public void testInstallXPack() throws IOException {
runInstallXPackTest(Build.Flavor.DEFAULT, UserException.class, "this distribution of Elasticsearch contains X-Pack by default");
runInstallXPackTest(
Build.Flavor.OSS,
UserException.class,
"X-Pack is not available with the oss distribution; to use X-Pack features use the default distribution"
);
runInstallXPackTest(Build.Flavor.UNKNOWN, IllegalStateException.class, "your distribution is broken");
}

private <T extends Exception> void runInstallXPackTest(final Build.Flavor flavor, final Class<T> clazz, final String expectedMessage)
throws IOException {

final Environment environment = createEnv(temp).v2();
final InstallPluginAction flavorAction = new InstallPluginAction(terminal, environment, false) {
@Override
Build.Flavor buildFlavor() {
return flavor;
}
};
final T exception = expectThrows(clazz, () -> flavorAction.execute(List.of(new PluginDescriptor("x-pack"))));
assertThat(exception.getMessage(), containsString(expectedMessage));
final InstallPluginAction installAction = new InstallPluginAction(terminal, environment, false);
var e = expectThrows(UserException.class, () -> installAction.execute(List.of(new PluginDescriptor("x-pack"))));
assertThat(e.getMessage(), containsString("this distribution of Elasticsearch contains X-Pack by default"));
}

public void testInstallMisspelledOfficialPlugins() {
Expand Down
1 change: 0 additions & 1 deletion docs/Versions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include::{docs-root}/shared/versions/stack/{source_branch}.asciidoc[]
:lucene_version_path: 9_1_0
:jdk: 11.0.2
:jdk_major: 11
:build_flavor: default
:build_type: tar

:docker-repo: docker.elastic.co/elasticsearch/elasticsearch
Expand Down
1 change: 0 additions & 1 deletion docs/plugins/discovery-azure-classic.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ This command should give you a JSON result:
"cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
"version" : {
"number" : "{version_qualified}",
"build_flavor" : "{build_flavor}",
"build_type" : "{build_type}",
"build_hash" : "f27399d",
"build_date" : "2016-03-30T09:51:41.449Z",
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cluster/nodes-info.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ The API returns the following response:
"host": "node-0.elastic.co",
"ip": "192.168.17",
"version": "{version}",
"build_flavor": "{build_flavor}",
"build_flavor": "default",
"build_type": "{build_type}",
"build_hash": "587409e",
"roles": [
Expand Down Expand Up @@ -299,7 +299,7 @@ The API returns the following response:
"host": "node-0.elastic.co",
"ip": "192.168.17",
"version": "{version}",
"build_flavor": "{build_flavor}",
"build_flavor": "default",
"build_type": "{build_type}",
"build_hash": "587409e",
"roles": [],
Expand Down
3 changes: 1 addition & 2 deletions docs/reference/cluster/stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,7 @@ Contains statistics about {es} distributions installed on selected nodes.
=====
`flavor`:::
(string)
Type of {es} distribution, such as `default` or `OSS`, used by one or more
selected nodes.
Type of {es} distribution. This is always `default`.

`type`:::
(string)
Expand Down
1 change: 0 additions & 1 deletion docs/reference/setup/install/check-running.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ GET /
"cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
"version" : {
"number" : "{version_qualified}",
"build_flavor" : "{build_flavor}",
"build_type" : "{build_type}",
"build_hash" : "f27399d",
"build_date" : "2016-03-30T09:51:41.449Z",
Expand Down
Loading