From f98540b8790d50fcdef8e53cd65b85454d90e19e Mon Sep 17 00:00:00 2001 From: Reto Galante Date: Wed, 18 Dec 2024 16:29:57 +0100 Subject: [PATCH 1/2] Assure all dependencies are present before linting --- helm/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/helm/main.go b/helm/main.go index 662616d..7104324 100644 --- a/helm/main.go +++ b/helm/main.go @@ -187,7 +187,7 @@ func (h *Helm) Lint( // +optional args []string, ) (string, error) { - c := h.createContainer(directory) + c := h.createContainer(directory).WithMountedDirectory("./charts", h.dependencyUpdate(ctx, directory)) out, err := c.WithExec([]string{"sh", "-c", fmt.Sprintf("%s %s", "helm lint", strings.Join(args, " "))}).Stdout(ctx) if err != nil { return "", err @@ -196,6 +196,16 @@ func (h *Helm) Lint( return out, nil } +func (h *Helm) dependencyUpdate( + // method call context + ctx context.Context, + // directory that contains the Helm Chart + directory *dagger.Directory, +) (*dagger.Directory) { + c := h.createContainer(directory) + return c.WithExec([]string{"sh", "-c", "helm dep update"}).Directory("./charts") +} + func (h *Helm) createContainer( // directory that contains the Helm Chart directory *dagger.Directory, From a22306af165c3107a7317e9d03764ef999f220b1 Mon Sep 17 00:00:00 2001 From: Reto Galante Date: Wed, 18 Dec 2024 17:45:37 +0100 Subject: [PATCH 2/2] Create charts directory --- helm/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/main.go b/helm/main.go index 7104324..a2edc07 100644 --- a/helm/main.go +++ b/helm/main.go @@ -203,7 +203,7 @@ func (h *Helm) dependencyUpdate( directory *dagger.Directory, ) (*dagger.Directory) { c := h.createContainer(directory) - return c.WithExec([]string{"sh", "-c", "helm dep update"}).Directory("./charts") + return c.WithExec([]string{"sh", "-c", "mkdir charts && helm dep update"}).Directory("charts") } func (h *Helm) createContainer(