Merge pull request #18581 from rjernst/staging_plugins

Plugins: Changing staging property to be the hash instead of a boolean
This commit is contained in:
Ryan Ernst 2016-05-25 15:07:46 -07:00
commit 4a52dc9a8c
2 changed files with 5 additions and 7 deletions

View File

@ -39,7 +39,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -52,7 +51,6 @@ import java.util.zip.ZipInputStream;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import joptsimple.OptionSpec; import joptsimple.OptionSpec;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.elasticsearch.Build;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.bootstrap.JarHell; import org.elasticsearch.bootstrap.JarHell;
import org.elasticsearch.cli.ExitCodes; import org.elasticsearch.cli.ExitCodes;
@ -65,7 +63,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.node.internal.InternalSettingsPreparer; import org.elasticsearch.node.internal.InternalSettingsPreparer;
import static java.util.Collections.unmodifiableSet;
import static org.elasticsearch.cli.Terminal.Verbosity.VERBOSE; import static org.elasticsearch.cli.Terminal.Verbosity.VERBOSE;
/** /**
@ -100,7 +97,7 @@ import static org.elasticsearch.cli.Terminal.Verbosity.VERBOSE;
*/ */
class InstallPluginCommand extends SettingCommand { class InstallPluginCommand extends SettingCommand {
private static final String PROPERTY_SUPPORT_STAGING_URLS = "es.plugins.staging"; private static final String PROPERTY_STAGING_ID = "es.plugins.staging";
/** The builtin modules, which are plugins, but cannot be installed or removed. */ /** The builtin modules, which are plugins, but cannot be installed or removed. */
static final Set<String> MODULES; static final Set<String> MODULES;
@ -211,12 +208,13 @@ class InstallPluginCommand extends SettingCommand {
if (OFFICIAL_PLUGINS.contains(pluginId)) { if (OFFICIAL_PLUGINS.contains(pluginId)) {
final String version = Version.CURRENT.toString(); final String version = Version.CURRENT.toString();
final String url; final String url;
if (System.getProperty(PROPERTY_SUPPORT_STAGING_URLS, "false").equals("true")) { final String stagingHash = System.getProperty(PROPERTY_STAGING_ID);
if (stagingHash != null) {
url = String.format( url = String.format(
Locale.ROOT, Locale.ROOT,
"https://download.elastic.co/elasticsearch/staging/%1$s-%2$s/org/elasticsearch/plugin/%3$s/%1$s/%3$s-%1$s.zip", "https://download.elastic.co/elasticsearch/staging/%1$s-%2$s/org/elasticsearch/plugin/%3$s/%1$s/%3$s-%1$s.zip",
version, version,
Build.CURRENT.shortHash(), stagingHash,
pluginId); pluginId);
} else { } else {
url = String.format( url = String.format(

View File

@ -191,7 +191,7 @@ def smoke_test_release(release, files, expected_hash, plugins):
plugin_names = {} plugin_names = {}
for plugin in plugins: for plugin in plugins:
print(' Install plugin [%s]' % (plugin)) print(' Install plugin [%s]' % (plugin))
run('%s; export ES_JAVA_OPTS="-Des.plugins.staging=true"; %s %s %s' % (java_exe(), es_plugin_path, 'install -b', plugin)) run('%s; export ES_JAVA_OPTS="-Des.plugins.staging=%s"; %s %s %s' % (java_exe(), expected_hash, es_plugin_path, 'install -b', plugin))
plugin_names[plugin] = True plugin_names[plugin] = True
if 'x-pack' in plugin_names: if 'x-pack' in plugin_names:
headers = { 'Authorization' : 'Basic %s' % base64.b64encode(b"es_admin:foobar").decode("UTF-8") } headers = { 'Authorization' : 'Basic %s' % base64.b64encode(b"es_admin:foobar").decode("UTF-8") }