Update package name

pull/104112/head
Hugo Oshiro 2 months ago
parent 1c0e2874d6
commit 12fe144bc9
  1. 10
      apps/advisor/pkg/app/checkregistry/checkregistry.go
  2. 8
      apps/advisor/pkg/app/checks/plugincheck/check.go
  3. 6
      apps/advisor/pkg/app/checks/plugincheck/check_test.go
  4. 6
      pkg/api/http_server.go
  5. 8
      pkg/api/plugins_test.go
  6. 2
      pkg/services/pluginsintegration/pluginchecker/checker.go
  7. 2
      pkg/services/pluginsintegration/pluginchecker/checker_test.go
  8. 2
      pkg/services/pluginsintegration/pluginchecker/fake.go
  9. 2
      pkg/services/pluginsintegration/pluginchecker/service.go
  10. 6
      pkg/services/pluginsintegration/plugininstaller/service.go
  11. 8
      pkg/services/pluginsintegration/plugininstaller/service_test.go
  12. 10
      pkg/services/pluginsintegration/pluginsintegration.go
  13. 6
      pkg/services/updatemanager/plugins.go
  14. 10
      pkg/services/updatemanager/plugins_test.go

@ -9,9 +9,9 @@ import (
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
"github.com/grafana/grafana/pkg/services/ssosettings"
)
@ -26,8 +26,8 @@ type Service struct {
pluginContextProvider *plugincontext.Provider
pluginClient plugins.Client
pluginRepo repo.Service
updateChecker pluginupdatechecker.PluginUpdateChecker
pluginPreinstall pluginupdatechecker.Preinstall
updateChecker pluginchecker.PluginUpdateChecker
pluginPreinstall pluginchecker.Preinstall
managedPlugins managedplugins.Manager
provisionedPlugins provisionedplugins.Manager
ssoSettingsSvc ssosettings.Service
@ -35,8 +35,8 @@ type Service struct {
func ProvideService(datasourceSvc datasources.DataSourceService, pluginStore pluginstore.Store,
pluginContextProvider *plugincontext.Provider, pluginClient plugins.Client,
updateChecker pluginupdatechecker.PluginUpdateChecker,
pluginRepo repo.Service, pluginPreinstall pluginupdatechecker.Preinstall, managedPlugins managedplugins.Manager,
updateChecker pluginchecker.PluginUpdateChecker,
pluginRepo repo.Service, pluginPreinstall pluginchecker.Preinstall, managedPlugins managedplugins.Manager,
provisionedPlugins provisionedplugins.Manager, ssoSettingsSvc ssosettings.Service,
) *Service {
return &Service{

@ -11,8 +11,8 @@ import (
"github.com/grafana/grafana/apps/advisor/pkg/app/checks"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
)
const (
@ -24,7 +24,7 @@ const (
func New(
pluginStore pluginstore.Store,
pluginRepo repo.Service,
updateChecker pluginupdatechecker.PluginUpdateChecker,
updateChecker pluginchecker.PluginUpdateChecker,
) checks.Check {
return &check{
PluginStore: pluginStore,
@ -36,7 +36,7 @@ func New(
type check struct {
PluginStore pluginstore.Store
PluginRepo repo.Service
updateChecker pluginupdatechecker.PluginUpdateChecker
updateChecker pluginchecker.PluginUpdateChecker
}
func (c *check) ID() string {
@ -129,7 +129,7 @@ func (s *deprecationStep) Run(ctx context.Context, log logging.Logger, _ *adviso
type updateStep struct {
PluginRepo repo.Service
updateChecker pluginupdatechecker.PluginUpdateChecker
updateChecker pluginchecker.PluginUpdateChecker
}
func (s *updateStep) Title() string {

@ -9,8 +9,8 @@ import (
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
"github.com/stretchr/testify/assert"
)
@ -163,7 +163,7 @@ func TestRun(t *testing.T) {
pluginPreinstall := &mockPluginPreinstall{pinned: tt.pluginPreinstalled}
managedPlugins := &mockManagedPlugins{managed: tt.pluginManaged}
provisionedPlugins := &mockProvisionedPlugins{provisioned: tt.pluginProvisioned}
updateChecker := pluginupdatechecker.ProvideService(managedPlugins, provisionedPlugins, pluginPreinstall)
updateChecker := pluginchecker.ProvideService(managedPlugins, provisionedPlugins, pluginPreinstall)
check := New(pluginStore, pluginRepo, updateChecker)
items, err := check.Items(context.Background())
@ -209,7 +209,7 @@ func (m *mockPluginRepo) GetPluginArchiveInfo(ctx context.Context, id, version s
}
type mockPluginPreinstall struct {
pluginupdatechecker.Preinstall
pluginchecker.Preinstall
pinned []string
}

@ -81,10 +81,10 @@ import (
"github.com/grafana/grafana/pkg/services/plugindashboards"
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginassets"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
pref "github.com/grafana/grafana/pkg/services/preference"
"github.com/grafana/grafana/pkg/services/provisioning"
publicdashboardsApi "github.com/grafana/grafana/pkg/services/publicdashboards/api"
@ -150,7 +150,7 @@ type HTTPServer struct {
pluginStaticRouteResolver plugins.StaticRouteResolver
pluginErrorResolver plugins.ErrorResolver
pluginAssets *pluginassets.Service
pluginPreinstall pluginupdatechecker.Preinstall
pluginPreinstall pluginchecker.Preinstall
SearchService search.Service
ShortURLService shorturls.Service
QueryHistoryService queryhistory.Service
@ -271,7 +271,7 @@ func ProvideHTTPServer(opts ServerOptions, cfg *setting.Cfg, routeRegister routi
annotationRepo annotations.Repository, tagService tag.Service, searchv2HTTPService searchV2.SearchHTTPService, oauthTokenService oauthtoken.OAuthTokenService,
statsService stats.Service, authnService authn.Service, pluginsCDNService *pluginscdn.Service, promGatherer prometheus.Gatherer,
starApi *starApi.API, promRegister prometheus.Registerer, clientConfigProvider grafanaapiserver.DirectRestConfigProvider, anonService anonymous.Service,
userVerifier user.Verifier, pluginPreinstall pluginupdatechecker.Preinstall,
userVerifier user.Verifier, pluginPreinstall pluginchecker.Preinstall,
) (*HTTPServer, error) {
web.Env = cfg.Env
m := web.New()

@ -44,10 +44,10 @@ import (
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginaccesscontrol"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginassets"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
"github.com/grafana/grafana/pkg/services/secrets/kvstore"
"github.com/grafana/grafana/pkg/services/updatemanager"
@ -114,7 +114,7 @@ func Test_PluginsInstallAndUninstall(t *testing.T) {
},
})
hs.managedPluginsService = managedplugins.NewNoop()
hs.pluginPreinstall = pluginupdatechecker.ProvidePreinstall(hs.Cfg)
hs.pluginPreinstall = pluginchecker.ProvidePreinstall(hs.Cfg)
expectedIdentity := &authn.Identity{
OrgID: tc.permissionOrg,
@ -652,7 +652,7 @@ func Test_PluginsList_AccessControl(t *testing.T) {
nil, // plugins.Installer
tracing.InitializeTracerForTest(),
kvstore.NewFakeFeatureToggles(t, true),
pluginupdatechecker.ProvideService(hs.managedPluginsService, provisionedplugins.NewNoop(), &pluginupdatechecker.FakePluginPreinstall{}),
pluginchecker.ProvideService(hs.managedPluginsService, provisionedplugins.NewNoop(), &pluginchecker.FakePluginPreinstall{}),
)
require.NoError(t, err)
})
@ -851,7 +851,7 @@ func Test_PluginsSettings(t *testing.T) {
&fakes.FakePluginInstaller{},
tracing.InitializeTracerForTest(),
kvstore.NewFakeFeatureToggles(t, true),
pluginupdatechecker.ProvideService(hs.managedPluginsService, provisionedplugins.NewNoop(), &pluginupdatechecker.FakePluginPreinstall{}),
pluginchecker.ProvideService(hs.managedPluginsService, provisionedplugins.NewNoop(), &pluginchecker.FakePluginPreinstall{}),
)
require.NoError(t, err)
})

@ -1,4 +1,4 @@
package pluginupdatechecker
package pluginchecker
import "github.com/grafana/grafana/pkg/setting"

@ -12,8 +12,8 @@ import (
"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/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/setting"
"github.com/prometheus/client_golang/prometheus"
)
@ -43,7 +43,7 @@ type Service struct {
pluginRepo repo.Service
features featuremgmt.FeatureToggles
failOnErr bool
updateChecker pluginupdatechecker.PluginUpdateChecker
updateChecker pluginchecker.PluginUpdateChecker
}
func ProvideService(
@ -53,7 +53,7 @@ func ProvideService(
promReg prometheus.Registerer,
pluginRepo repo.Service,
features featuremgmt.FeatureToggles,
updateChecker pluginupdatechecker.PluginUpdateChecker,
updateChecker pluginchecker.PluginUpdateChecker,
) (*Service, error) {
once.Do(func() {
promReg.MustRegister(installRequestCounter)

@ -11,8 +11,8 @@ import (
"github.com/grafana/grafana/pkg/plugins/repo"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
"github.com/grafana/grafana/pkg/setting"
"github.com/prometheus/client_golang/prometheus"
@ -32,7 +32,7 @@ func TestService_IsDisabled(t *testing.T) {
prometheus.NewRegistry(),
&fakes.FakePluginRepo{},
featuremgmt.WithFeatures(),
&pluginupdatechecker.FakePluginUpdateChecker{},
&pluginchecker.FakePluginUpdateChecker{},
)
require.NoError(t, err)
@ -184,10 +184,10 @@ func TestService_Run(t *testing.T) {
},
},
featuremgmt.WithFeatures(featuremgmt.FlagPreinstallAutoUpdate),
pluginupdatechecker.ProvideService(
pluginchecker.ProvideService(
managedplugins.NewNoop(),
provisionedplugins.NewNoop(),
&pluginupdatechecker.FakePluginPreinstall{},
&pluginchecker.FakePluginPreinstall{},
),
)
if tt.blocking && !tt.shouldInstall {

@ -46,6 +46,7 @@ import (
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pipeline"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginassets"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginconfig"
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
@ -54,7 +55,6 @@ import (
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/renderer"
"github.com/grafana/grafana/pkg/services/pluginsintegration/serviceregistration"
@ -129,12 +129,12 @@ var WireSet = wire.NewSet(
wire.Bind(new(plugincontext.BasePluginContextProvider), new(*plugincontext.BaseProvider)),
plugininstaller.ProvideService,
pluginassets.ProvideService,
pluginupdatechecker.ProvidePreinstall,
wire.Bind(new(pluginupdatechecker.Preinstall), new(*pluginupdatechecker.PreinstallImpl)),
pluginchecker.ProvidePreinstall,
wire.Bind(new(pluginchecker.Preinstall), new(*pluginchecker.PreinstallImpl)),
advisor.ProvideService,
wire.Bind(new(advisor.AdvisorStats), new(*advisor.Service)),
pluginupdatechecker.ProvideService,
wire.Bind(new(pluginupdatechecker.PluginUpdateChecker), new(*pluginupdatechecker.Service)),
pluginchecker.ProvideService,
wire.Bind(new(pluginchecker.PluginUpdateChecker), new(*pluginchecker.Service)),
)
// WireExtensionSet provides a wire.ProviderSet of plugin providers that can be

@ -20,8 +20,8 @@ import (
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/plugins"
"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/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/setting"
)
@ -42,7 +42,7 @@ type PluginsService struct {
tracer tracing.Tracer
updateCheckURL *url.URL
pluginInstaller plugins.Installer
updateChecker *pluginupdatechecker.Service
updateChecker *pluginchecker.Service
updateStrategy string
features featuremgmt.FeatureToggles
@ -53,7 +53,7 @@ func ProvidePluginsService(cfg *setting.Cfg,
pluginInstaller plugins.Installer,
tracer tracing.Tracer,
features featuremgmt.FeatureToggles,
updateChecker *pluginupdatechecker.Service,
updateChecker *pluginchecker.Service,
) (*PluginsService, error) {
logger := log.New("plugins.update.checker")
cl, err := httpclient.New(httpclient.Options{

@ -16,13 +16,13 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/fakes"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/pluginsintegration/managedplugins"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginchecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginupdatechecker"
"github.com/grafana/grafana/pkg/services/pluginsintegration/provisionedplugins"
)
type mockPluginPreinstall struct {
pluginupdatechecker.Preinstall
pluginchecker.Preinstall
}
func (m *mockPluginPreinstall) IsPinned(pluginID string) bool {
@ -51,7 +51,7 @@ func TestPluginUpdateChecker_HasUpdate(t *testing.T) {
},
},
updateCheckURL: updateCheckURL,
updateChecker: pluginupdatechecker.ProvideService(managedplugins.NewNoop(), provisionedplugins.NewNoop(), &mockPluginPreinstall{}),
updateChecker: pluginchecker.ProvideService(managedplugins.NewNoop(), provisionedplugins.NewNoop(), &mockPluginPreinstall{}),
features: &featuremgmt.FeatureManager{},
}
@ -97,7 +97,7 @@ func TestPluginUpdateChecker_HasUpdate(t *testing.T) {
},
},
updateCheckURL: updateCheckURL,
updateChecker: pluginupdatechecker.ProvideService(managedplugins.NewNoop(), provisionedplugins.NewNoop(), &mockPluginPreinstall{}),
updateChecker: pluginchecker.ProvideService(managedplugins.NewNoop(), provisionedplugins.NewNoop(), &mockPluginPreinstall{}),
}
update, exists := svc.HasUpdate(context.Background(), "test-ds")
@ -214,7 +214,7 @@ func TestPluginUpdateChecker_checkForUpdates(t *testing.T) {
log: log.NewNopLogger(),
tracer: tracing.InitializeTracerForTest(),
updateCheckURL: updateCheckURL,
updateChecker: pluginupdatechecker.ProvideService(managedplugins.NewNoop(), provisionedplugins.NewNoop(), &mockPluginPreinstall{}),
updateChecker: pluginchecker.ProvideService(managedplugins.NewNoop(), provisionedplugins.NewNoop(), &mockPluginPreinstall{}),
features: &featuremgmt.FeatureManager{},
}

Loading…
Cancel
Save