Skip to content

Commit

Permalink
Optional plugins missing from update center should not fail installat…
Browse files Browse the repository at this point in the history
…ion (#296)

Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
  • Loading branch information
yabberyabber and timja authored Mar 3, 2021
1 parent c72ad4a commit d8d77f9
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -912,16 +912,26 @@ public List<Plugin> resolveDependenciesFromJson(Plugin plugin, JSONObject plugin
String pluginName = dependency.getString("name");
String pluginVersion = dependency.getString("version");
Plugin dependentPlugin = new Plugin(pluginName, pluginVersion, null, null);
if (useLatestSpecified && plugin.isLatest() || useLatestAll) {
VersionNumber latestPluginVersion = getLatestPluginVersion(pluginName);
dependentPlugin.setVersion(latestPluginVersion);
dependentPlugin.setLatest(true);
}
dependentPlugin.setOptional(dependency.getBoolean("optional"));

dependentPlugins.add(dependentPlugin);
dependentPlugin.setParent(plugin);
}

try {
if (useLatestSpecified && plugin.isLatest() || useLatestAll) {
VersionNumber latestPluginVersion = getLatestPluginVersion(pluginName);
dependentPlugin.setVersion(latestPluginVersion);
dependentPlugin.setLatest(true);
}
dependentPlugins.add(dependentPlugin);
} catch (PluginNotFoundException e) {
if (!dependentPlugin.getOptional()) {
throw e;
}
logVerbose(String.format(
"Unable to find optional plugin %s in update center %s. " +
"Ignoring until it becomes required.",
pluginName, jenkinsUcLatest));
}
}

logVerbose(dependentPlugins.isEmpty() ? String.format("%n%s has no dependencies", plugin.getName()) :
String.format("%n%s depends on: %n", plugin.getName()) +
Expand Down

0 comments on commit d8d77f9

Please sign in to comment.