Skip to content

Commit

Permalink
Allow update sites to define a custom URL for wizard plugin suggestion (
Browse files Browse the repository at this point in the history
#8951)

* currently suggested plugins list as setup time is hardcoded, we can make it configurable

Signed-off-by: Olivier Lamy <olamy@apache.org>

* add new method to UpdateSite to avoid using System property

Signed-off-by: Olivier Lamy <olamy@apache.org>

* Update core/src/main/java/hudson/model/UpdateSite.java

Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>

---------

Signed-off-by: Olivier Lamy <olamy@apache.org>
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
  • Loading branch information
3 people committed Feb 18, 2024
1 parent 2bd2ce2 commit 824f64c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 11 additions & 0 deletions core/src/main/java/hudson/model/UpdateSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,17 @@ public String getUrl() {
return url;
}

/**
*
* @return the URL used by {@link jenkins.install.SetupWizard} for suggested plugins to install at setup time
* @since TODO
*/
@Exported
public String getSuggestedPluginsUrl() {
String updateCenterJsonUrl = getUrl();
return updateCenterJsonUrl.replace("/update-center.json", "/platform-plugins.json");
}


/**
* URL which exposes the metadata location in a specific update site.
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/jenkins/install/SetupWizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,7 @@ public JSONArray getPlatformPluginUpdates() {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
JSONArray initialPluginList = null;
updateSiteList: for (UpdateSite updateSite : Jenkins.get().getUpdateCenter().getSiteList()) {
String updateCenterJsonUrl = updateSite.getUrl();
String suggestedPluginUrl = updateCenterJsonUrl.replace("/update-center.json", "/platform-plugins.json");
String suggestedPluginUrl = updateSite.getSuggestedPluginsUrl();
VersionNumber version = Jenkins.getVersion();
if (version != null && (suggestedPluginUrl.startsWith("https://") || suggestedPluginUrl.startsWith("http://"))) {
// Allow remote update site to distinguish based on the current version
Expand Down

0 comments on commit 824f64c

Please sign in to comment.