diff --git a/internal/tiltfile/files.go b/internal/tiltfile/files.go index f37fe9558b..7d76856a8f 100644 --- a/internal/tiltfile/files.go +++ b/internal/tiltfile/files.go @@ -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 @@ -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 { diff --git a/internal/tiltfile/helm_test.go b/internal/tiltfile/helm_test.go index feb135408e..bbaa59cdda 100644 --- a/internal/tiltfile/helm_test.go +++ b/internal/tiltfile/helm_test.go @@ -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()