Preinstall: Replace auto update feature flag with a permanent one (#113586)

This commit is contained in:
Andres Martinez Gotor
2025-11-10 15:06:30 +01:00
committed by GitHub
parent 9a542489a7
commit 1a2beae38a
19 changed files with 74 additions and 77 deletions
@@ -12,7 +12,6 @@ import (
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/setting"
@@ -45,7 +44,6 @@ type Service struct {
pluginInstaller plugins.Installer
pluginStore pluginstore.Store
pluginRepo repo.Service
features featuremgmt.FeatureToggles
updateChecker pluginchecker.PluginUpdateChecker
installComplete chan struct{} // closed when all plugins are installed (used for testing)
}
@@ -56,7 +54,6 @@ func ProvideService(
pluginInstaller plugins.Installer,
promReg prometheus.Registerer,
pluginRepo repo.Service,
features featuremgmt.FeatureToggles,
updateChecker pluginchecker.PluginUpdateChecker,
) (*Service, error) {
once.Do(func() {
@@ -70,7 +67,6 @@ func ProvideService(
pluginInstaller: pluginInstaller,
pluginStore: pluginStore,
pluginRepo: pluginRepo,
features: features,
updateChecker: updateChecker,
installComplete: make(chan struct{}),
}
@@ -111,8 +107,8 @@ func (s *Service) installPlugins(ctx context.Context, pluginsToInstall []setting
continue
}
if installPlugin.Version == "" {
if !s.features.IsEnabled(ctx, featuremgmt.FlagPreinstallAutoUpdate) {
// Skip updating the plugin if the feature flag is disabled
if !s.cfg.PreinstallAutoUpdate {
// Skip updating the plugin if auto-update is disabled
continue
}
// The plugin is installed but it's not pinned to a specific version
@@ -9,7 +9,6 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/pluginfakes"
"github.com/grafana/grafana/pkg/plugins/manager/registry"
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/pluginsintegration/installsync/installsyncfakes"
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
@@ -31,7 +30,6 @@ func TestService_IsDisabled(t *testing.T) {
&pluginfakes.FakePluginInstaller{},
prometheus.NewRegistry(),
&pluginfakes.FakePluginRepo{},
featuremgmt.WithFeatures(),
&pluginchecker.FakePluginUpdateChecker{},
)
require.NoError(t, err)
@@ -167,6 +165,7 @@ func TestService_Run(t *testing.T) {
&setting.Cfg{
PreinstallPluginsAsync: tt.pluginsToInstall,
PreinstallPluginsSync: tt.pluginsToInstallSync,
PreinstallAutoUpdate: true,
},
store,
&pluginfakes.FakePluginInstaller{
@@ -199,7 +198,6 @@ func TestService_Run(t *testing.T) {
return tt.latestPlugin, nil
},
},
featuremgmt.WithFeatures(featuremgmt.FlagPreinstallAutoUpdate),
pluginchecker.ProvideService(
managedplugins.NewNoop(),
provisionedplugins.NewNoop(),