[JENKINS-57528] - Load detached plugins which are implicit deps of other plugins at startup even w/o UC (#4000)

* Do not warn repeatedly of the same missing update site dependency.
This happens when locally testing split plugins (despite their presence in WEB-INF/detached-plugins/*.hpi).

(cherry picked from commit 918a0fd221)

* Detached plugins must be kept up to date with security advisories.

(cherry picked from commit e08d28a698)

* Load detached plugins which are implicit dependencies of other plugins at startup, even if the update center was not used.

(cherry picked from commit ad7a36001d)

* Adjusted expected version after e08d28a698.

(cherry picked from commit 84f939cebd)

* e08d28a698 exposed tests which had been incorrectly storing plugins as *.hpi rather than *.jpi.

(cherry picked from commit a0abad7ec4)

* Test failure after ad7a36001d.

(cherry picked from commit 0084e8dbdd)

* Another test failure after ad7a36001d30a6174b25e616fc3c215dd24919d1; fewer installDetachedPlugin calls are now required.

(cherry picked from commit b65bb54e99)
This commit is contained in:
Jesse Glick authored and Oleg Nenashev committed 2019-05-17 16:22:22 +02:00
1 parent c7090f8d79
commit 855ea2eea2
16 files changed
+64 -18

No files matched your search

@@ -600,6 +600,25 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
}});
}
void considerDetachedPlugin(String shortName) {
if (new File(rootDir, shortName + ".jpi").isFile()) {
LOGGER.fine(() -> "not considering loading a detached dependency " + shortName + " as it is already on disk");
return;
}
LOGGER.fine(() -> "considering loading a detached dependency " + shortName);
for (String loadedFile : loadPluginsFromWar("/WEB-INF/detached-plugins", (dir, name) -> normalisePluginName(name).equals(shortName))) {
String loaded = normalisePluginName(loadedFile);
File arc = new File(rootDir, loaded + ".jpi");
LOGGER.info(() -> "Loading a detached plugin as a dependency: " + arc);
try {
plugins.add(strategy.createPluginWrapper(arc));
} catch (IOException e) {
failedPlugins.add(new FailedPlugin(arc.getName(), e));
}
}
}
protected @Nonnull Set<String> loadPluginsFromWar(@Nonnull String fromPath) {
return loadPluginsFromWar(fromPath, null);
}