mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Remove bundled plugins feature (#96490)
* remove bundled plugins * Add echo to command Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com> * remove folder entirely * remove folder from CODEOWNERS --------- Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
This commit is contained in:
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -422,8 +422,6 @@
|
|||||||
/packages/grafana-ui/src/graveyard/TimeSeries/ @grafana/dataviz-squad
|
/packages/grafana-ui/src/graveyard/TimeSeries/ @grafana/dataviz-squad
|
||||||
/packages/grafana-ui/src/utils/storybook/ @grafana/plugins-platform-frontend
|
/packages/grafana-ui/src/utils/storybook/ @grafana/plugins-platform-frontend
|
||||||
|
|
||||||
/plugins-bundled/ @grafana/plugins-platform-frontend
|
|
||||||
|
|
||||||
# root files, mostly frontend
|
# root files, mostly frontend
|
||||||
/.browserslistrc @grafana/frontend-ops
|
/.browserslistrc @grafana/frontend-ops
|
||||||
/package.json @grafana/frontend-ops
|
/package.json @grafana/frontend-ops
|
||||||
|
|||||||
3
.github/pr-commands.json
vendored
3
.github/pr-commands.json
vendored
@@ -14,7 +14,6 @@
|
|||||||
"public/**/*",
|
"public/**/*",
|
||||||
"packages/**/*",
|
"packages/**/*",
|
||||||
"e2e/**/*",
|
"e2e/**/*",
|
||||||
"plugins-bundled/**/*",
|
|
||||||
"scripts/build/release-packages.sh",
|
"scripts/build/release-packages.sh",
|
||||||
"scripts/circle-release-next-packages.sh",
|
"scripts/circle-release-next-packages.sh",
|
||||||
"scripts/ci-frontend-metrics.sh",
|
"scripts/ci-frontend-metrics.sh",
|
||||||
@@ -437,4 +436,4 @@
|
|||||||
"action": "updateLabel",
|
"action": "updateLabel",
|
||||||
"addLabel": "area/panel/table"
|
"addLabel": "area/panel/table"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
2
.github/renovate.json5
vendored
2
.github/renovate.json5
vendored
@@ -19,7 +19,7 @@
|
|||||||
"nx"
|
"nx"
|
||||||
],
|
],
|
||||||
includePaths: ["package.json", "packages/**", "public/app/plugins/**"],
|
includePaths: ["package.json", "packages/**", "public/app/plugins/**"],
|
||||||
ignorePaths: ["emails/**", "plugins-bundled/**", "**/mocks/**"],
|
ignorePaths: ["emails/**", "**/mocks/**"],
|
||||||
labels: ["area/frontend", "dependencies", "no-changelog"],
|
labels: ["area/frontend", "dependencies", "no-changelog"],
|
||||||
postUpdateOptions: ["yarnDedupeHighest"],
|
postUpdateOptions: ["yarnDedupeHighest"],
|
||||||
packageRules: [
|
packageRules: [
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ WORKDIR /tmp/grafana
|
|||||||
COPY package.json project.json nx.json yarn.lock .yarnrc.yml ./
|
COPY package.json project.json nx.json yarn.lock .yarnrc.yml ./
|
||||||
COPY .yarn .yarn
|
COPY .yarn .yarn
|
||||||
COPY packages packages
|
COPY packages packages
|
||||||
COPY plugins-bundled plugins-bundled
|
|
||||||
COPY public public
|
COPY public public
|
||||||
COPY LICENSE ./
|
COPY LICENSE ./
|
||||||
COPY conf/defaults.ini ./conf/defaults.ini
|
COPY conf/defaults.ini ./conf/defaults.ini
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -211,7 +211,6 @@ build-cli: ## Build Grafana CLI application.
|
|||||||
build-js: ## Build frontend assets.
|
build-js: ## Build frontend assets.
|
||||||
@echo "build frontend"
|
@echo "build frontend"
|
||||||
yarn run build
|
yarn run build
|
||||||
yarn run plugins:build-bundled
|
|
||||||
|
|
||||||
PLUGIN_ID ?=
|
PLUGIN_ID ?=
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"themes-generate": "esbuild --target=es6 ./scripts/cli/generateSassVariableFiles.ts --bundle --platform=node --tsconfig=./scripts/cli/tsconfig.json | node",
|
"themes-generate": "esbuild --target=es6 ./scripts/cli/generateSassVariableFiles.ts --bundle --platform=node --tsconfig=./scripts/cli/tsconfig.json | node",
|
||||||
"themes:usage": "eslint . --ignore-pattern '*.test.ts*' --ignore-pattern '*.spec.ts*' --cache --plugin '@grafana' --rule '{ @grafana/theme-token-usage: \"error\" }'",
|
"themes:usage": "eslint . --ignore-pattern '*.test.ts*' --ignore-pattern '*.spec.ts*' --cache --plugin '@grafana' --rule '{ @grafana/theme-token-usage: \"error\" }'",
|
||||||
"typecheck": "tsc --noEmit && yarn run packages:typecheck",
|
"typecheck": "tsc --noEmit && yarn run packages:typecheck",
|
||||||
"plugins:build-bundled": "find plugins-bundled -name package.json -not -path '*/node_modules/*' -execdir yarn build \\;",
|
"plugins:build-bundled": "echo 'bundled plugins are no longer supported'",
|
||||||
"watch": "yarn start -d watch,start core:start --watchTheme",
|
"watch": "yarn start -d watch,start core:start --watchTheme",
|
||||||
"ci:test-frontend": "yarn run test:ci",
|
"ci:test-frontend": "yarn run test:ci",
|
||||||
"i18n:stats": "node ./scripts/cli/reportI18nStats.mjs",
|
"i18n:stats": "node ./scripts/cli/reportI18nStats.mjs",
|
||||||
@@ -437,7 +437,6 @@
|
|||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
"packages/!(grafana-icons)/**",
|
"packages/!(grafana-icons)/**",
|
||||||
"plugins-bundled/internal/*",
|
|
||||||
"public/app/plugins/*/*",
|
"public/app/plugins/*/*",
|
||||||
"e2e/test-plugins/*"
|
"e2e/test-plugins/*"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func (m *PluginInstaller) install(ctx context.Context, pluginID, version string,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if plugin, exists := m.plugin(ctx, pluginID, version); exists {
|
if plugin, exists := m.plugin(ctx, pluginID, version); exists {
|
||||||
if plugin.IsCorePlugin() || plugin.IsBundledPlugin() {
|
if plugin.IsCorePlugin() {
|
||||||
return nil, plugins.ErrInstallCorePlugin
|
return nil, plugins.ErrInstallCorePlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ func (m *PluginInstaller) Remove(ctx context.Context, pluginID, version string)
|
|||||||
return plugins.ErrPluginNotInstalled
|
return plugins.ErrPluginNotInstalled
|
||||||
}
|
}
|
||||||
|
|
||||||
if plugin.IsCorePlugin() || plugin.IsBundledPlugin() {
|
if plugin.IsCorePlugin() {
|
||||||
return plugins.ErrUninstallCorePlugin
|
return plugins.ErrUninstallCorePlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,37 +212,28 @@ func TestPluginManager_Add_Remove(t *testing.T) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Can't update core or bundled plugin", func(t *testing.T) {
|
t.Run("Can't update core plugin", func(t *testing.T) {
|
||||||
tcs := []struct {
|
p := createPlugin(t, testPluginID, plugins.ClassCore, true, true, func(plugin *plugins.Plugin) {
|
||||||
class plugins.Class
|
plugin.Info.Version = "1.0.0"
|
||||||
}{
|
})
|
||||||
{class: plugins.ClassCore},
|
|
||||||
{class: plugins.ClassBundled},
|
reg := &fakes.FakePluginRegistry{
|
||||||
|
Store: map[string]*plugins.Plugin{
|
||||||
|
testPluginID: p,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tcs {
|
pm := New(reg, &fakes.FakeLoader{}, &fakes.FakePluginRepo{}, &fakes.FakePluginStorage{}, storage.SimpleDirNameGeneratorFunc, &fakes.FakeAuthService{})
|
||||||
p := createPlugin(t, testPluginID, tc.class, true, true, func(plugin *plugins.Plugin) {
|
err := pm.Add(context.Background(), p.ID, "3.2.0", testCompatOpts())
|
||||||
plugin.Info.Version = "1.0.0"
|
require.ErrorIs(t, err, plugins.ErrInstallCorePlugin)
|
||||||
})
|
|
||||||
|
|
||||||
reg := &fakes.FakePluginRegistry{
|
err = pm.Add(context.Background(), testPluginID, "", testCompatOpts())
|
||||||
Store: map[string]*plugins.Plugin{
|
require.Equal(t, plugins.ErrInstallCorePlugin, err)
|
||||||
testPluginID: p,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
pm := New(reg, &fakes.FakeLoader{}, &fakes.FakePluginRepo{}, &fakes.FakePluginStorage{}, storage.SimpleDirNameGeneratorFunc, &fakes.FakeAuthService{})
|
t.Run("Can't uninstall core plugin", func(t *testing.T) {
|
||||||
err := pm.Add(context.Background(), p.ID, "3.2.0", testCompatOpts())
|
err = pm.Remove(context.Background(), p.ID, p.Info.Version)
|
||||||
require.ErrorIs(t, err, plugins.ErrInstallCorePlugin)
|
require.Equal(t, plugins.ErrUninstallCorePlugin, err)
|
||||||
|
})
|
||||||
err = pm.Add(context.Background(), testPluginID, "", testCompatOpts())
|
|
||||||
require.Equal(t, plugins.ErrInstallCorePlugin, err)
|
|
||||||
|
|
||||||
t.Run(fmt.Sprintf("Can't uninstall %s plugin", tc.class), func(t *testing.T) {
|
|
||||||
err = pm.Remove(context.Background(), p.ID, p.Info.Version)
|
|
||||||
require.Equal(t, plugins.ErrUninstallCorePlugin, err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Can install multiple dependency levels", func(t *testing.T) {
|
t.Run("Can install multiple dependency levels", func(t *testing.T) {
|
||||||
|
|||||||
@@ -124,56 +124,6 @@ func TestLoader_Load(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Load a Bundled plugin",
|
|
||||||
class: plugins.ClassBundled,
|
|
||||||
cfg: &config.PluginManagementCfg{},
|
|
||||||
pluginPaths: []string{"../testdata/valid-v2-signature"},
|
|
||||||
want: []*plugins.Plugin{
|
|
||||||
{
|
|
||||||
JSONData: plugins.JSONData{
|
|
||||||
ID: "test-datasource",
|
|
||||||
Type: plugins.TypeDataSource,
|
|
||||||
Name: "Test",
|
|
||||||
Info: plugins.Info{
|
|
||||||
Author: plugins.InfoLink{
|
|
||||||
Name: "Will Browne",
|
|
||||||
URL: "https://willbrowne.com",
|
|
||||||
},
|
|
||||||
Version: "1.0.0",
|
|
||||||
Logos: plugins.Logos{
|
|
||||||
Small: "public/img/icn-datasource.svg",
|
|
||||||
Large: "public/img/icn-datasource.svg",
|
|
||||||
},
|
|
||||||
Description: "Test",
|
|
||||||
},
|
|
||||||
Dependencies: plugins.Dependencies{
|
|
||||||
GrafanaVersion: "*",
|
|
||||||
Plugins: []plugins.Dependency{},
|
|
||||||
Extensions: plugins.ExtensionsDependencies{
|
|
||||||
ExposedComponents: []string{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Extensions: plugins.Extensions{
|
|
||||||
AddedLinks: []plugins.AddedLink{},
|
|
||||||
AddedComponents: []plugins.AddedComponent{},
|
|
||||||
ExposedComponents: []plugins.ExposedComponent{},
|
|
||||||
ExtensionPoints: []plugins.ExtensionPoint{},
|
|
||||||
},
|
|
||||||
Executable: "test",
|
|
||||||
Backend: true,
|
|
||||||
State: "alpha",
|
|
||||||
},
|
|
||||||
Module: "public/plugins/test-datasource/module.js",
|
|
||||||
BaseURL: "public/plugins/test-datasource",
|
|
||||||
FS: mustNewStaticFSForTests(t, filepath.Join(parentDir, "testdata/valid-v2-signature/plugin/")),
|
|
||||||
Signature: "valid",
|
|
||||||
SignatureType: plugins.SignatureTypeGrafana,
|
|
||||||
SignatureOrg: "Grafana Labs",
|
|
||||||
Class: plugins.ClassBundled,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "Load plugin with symbolic links",
|
name: "Load plugin with symbolic links",
|
||||||
class: plugins.ClassExternal,
|
class: plugins.ClassExternal,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func (s *Validation) ValidateSignature(plugin *plugins.Plugin) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if plugin.IsCorePlugin() || plugin.IsBundledPlugin() {
|
if plugin.IsCorePlugin() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ func ProvideService(cfg *setting.Cfg) *Service {
|
|||||||
func (s *Service) List(_ context.Context) []plugins.PluginSource {
|
func (s *Service) List(_ context.Context) []plugins.PluginSource {
|
||||||
r := []plugins.PluginSource{
|
r := []plugins.PluginSource{
|
||||||
NewLocalSource(plugins.ClassCore, corePluginPaths(s.cfg.StaticRootPath)),
|
NewLocalSource(plugins.ClassCore, corePluginPaths(s.cfg.StaticRootPath)),
|
||||||
NewLocalSource(plugins.ClassBundled, []string{s.cfg.BundledPluginsPath}),
|
|
||||||
}
|
}
|
||||||
r = append(r, s.externalPluginSources()...)
|
r = append(r, s.externalPluginSources()...)
|
||||||
r = append(r, s.pluginSettingSources()...)
|
r = append(r, s.pluginSettingSources()...)
|
||||||
|
|||||||
@@ -17,9 +17,8 @@ func TestSources_List(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
cfg := &setting.Cfg{
|
cfg := &setting.Cfg{
|
||||||
StaticRootPath: testdata,
|
StaticRootPath: testdata,
|
||||||
PluginsPath: filepath.Join(testdata, "pluginRootWithDist"),
|
PluginsPath: filepath.Join(testdata, "pluginRootWithDist"),
|
||||||
BundledPluginsPath: filepath.Join(testdata, "unsigned-panel"),
|
|
||||||
PluginSettings: setting.PluginSettings{
|
PluginSettings: setting.PluginSettings{
|
||||||
"foo": map[string]string{
|
"foo": map[string]string{
|
||||||
"path": filepath.Join(testdata, "test-app"),
|
"path": filepath.Join(testdata, "test-app"),
|
||||||
@@ -35,7 +34,7 @@ func TestSources_List(t *testing.T) {
|
|||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
require.Len(t, srcs, 6)
|
require.Len(t, srcs, 5)
|
||||||
|
|
||||||
require.Equal(t, srcs[0].PluginClass(ctx), plugins.ClassCore)
|
require.Equal(t, srcs[0].PluginClass(ctx), plugins.ClassCore)
|
||||||
require.Equal(t, srcs[0].PluginURIs(ctx), []string{
|
require.Equal(t, srcs[0].PluginURIs(ctx), []string{
|
||||||
@@ -48,15 +47,17 @@ func TestSources_List(t *testing.T) {
|
|||||||
require.Equal(t, plugins.SignatureType(""), sig.Type)
|
require.Equal(t, plugins.SignatureType(""), sig.Type)
|
||||||
require.Equal(t, "", sig.SigningOrg)
|
require.Equal(t, "", sig.SigningOrg)
|
||||||
|
|
||||||
require.Equal(t, srcs[1].PluginClass(ctx), plugins.ClassBundled)
|
require.Equal(t, srcs[1].PluginClass(ctx), plugins.ClassExternal)
|
||||||
require.Equal(t, srcs[1].PluginURIs(ctx), []string{filepath.Join(testdata, "unsigned-panel")})
|
require.Equal(t, srcs[1].PluginURIs(ctx), []string{
|
||||||
|
filepath.Join(testdata, "pluginRootWithDist", "datasource"),
|
||||||
|
})
|
||||||
sig, exists = srcs[1].DefaultSignature(ctx)
|
sig, exists = srcs[1].DefaultSignature(ctx)
|
||||||
require.False(t, exists)
|
require.False(t, exists)
|
||||||
require.Equal(t, plugins.Signature{}, sig)
|
require.Equal(t, plugins.Signature{}, sig)
|
||||||
|
|
||||||
require.Equal(t, srcs[2].PluginClass(ctx), plugins.ClassExternal)
|
require.Equal(t, srcs[2].PluginClass(ctx), plugins.ClassExternal)
|
||||||
require.Equal(t, srcs[2].PluginURIs(ctx), []string{
|
require.Equal(t, srcs[2].PluginURIs(ctx), []string{
|
||||||
filepath.Join(testdata, "pluginRootWithDist", "datasource"),
|
filepath.Join(testdata, "pluginRootWithDist", "dist"),
|
||||||
})
|
})
|
||||||
sig, exists = srcs[2].DefaultSignature(ctx)
|
sig, exists = srcs[2].DefaultSignature(ctx)
|
||||||
require.False(t, exists)
|
require.False(t, exists)
|
||||||
@@ -64,17 +65,9 @@ func TestSources_List(t *testing.T) {
|
|||||||
|
|
||||||
require.Equal(t, srcs[3].PluginClass(ctx), plugins.ClassExternal)
|
require.Equal(t, srcs[3].PluginClass(ctx), plugins.ClassExternal)
|
||||||
require.Equal(t, srcs[3].PluginURIs(ctx), []string{
|
require.Equal(t, srcs[3].PluginURIs(ctx), []string{
|
||||||
filepath.Join(testdata, "pluginRootWithDist", "dist"),
|
|
||||||
})
|
|
||||||
sig, exists = srcs[3].DefaultSignature(ctx)
|
|
||||||
require.False(t, exists)
|
|
||||||
require.Equal(t, plugins.Signature{}, sig)
|
|
||||||
|
|
||||||
require.Equal(t, srcs[4].PluginClass(ctx), plugins.ClassExternal)
|
|
||||||
require.Equal(t, srcs[4].PluginURIs(ctx), []string{
|
|
||||||
filepath.Join(testdata, "pluginRootWithDist", "panel"),
|
filepath.Join(testdata, "pluginRootWithDist", "panel"),
|
||||||
})
|
})
|
||||||
sig, exists = srcs[4].DefaultSignature(ctx)
|
sig, exists = srcs[3].DefaultSignature(ctx)
|
||||||
require.False(t, exists)
|
require.False(t, exists)
|
||||||
require.Equal(t, plugins.Signature{}, sig)
|
require.Equal(t, plugins.Signature{}, sig)
|
||||||
})
|
})
|
||||||
@@ -84,9 +77,8 @@ func TestSources_List(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
cfg := &setting.Cfg{
|
cfg := &setting.Cfg{
|
||||||
StaticRootPath: testdata,
|
StaticRootPath: testdata,
|
||||||
PluginsPath: filepath.Join(testdata, "symbolic-plugin-dirs"),
|
PluginsPath: filepath.Join(testdata, "symbolic-plugin-dirs"),
|
||||||
BundledPluginsPath: filepath.Join(testdata, "unsigned-panel"),
|
|
||||||
}
|
}
|
||||||
s := ProvideService(cfg)
|
s := ProvideService(cfg)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@@ -107,10 +99,6 @@ func TestSources_List(t *testing.T) {
|
|||||||
filepath.Join(testdata, "app", "plugins", "panel"): {},
|
filepath.Join(testdata, "app", "plugins", "panel"): {},
|
||||||
}, "should include core plugins")
|
}, "should include core plugins")
|
||||||
|
|
||||||
require.Equal(t, uris[plugins.ClassBundled], map[string]struct{}{
|
|
||||||
filepath.Join(testdata, "unsigned-panel"): {},
|
|
||||||
}, "should include bundle plugin")
|
|
||||||
|
|
||||||
require.Equal(t, uris[plugins.ClassExternal], map[string]struct{}{
|
require.Equal(t, uris[plugins.ClassExternal], map[string]struct{}{
|
||||||
filepath.Join(testdata, "symbolic-plugin-dirs", "plugin"): {},
|
filepath.Join(testdata, "symbolic-plugin-dirs", "plugin"): {},
|
||||||
}, "should include external symlinked plugin")
|
}, "should include external symlinked plugin")
|
||||||
|
|||||||
@@ -494,19 +494,14 @@ func (p *Plugin) IsCorePlugin() bool {
|
|||||||
return p.Class == ClassCore
|
return p.Class == ClassCore
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Plugin) IsBundledPlugin() bool {
|
|
||||||
return p.Class == ClassBundled
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Plugin) IsExternalPlugin() bool {
|
func (p *Plugin) IsExternalPlugin() bool {
|
||||||
return !p.IsCorePlugin() && !p.IsBundledPlugin()
|
return !p.IsCorePlugin()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Class string
|
type Class string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ClassCore Class = "core"
|
ClassCore Class = "core"
|
||||||
ClassBundled Class = "bundled"
|
|
||||||
ClassExternal Class = "external"
|
ClassExternal Class = "external"
|
||||||
ClassCDN Class = "cdn"
|
ClassCDN Class = "cdn"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -124,56 +124,6 @@ func TestLoader_Load(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Load a Bundled plugin",
|
|
||||||
class: plugins.ClassBundled,
|
|
||||||
cfg: &config.PluginManagementCfg{},
|
|
||||||
pluginPaths: []string{filepath.Join(testDataDir(t), "valid-v2-signature")},
|
|
||||||
want: []*plugins.Plugin{
|
|
||||||
{
|
|
||||||
JSONData: plugins.JSONData{
|
|
||||||
ID: "test-datasource",
|
|
||||||
Type: plugins.TypeDataSource,
|
|
||||||
Name: "Test",
|
|
||||||
Info: plugins.Info{
|
|
||||||
Author: plugins.InfoLink{
|
|
||||||
Name: "Will Browne",
|
|
||||||
URL: "https://willbrowne.com",
|
|
||||||
},
|
|
||||||
Version: "1.0.0",
|
|
||||||
Logos: plugins.Logos{
|
|
||||||
Small: "public/img/icn-datasource.svg",
|
|
||||||
Large: "public/img/icn-datasource.svg",
|
|
||||||
},
|
|
||||||
Description: "Test",
|
|
||||||
},
|
|
||||||
Dependencies: plugins.Dependencies{
|
|
||||||
GrafanaVersion: "*",
|
|
||||||
Plugins: []plugins.Dependency{},
|
|
||||||
Extensions: plugins.ExtensionsDependencies{
|
|
||||||
ExposedComponents: []string{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Extensions: plugins.Extensions{
|
|
||||||
AddedLinks: []plugins.AddedLink{},
|
|
||||||
AddedComponents: []plugins.AddedComponent{},
|
|
||||||
ExposedComponents: []plugins.ExposedComponent{},
|
|
||||||
ExtensionPoints: []plugins.ExtensionPoint{},
|
|
||||||
},
|
|
||||||
Executable: "test",
|
|
||||||
Backend: true,
|
|
||||||
State: "alpha",
|
|
||||||
},
|
|
||||||
Module: "public/plugins/test-datasource/module.js",
|
|
||||||
BaseURL: "public/plugins/test-datasource",
|
|
||||||
FS: mustNewStaticFSForTests(t, filepath.Join(testDataDir(t), "valid-v2-signature/plugin/")),
|
|
||||||
Signature: "valid",
|
|
||||||
SignatureType: plugins.SignatureTypeGrafana,
|
|
||||||
SignatureOrg: "Grafana Labs",
|
|
||||||
Class: plugins.ClassBundled,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "Load plugin with symbolic links",
|
name: "Load plugin with symbolic links",
|
||||||
class: plugins.ClassExternal,
|
class: plugins.ClassExternal,
|
||||||
@@ -672,7 +622,7 @@ func TestLoader_Load_CustomSource(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
FS: mustNewStaticFSForTests(t, filepath.Join(testDataDir(t), "cdn/plugin")),
|
FS: mustNewStaticFSForTests(t, filepath.Join(testDataDir(t), "cdn/plugin")),
|
||||||
Class: plugins.ClassBundled,
|
Class: plugins.ClassExternal,
|
||||||
Signature: plugins.SignatureStatusValid,
|
Signature: plugins.SignatureStatusValid,
|
||||||
BaseURL: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel",
|
BaseURL: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel",
|
||||||
Module: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/module.js",
|
Module: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/module.js",
|
||||||
@@ -681,7 +631,7 @@ func TestLoader_Load_CustomSource(t *testing.T) {
|
|||||||
l := newLoader(t, cfg, fakes.NewFakePluginRegistry(), fakes.NewFakeProcessManager(), fakes.NewFakeBackendProcessProvider(), newFakeErrorTracker())
|
l := newLoader(t, cfg, fakes.NewFakePluginRegistry(), fakes.NewFakeProcessManager(), fakes.NewFakeBackendProcessProvider(), newFakeErrorTracker())
|
||||||
got, err := l.Load(context.Background(), &fakes.FakePluginSource{
|
got, err := l.Load(context.Background(), &fakes.FakePluginSource{
|
||||||
PluginClassFunc: func(ctx context.Context) plugins.Class {
|
PluginClassFunc: func(ctx context.Context) plugins.Class {
|
||||||
return plugins.ClassBundled
|
return plugins.ClassExternal
|
||||||
},
|
},
|
||||||
PluginURIsFunc: func(ctx context.Context) []string {
|
PluginURIsFunc: func(ctx context.Context) []string {
|
||||||
return pluginPaths
|
return pluginPaths
|
||||||
@@ -1170,11 +1120,6 @@ func TestLoader_AngularClass(t *testing.T) {
|
|||||||
class: plugins.ClassCore,
|
class: plugins.ClassCore,
|
||||||
expAngularDetectionRun: false,
|
expAngularDetectionRun: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "bundled plugin should skip angular detection",
|
|
||||||
class: plugins.ClassBundled,
|
|
||||||
expAngularDetectionRun: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "external plugin should run angular detection",
|
name: "external plugin should run angular detection",
|
||||||
class: plugins.ClassExternal,
|
class: plugins.ClassExternal,
|
||||||
|
|||||||
@@ -121,9 +121,9 @@ func (r *RegisterActionSets) Register(ctx context.Context, p *plugins.Plugin) (*
|
|||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReportBuildMetrics reports build information for all plugins, except core and bundled plugins.
|
// ReportBuildMetrics reports build information for all plugins, except core plugins.
|
||||||
func ReportBuildMetrics(_ context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {
|
func ReportBuildMetrics(_ context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {
|
||||||
if !p.IsCorePlugin() && !p.IsBundledPlugin() {
|
if !p.IsCorePlugin() {
|
||||||
metrics.SetPluginBuildInformation(p.ID, string(p.Type), p.Info.Version, string(p.Signature))
|
metrics.SetPluginBuildInformation(p.ID, string(p.Type), p.Info.Version, string(p.Signature))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,15 +55,11 @@ func TestIntegrationPluginManager(t *testing.T) {
|
|||||||
staticRootPath, err := filepath.Abs("../../../public/")
|
staticRootPath, err := filepath.Abs("../../../public/")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
bundledPluginsPath, err := filepath.Abs("../../../plugins-bundled/internal")
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
features := featuremgmt.WithFeatures()
|
features := featuremgmt.WithFeatures()
|
||||||
cfg := &setting.Cfg{
|
cfg := &setting.Cfg{
|
||||||
Raw: ini.Empty(),
|
Raw: ini.Empty(),
|
||||||
StaticRootPath: staticRootPath,
|
StaticRootPath: staticRootPath,
|
||||||
BundledPluginsPath: bundledPluginsPath,
|
Azure: &azsettings.AzureSettings{},
|
||||||
Azure: &azsettings.AzureSettings{},
|
|
||||||
PluginSettings: map[string]map[string]string{
|
PluginSettings: map[string]map[string]string{
|
||||||
"test-app": {
|
"test-app": {
|
||||||
"path": "../../plugins/manager/testdata/test-app",
|
"path": "../../plugins/manager/testdata/test-app",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func TestStore_ProvideService(t *testing.T) {
|
|||||||
return []plugins.PluginSource{
|
return []plugins.PluginSource{
|
||||||
&fakes.FakePluginSource{
|
&fakes.FakePluginSource{
|
||||||
PluginClassFunc: func(ctx context.Context) plugins.Class {
|
PluginClassFunc: func(ctx context.Context) plugins.Class {
|
||||||
return plugins.ClassBundled
|
return "foobar"
|
||||||
},
|
},
|
||||||
PluginURIsFunc: func(ctx context.Context) []string {
|
PluginURIsFunc: func(ctx context.Context) []string {
|
||||||
return []string{"path1"}
|
return []string{"path1"}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ func TestPluginUpdateChecker_checkForUpdates(t *testing.T) {
|
|||||||
Info: plugins.Info{Version: "2.5.7"},
|
Info: plugins.Info{Version: "2.5.7"},
|
||||||
Type: plugins.TypePanel,
|
Type: plugins.TypePanel,
|
||||||
},
|
},
|
||||||
Class: plugins.ClassBundled,
|
Class: plugins.ClassExternal,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
JSONData: plugins.JSONData{
|
JSONData: plugins.JSONData{
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ type Cfg struct {
|
|||||||
DataPath string
|
DataPath string
|
||||||
LogsPath string
|
LogsPath string
|
||||||
PluginsPath string
|
PluginsPath string
|
||||||
BundledPluginsPath string
|
|
||||||
EnterpriseLicensePath string
|
EnterpriseLicensePath string
|
||||||
|
|
||||||
// SMTP email settings
|
// SMTP email settings
|
||||||
@@ -1101,7 +1100,6 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
|
|||||||
cfg.InstanceName = valueAsString(iniFile.Section(""), "instance_name", "unknown_instance_name")
|
cfg.InstanceName = valueAsString(iniFile.Section(""), "instance_name", "unknown_instance_name")
|
||||||
plugins := valueAsString(iniFile.Section("paths"), "plugins", "")
|
plugins := valueAsString(iniFile.Section("paths"), "plugins", "")
|
||||||
cfg.PluginsPath = makeAbsolute(plugins, cfg.HomePath)
|
cfg.PluginsPath = makeAbsolute(plugins, cfg.HomePath)
|
||||||
cfg.BundledPluginsPath = makeAbsolute("plugins-bundled", cfg.HomePath)
|
|
||||||
provisioning := valueAsString(iniFile.Section("paths"), "provisioning", "")
|
provisioning := valueAsString(iniFile.Section("paths"), "provisioning", "")
|
||||||
cfg.ProvisioningPath = makeAbsolute(provisioning, cfg.HomePath)
|
cfg.ProvisioningPath = makeAbsolute(provisioning, cfg.HomePath)
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ func TestIntegrationPlugins(t *testing.T) {
|
|||||||
t.Run("List", func(t *testing.T) {
|
t.Run("List", func(t *testing.T) {
|
||||||
testCases := []testCase{
|
testCases := []testCase{
|
||||||
{
|
{
|
||||||
desc: "should return all loaded core and bundled plugins",
|
desc: "should return all loaded core plugins",
|
||||||
url: "http://%s/api/plugins",
|
url: "http://%s/api/plugins",
|
||||||
expStatus: http.StatusOK,
|
expStatus: http.StatusOK,
|
||||||
expRespPath: "expectedListResp.json",
|
expRespPath: "expectedListResp.json",
|
||||||
|
|||||||
9
plugins-bundled/.gitignore
vendored
9
plugins-bundled/.gitignore
vendored
@@ -1,9 +0,0 @@
|
|||||||
# packaged by toolkit
|
|
||||||
dist
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# Ignore external git configs
|
|
||||||
external
|
|
||||||
|
|
||||||
# this file is added automatically
|
|
||||||
.prettierrc.js
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Bundled Plugins
|
|
||||||
|
|
||||||
Bundled plugins are built as true plugins, and managed by the grafana install.
|
|
||||||
|
|
||||||
TODO: the packaging system should move all `dist` items to the root and remove sources.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": []
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user