mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 03:13:49 +08:00
Plugins: Remove plugin dependency version (#103728)
remove plugin dependency version
This commit is contained in:
@ -191,10 +191,6 @@
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ func doInstallPlugin(ctx context.Context, pluginID, version string, o pluginInst
|
||||
if p, ok := services.PluginVersionInstalled(pluginID, version, o.pluginDir); ok {
|
||||
services.Logger.Successf("Plugin %s v%s already installed.", pluginID, version)
|
||||
for _, depP := range p.JSONData.Dependencies.Plugins {
|
||||
if err := doInstallPlugin(ctx, depP.ID, depP.Version, o, installing); err != nil {
|
||||
if err := doInstallPlugin(ctx, depP.ID, "", o, installing); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ func doInstallPlugin(ctx context.Context, pluginID, version string, o pluginInst
|
||||
if p, ok := services.PluginVersionInstalled(pluginID, archiveInfo.Version, o.pluginDir); ok {
|
||||
services.Logger.Successf("Plugin %s v%s already installed.", pluginID, archiveInfo.Version)
|
||||
for _, depP := range p.JSONData.Dependencies.Plugins {
|
||||
if err = doInstallPlugin(ctx, depP.ID, depP.Version, o, installing); err != nil {
|
||||
if err = doInstallPlugin(ctx, depP.ID, "", o, installing); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -179,7 +179,7 @@ func doInstallPlugin(ctx context.Context, pluginID, version string, o pluginInst
|
||||
|
||||
for _, dep := range extractedArchive.Dependencies {
|
||||
services.Logger.Infof("Fetching %s dependency %s...", pluginID, dep.ID)
|
||||
err = doInstallPlugin(ctx, dep.ID, dep.Version, pluginInstallOpts{
|
||||
err = doInstallPlugin(ctx, dep.ID, "", pluginInstallOpts{
|
||||
insecure: o.insecure,
|
||||
repoURL: o.repoURL,
|
||||
pluginDir: o.pluginDir,
|
||||
|
@ -68,7 +68,7 @@ func (m *PluginInstaller) Add(ctx context.Context, pluginID, version string, opt
|
||||
for _, dep := range archive.Dependencies {
|
||||
m.log.Info(fmt.Sprintf("Fetching %s dependency %s...", pluginID, dep.ID))
|
||||
|
||||
err = m.Add(ctx, dep.ID, dep.Version, opts)
|
||||
err = m.Add(ctx, dep.ID, "", opts)
|
||||
if err != nil {
|
||||
var dupeErr plugins.DuplicateError
|
||||
if errors.As(err, &dupeErr) {
|
||||
|
@ -179,8 +179,8 @@ func TestFinder_Find(t *testing.T) {
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
Plugins: []plugins.Dependency{
|
||||
{ID: "graphite", Type: "datasource", Name: "Graphite", Version: "1.0.0"},
|
||||
{ID: "graph", Type: "panel", Name: "Graph", Version: "1.0.0"},
|
||||
{ID: "graphite", Type: "datasource", Name: "Graphite"},
|
||||
{ID: "graph", Type: "panel", Name: "Graph"},
|
||||
},
|
||||
Extensions: plugins.ExtensionsDependencies{
|
||||
ExposedComponents: []string{},
|
||||
|
@ -166,8 +166,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
Plugins: []plugins.Dependency{
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite", Version: "1.0.0"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph", Version: "1.0.0"},
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph"},
|
||||
},
|
||||
Extensions: plugins.ExtensionsDependencies{
|
||||
ExposedComponents: []string{},
|
||||
|
@ -174,10 +174,9 @@ func (e Includes) RequiresRBACAction() bool {
|
||||
}
|
||||
|
||||
type Dependency struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type BuildInfo struct {
|
||||
|
@ -64,8 +64,8 @@ func Test_ReadPluginJSON(t *testing.T) {
|
||||
Dependencies: Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
Plugins: []Dependency{
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite", Version: "1.0.0"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph", Version: "1.0.0"},
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph"},
|
||||
},
|
||||
Extensions: ExtensionsDependencies{
|
||||
ExposedComponents: []string{},
|
||||
|
@ -53,8 +53,7 @@ func (fs *FS) Extract(ctx context.Context, pluginID string, dirNameFunc DirNameG
|
||||
deps := make([]*Dependency, 0, len(pluginJSON.Dependencies.Plugins))
|
||||
for _, plugin := range pluginJSON.Dependencies.Plugins {
|
||||
deps = append(deps, &Dependency{
|
||||
ID: plugin.ID,
|
||||
Version: plugin.Version,
|
||||
ID: plugin.ID,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,5 @@ type ExtractedPluginArchive struct {
|
||||
}
|
||||
|
||||
type Dependency struct {
|
||||
ID string
|
||||
Version string
|
||||
ID string
|
||||
}
|
||||
|
@ -165,8 +165,8 @@ func TestLoader_Load(t *testing.T) {
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
Plugins: []plugins.Dependency{
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite", Version: "1.0.0"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph", Version: "1.0.0"},
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph"},
|
||||
},
|
||||
Extensions: plugins.ExtensionsDependencies{
|
||||
ExposedComponents: []string{},
|
||||
@ -979,8 +979,8 @@ func TestLoader_Load_DuplicatePlugins(t *testing.T) {
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
Plugins: []plugins.Dependency{
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite", Version: "1.0.0"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph", Version: "1.0.0"},
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph"},
|
||||
},
|
||||
Extensions: plugins.ExtensionsDependencies{
|
||||
ExposedComponents: []string{},
|
||||
@ -1071,8 +1071,8 @@ func TestLoader_Load_SkipUninitializedPlugins(t *testing.T) {
|
||||
Dependencies: plugins.Dependencies{
|
||||
GrafanaVersion: "3.x.x",
|
||||
Plugins: []plugins.Dependency{
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite", Version: "1.0.0"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph", Version: "1.0.0"},
|
||||
{Type: "datasource", ID: "graphite", Name: "Graphite"},
|
||||
{Type: "panel", ID: "graph", Name: "Graph"},
|
||||
},
|
||||
Extensions: plugins.ExtensionsDependencies{
|
||||
ExposedComponents: []string{},
|
||||
|
Reference in New Issue
Block a user