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

tiltfile: record the helm dependency before running helm, to help iterate on helm charts #3729

Merged
merged 1 commit into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/tiltfile/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func (s *tiltfileState) helm(thread *starlark.Thread, fn *starlark.Builtin, args
return nil, fmt.Errorf("helm() may only be called on directories with Chart.yaml: %q", localPath)
}

err = tiltfile_io.RecordReadPath(thread, tiltfile_io.WatchRecursive, localPath)
if err != nil {
return nil, err
}

deps, err := localSubchartDependenciesFromPath(localPath)
if err != nil {
return nil, err
Expand Down Expand Up @@ -220,11 +225,6 @@ func (s *tiltfileState) helm(thread *starlark.Thread, fn *starlark.Builtin, args
return nil, err
}

err = tiltfile_io.RecordReadPath(thread, tiltfile_io.WatchRecursive, localPath)
if err != nil {
return nil, err
}

yaml := filterHelmTestYAML(string(stdout))

if version == helmV3_0 {
Expand Down
19 changes: 19 additions & 0 deletions internal/tiltfile/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ import (
"github.com/tilt-dev/tilt/internal/tiltfile/testdata"
)

func TestHelmMalformedChart(t *testing.T) {
f := newFixture(t)
defer f.TearDown()

f.WriteFile("./helm/Chart.yaml", "brrrrr")

f.file("Tiltfile", `
yml = helm('helm')
k8s_yaml(yml)
`)

f.loadErrString("error unmarshaling JSON")
f.assertConfigFiles(
"Tiltfile",
".tiltignore",
"helm",
)
}

func TestHelmNamespace(t *testing.T) {
f := newFixture(t)
defer f.TearDown()
Expand Down