From 19ffe0e22ddce76848fed575dd6793dafae09019 Mon Sep 17 00:00:00 2001 From: Lukasz Zajaczkowski Date: Fri, 15 Sep 2023 07:42:00 -0500 Subject: [PATCH] replace helm cli command with go client (#451) * replace helm cli command with go client * improve error handling --- pkg/scaffold/creator.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/scaffold/creator.go b/pkg/scaffold/creator.go index 12d12316..ff6c4ee2 100644 --- a/pkg/scaffold/creator.go +++ b/pkg/scaffold/creator.go @@ -8,6 +8,7 @@ import ( "github.com/pluralsh/plural/pkg/api" "github.com/pluralsh/plural/pkg/utils" "github.com/pluralsh/plural/pkg/utils/pathing" + "helm.sh/helm/v3/pkg/chartutil" ) var categories = []string{ @@ -77,7 +78,7 @@ func ApplicationScaffold(client api.Client) error { return err } - if err := utils.Exec("helm", "create", app); err != nil { + if err := createHelm(app); err != nil { return err } @@ -93,3 +94,9 @@ func ApplicationScaffold(client api.Client) error { return nil } + +func createHelm(name string) error { + chartname := filepath.Base(name) + _, err := chartutil.Create(chartname, filepath.Dir(name)) + return err +}