From b4e893a199848313ce3b7958967ba84816f58f11 Mon Sep 17 00:00:00 2001 From: Lukasz Zajaczkowski Date: Thu, 14 Sep 2023 12:40:05 +0200 Subject: [PATCH 1/2] replace helm cli command with go client --- pkg/scaffold/creator.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/scaffold/creator.go b/pkg/scaffold/creator.go index 12d12316..39d063f6 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,12 @@ func ApplicationScaffold(client api.Client) error { return nil } + +func createHelm(name string) error { + chartname := filepath.Base(name) + _, err := chartutil.Create(chartname, filepath.Dir(name)) + if err != nil { + return err + } + return nil +} From 2c255886462f6e939e1d0dbff7ffbaf811d33c9f Mon Sep 17 00:00:00 2001 From: Lukasz Zajaczkowski Date: Fri, 15 Sep 2023 14:41:18 +0200 Subject: [PATCH 2/2] improve error handling --- pkg/scaffold/creator.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/scaffold/creator.go b/pkg/scaffold/creator.go index 39d063f6..ff6c4ee2 100644 --- a/pkg/scaffold/creator.go +++ b/pkg/scaffold/creator.go @@ -98,8 +98,5 @@ func ApplicationScaffold(client api.Client) error { func createHelm(name string) error { chartname := filepath.Base(name) _, err := chartutil.Create(chartname, filepath.Dir(name)) - if err != nil { - return err - } - return nil + return err }