InitPlugins: Suggest to upgrade installed plugins per default
So we had again Gerrit outage for wrong default plugin installation option during gerrit upgrade from 2.10.4 to 2.10.7: [1]. The reason for that outage was wrong default option for plugin installation or upgrade in gerrit installer: Install plugin reviewnotes version v2.10.2-18-gc6c5e0b [y/N]? Gerrit administrator relies on the installer suggesting the right thing to do per default. And always confirms the default option suggested by Gerrit installer. In this specific case, the installer made it too easy to shoot the admin in the foot, because JGit version had API changes, by removing the function release() in favor of close(), and by not updating the plugin(s) installer left the Gerrit site in inherently broken state. Note, that Gerrit admin neither must necessarily know if libraries that are used by plugins had incompatible changes in Gerrit core or not, nor Gerrit admin is supposed to study the Git history of all related libraries before upgrading Gerrit site. It's always the right thing to do to upgrade the plugins. [1] http://paste.openstack.org/show/476639 Test plan: * The plugins suggested to be upgraded per default on site upgrade: Installing plugins. Install plugin replication version v2.11.4-29-gefa3c6a [Y/n]? version v2.11.4-29-gefa3c6a is already installed, overwrite it [Y/n]? Install plugin singleusergroup version v2.11.3-3-gf6df712 [Y/n]? version v2.11.3-3-gf6df712 is already installed, overwrite it [Y/n]? Install plugin download-commands version v2.11.3-11-g86eb557 [Y/n]? version v2.11.3-11-g86eb557 is already installed, overwrite it [Y/n]? Install plugin reviewnotes version v2.11.3-8-g26f38c4 [Y/n]? version v2.11.3-8-g26f38c4 is already installed, overwrite it [Y/n]? Install plugin commit-message-length-validator version v2.11-4-g8d295ed [Y/n]? version v2.11-4-g8d295ed is already installed, overwrite it [Y/n]? Change-Id: I5d7f83f050144fda9c084fff3f163c120c642077
This commit is contained in:
committed by
David Ostrovsky
parent
27542ceec5
commit
cf41710769
@@ -111,17 +111,18 @@ public class InitPlugins implements InitStep {
|
||||
String pluginName = plugin.name;
|
||||
try {
|
||||
final File tmpPlugin = plugin.pluginFile;
|
||||
File p = new File(site.plugins_dir, plugin.name + ".jar");
|
||||
boolean upgrade = p.exists();
|
||||
|
||||
if (!(initFlags.installPlugins.contains(pluginName) || ui.yesno(false,
|
||||
if (!(initFlags.installPlugins.contains(pluginName) || ui.yesno(upgrade,
|
||||
"Install plugin %s version %s", pluginName, plugin.version))) {
|
||||
tmpPlugin.delete();
|
||||
continue;
|
||||
}
|
||||
|
||||
final File p = new File(site.plugins_dir, plugin.name + ".jar");
|
||||
if (p.exists()) {
|
||||
if (upgrade) {
|
||||
final String installedPluginVersion = getVersion(p);
|
||||
if (!ui.yesno(false,
|
||||
if (!ui.yesno(upgrade,
|
||||
"version %s is already installed, overwrite it",
|
||||
installedPluginVersion)) {
|
||||
tmpPlugin.delete();
|
||||
|
||||
Reference in New Issue
Block a user