Skip to content

Commit

Permalink
tiltfile: record the helm dependency before running helm, to help ite…
Browse files Browse the repository at this point in the history
…rate on helm charts (#3729)
  • Loading branch information
nicks committed Aug 27, 2020
1 parent 79e500a commit 32bc2b4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/tiltfile/files.go
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
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

0 comments on commit 32bc2b4

Please sign in to comment.