Skip to content

Commit

Permalink
Assure all dependencies are present before linting
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Dec 18, 2024
1 parent 12aa1da commit f98540b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion helm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit f98540b

Please sign in to comment.