feat: map GF_INSTALL_PLUGINS to use preinstall plugins feature (#105145)

* feat: map GF_INSTALL_PLUGINS to use preinstall plugins feature

* ref: process GF_INSTALL_PLUGINS as sync install

* fix: check GF_INSTALL_PLUGINS_FORCE in the docker run

* ref: use preinstall_sync for GF_INSTALL_PLUGINS

* ref: logs and deprecation msg for GF_INSTALL_PLUGINS

* chore: deprecated log formatting
This commit is contained in:
Syerikjan Kh
2025-05-22 08:23:33 -04:00
committed by GitHub
parent 267e3ffb7c
commit e05ccb822a
5 changed files with 225 additions and 21 deletions
+12
View File
@@ -78,6 +78,18 @@ func TestLoadingSettings(t *testing.T) {
require.Equal(t, filepath.Join(cfg.DataPath, "log"), cfg.LogsPath)
})
t.Run("Should be able to override via plugins.preinstall with GF_INSTALL_PLUGINS env var when GF_PLUGINS_PREINSTALL and cfg.plugins.preinstall are not set", func(t *testing.T) {
t.Setenv("GF_INSTALL_PLUGINS", "https://grafana.com/grafana/plugins/grafana-piechart-panel/;grafana-piechart-panel")
cfg := NewCfg()
err := cfg.Load(CommandLineArgs{HomePath: "../../"})
require.Nil(t, err)
require.Equal(t, filepath.Join(cfg.HomePath, "data"), cfg.DataPath)
require.Equal(t, filepath.Join(cfg.DataPath, "log"), cfg.LogsPath)
require.Equal(t, cfg.PreinstallPluginsSync, []InstallPlugin{{ID: "grafana-piechart-panel", Version: "", URL: "https://grafana.com/grafana/plugins/grafana-piechart-panel/"}})
})
t.Run("Should be able to expand parameter from environment variables", func(t *testing.T) {
t.Setenv("DEFAULT_IDP_URL", "grafana.com")
t.Setenv("GF_AUTH_GENERIC_OAUTH_AUTH_URL", "${DEFAULT_IDP_URL}/auth")