Fix: Install plugins when they have no plugin archive info(catalog en… (#109200)

* fix: install plugins when they have URL is set

* test:INSTALL_PLUGINS private plugin with version
This commit is contained in:
Syerikjan Kh
2025-08-06 09:02:59 -04:00
committed by GitHub
parent 4e1333236c
commit abdb1c70ec
3 changed files with 24 additions and 2 deletions
@@ -101,7 +101,12 @@ func (s *Service) installPluginsWithTimeout(pluginsToInstall []setting.InstallPl
}
}
func (s *Service) shouldUpdate(ctx context.Context, pluginID, currentVersion string) bool {
func (s *Service) shouldUpdate(ctx context.Context, pluginID, currentVersion string, pluginURL string) bool {
// If the plugin is installed from a URL, we cannot check for updates as we do not have the version information
// from the repository. Therefore, we assume that the plugin should be updated if the URL is provided.
if pluginURL != "" {
return true
}
info, err := s.pluginRepo.GetPluginArchiveInfo(ctx, pluginID, "", repo.NewCompatOpts(s.cfg.BuildVersion, runtime.GOOS, runtime.GOARCH))
if err != nil {
s.log.Error("Failed to get plugin info", "pluginId", pluginID, "error", err)
@@ -128,7 +133,7 @@ func (s *Service) installPlugins(ctx context.Context, pluginsToInstall []setting
}
// The plugin is installed but it's not pinned to a specific version
// Check if there is a newer version available
if !s.shouldUpdate(ctx, installPlugin.ID, p.Info.Version) {
if !s.shouldUpdate(ctx, installPlugin.ID, p.Info.Version, installPlugin.URL) {
continue
}
}