fix(plugin): install to first HELM_PLUGINS path entry

Signed-off-by: LarytheLord <llawlietbagsum@gmail.com>
pull/31906/head
LarytheLord 2 weeks ago
parent b4f4c4c2dd
commit c976a18a2f

@ -30,9 +30,17 @@ type base struct {
func newBase(source string) base {
settings := cli.New()
pluginsDirectory := settings.PluginsDirectory
for _, dir := range filepath.SplitList(settings.PluginsDirectory) {
if dir != "" {
pluginsDirectory = dir
break
}
}
return base{
Source: source,
PluginsDirectory: settings.PluginsDirectory,
PluginsDirectory: pluginsDirectory,
}
}

@ -14,6 +14,8 @@ limitations under the License.
package installer // import "helm.sh/helm/v4/internal/plugin/installer"
import (
"path/filepath"
"strings"
"testing"
)
@ -27,11 +29,22 @@ func TestPath(t *testing.T) {
source: "",
helmPluginsDir: "/helm/data/plugins",
expectPath: "",
}, {
},
{
source: "https://github.com/jkroepke/helm-secrets",
helmPluginsDir: "/helm/data/plugins",
expectPath: "/helm/data/plugins/helm-secrets",
},
{
source: "https://github.com/jkroepke/helm-secrets",
helmPluginsDir: strings.Join([]string{"/helm/data/plugins", "/helm/nfs/plugins"}, string(filepath.ListSeparator)),
expectPath: "/helm/data/plugins/helm-secrets",
},
{
source: "https://github.com/jkroepke/helm-secrets",
helmPluginsDir: strings.Join([]string{"", "/helm/nfs/plugins"}, string(filepath.ListSeparator)),
expectPath: "/helm/nfs/plugins/helm-secrets",
},
}
for _, tt := range tests {

Loading…
Cancel
Save