pull/11675/merge
Sergei Karpov 7 months ago committed by GitHub
commit d86a3819d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -29,11 +29,22 @@ type base struct {
} }
func newBase(source string) base { func newBase(source string) base {
settings := cli.New() pluginsDir := getPluginsDir()
return base{ return base{
Source: source, Source: source,
PluginsDirectory: settings.PluginsDirectory, PluginsDirectory: pluginsDir,
}
}
func getPluginsDir() string {
settings := cli.New()
if settings.PluginsDirectory == "" {
return ""
} }
pluginsDirs := filepath.SplitList(settings.PluginsDirectory)
return pluginsDirs[0]
} }
// Path is where the plugin will be installed. // Path is where the plugin will be installed.

@ -14,6 +14,7 @@ limitations under the License.
package installer // import "helm.sh/helm/v4/pkg/plugin/installer" package installer // import "helm.sh/helm/v4/pkg/plugin/installer"
import ( import (
"fmt"
"os" "os"
"testing" "testing"
) )
@ -32,6 +33,10 @@ func TestPath(t *testing.T) {
source: "https://github.com/jkroepke/helm-secrets", source: "https://github.com/jkroepke/helm-secrets",
helmPluginsDir: "/helm/data/plugins", helmPluginsDir: "/helm/data/plugins",
expectPath: "/helm/data/plugins/helm-secrets", expectPath: "/helm/data/plugins/helm-secrets",
}, {
source: "https://github.com/jkroepke/helm-secrets",
helmPluginsDir: fmt.Sprintf("/helm/data/plugins%c/remote/helm/data/plugins", os.PathListSeparator),
expectPath: "/helm/data/plugins/helm-secrets",
}, },
} }

Loading…
Cancel
Save