Plugins: Refactor plugin repository API (#69063)

* support grafana wildcard version

* undo go.mod changes

* tidy

* flesh out tests

* refactor

* add tests

* tidy naming

* undo some changes

* split interfaces

* separation

* update new signature

* simplify

* update var namings

* unexport types

* introduce opts pattern

* reorder test

* fix compat checks

* middle ground

* unexport client

* move back

* fix tests

* inline logger

* make client usable

* use fake logger

* tidy errors

* remove unused types

* fix test

* review fixes

* rework compatibility

* adjust installer

* fix tests

* opts => cfg

* remove unused var

* fix var name
This commit is contained in:
Will Browne
2023-05-30 11:48:52 +02:00
committed by GitHub
parent e7e70dbac6
commit 12dc56ad0c
18 changed files with 724 additions and 358 deletions

View File

@ -67,8 +67,11 @@ func installCommand(c utils.CommandLine) error {
// installPlugin downloads the plugin code as a zip file from the Grafana.com API
// and then extracts the zip into the plugin's directory.
func installPlugin(ctx context.Context, pluginID, version string, c utils.CommandLine) error {
skipTLSVerify := c.Bool("insecure")
repository := repo.New(skipTLSVerify, c.PluginRepoURL(), services.Logger)
repository := repo.NewManager(repo.ManagerCfg{
SkipTLSVerify: c.Bool("insecure"),
BaseURL: c.PluginRepoURL(),
Logger: services.Logger,
})
compatOpts := repo.NewCompatOpts(services.GrafanaVersion, runtime.GOOS, runtime.GOARCH)