Skip to content

Commit

Permalink
tiltfile: don't check enabled resources when loading failed (#5468)
Browse files Browse the repository at this point in the history
  • Loading branch information
landism authored Feb 8, 2022
1 parent 72e16c5 commit 12aeb98
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 2 additions & 5 deletions internal/tiltfile/tiltfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,9 @@ func (tfl tiltfileLoader) Load(ctx context.Context, tf *corev1alpha1.Tiltfile) T
tlr.UpdateSettings = us

configSettings, _ := config.GetState(result)
enabledManifests, err := configSettings.EnabledResources(tf, manifests)
if err != nil {
tlr.Error = err
return tlr
if tlr.Error == nil {
tlr.EnabledManifests, tlr.Error = configSettings.EnabledResources(tf, manifests)
}
tlr.EnabledManifests = enabledManifests

duration := time.Since(start)
if tlr.Error == nil {
Expand Down
15 changes: 14 additions & 1 deletion internal/tiltfile/tiltfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5929,6 +5929,15 @@ local_resource("test2", cmd="echo hi2", labels=["bar", "baz"])
f.assertNextManifest("test2", resourceLabels("bar", "baz"))
}

// https://github.com/tilt-dev/tilt/issues/5467
func TestLoadErrorWithArgs(t *testing.T) {
f := newFixture(t)
defer f.TearDown()

f.file("Tiltfile", "asdf")
f.loadArgsErrString([]string{"foo"}, "undefined: asdf")
}

type fixture struct {
ctx context.Context
out *bytes.Buffer
Expand Down Expand Up @@ -6155,8 +6164,12 @@ func (f *fixture) loadAssertWarnings(warnings ...string) {
}

func (f *fixture) loadErrString(msgs ...string) {
f.loadArgsErrString(nil, msgs...)
}

func (f *fixture) loadArgsErrString(args []string, msgs ...string) {
f.t.Helper()
tlr := f.newTiltfileLoader().Load(f.ctx, ctrltiltfile.MainTiltfile(f.JoinPath("Tiltfile"), nil))
tlr := f.newTiltfileLoader().Load(f.ctx, ctrltiltfile.MainTiltfile(f.JoinPath("Tiltfile"), args))
err := tlr.Error

if err == nil {
Expand Down

0 comments on commit 12aeb98

Please sign in to comment.