fix(plugin): install plugins into the first HELM_PLUGINS directory

When HELM_PLUGINS contains a list of directories, plugins should be installed into the first directory. The installer previously used the raw value as a single directory, which failed when a list was configured.

Fixes #11310

Signed-off-by: Yuhui Luo <92632263+lyh7c00@users.noreply.github.com>
pull/32569/head
Yuhui Luo 1 month ago committed by GitHub
parent 67d54fd880
commit c3c7c322b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -36,10 +36,21 @@ func newBase(source string) base {
}
}
// pluginsDir returns the directory where plugins should be installed. When
// HELM_PLUGINS contains a list of directories (separated by the OS path list
// separator), the first directory is the default install target.
func (b *base) pluginsDir() string {
dirs := filepath.SplitList(b.PluginsDirectory)
if len(dirs) == 0 {
return b.PluginsDirectory
}
return dirs[0]
}
// Path is where the plugin will be installed.
func (b *base) Path() string {
if b.Source == "" {
return ""
}
return filepath.Join(b.PluginsDirectory, filepath.Base(b.Source))
return filepath.Join(b.pluginsDir(), filepath.Base(b.Source))
}

Loading…
Cancel
Save