Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assure all dependencies are present before linting #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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", "mkdir charts && helm dep update"}).Directory("charts")
}

func (h *Helm) createContainer(
// directory that contains the Helm Chart
directory *dagger.Directory,
Expand Down
Loading