Skip to content

Commit

Permalink
Fixes jenkinsci#316: When resolving dependencies using manifest, do n…
Browse files Browse the repository at this point in the history
…ot fail if an optional plugin cannot be retrieved
  • Loading branch information
PierreBtz committed Apr 6, 2021
1 parent 28b405f commit ba3fda0
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -906,12 +906,19 @@ public List<Plugin> resolveDependenciesFromManifest(Plugin plugin) {
String pluginName = pluginInfo[0];
String pluginVersion = pluginInfo[1];
Plugin dependentPlugin = new Plugin(pluginName, pluginVersion, null, null);
dependentPlugin.setOptional(dependency.contains("resolution:=optional"));

if (useLatestSpecified && plugin.isLatest() || useLatestAll) {
VersionNumber latestPluginVersion = getLatestPluginVersion(plugin, pluginName);
dependentPlugin.setVersion(latestPluginVersion);
dependentPlugin.setLatest(true);
try {
VersionNumber latestPluginVersion = getLatestPluginVersion(plugin, pluginName);
dependentPlugin.setVersion(latestPluginVersion);
dependentPlugin.setLatest(true);
} catch(PluginNotFoundException e) {
if (! dependentPlugin.getOptional()) {
throw e;
}
}
}
dependentPlugin.setOptional(dependency.contains("resolution:=optional"));

dependentPlugins.add(dependentPlugin);
dependentPlugin.setParent(plugin);
Expand Down

0 comments on commit ba3fda0

Please sign in to comment.