Skip to content

Commit

Permalink
tiltfile: unknown resource_dep is a warning instead of error (#5488)
Browse files Browse the repository at this point in the history
  • Loading branch information
landism authored Feb 16, 2022
1 parent ecbf431 commit 93c726e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions internal/tiltfile/tiltfile_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ to your Tiltfile. Otherwise, switch k8s contexts and restart Tilt.`, kubeContext
manifests = append(manifests, yamlManifest)
}

err = validateResourceDependencies(manifests)
err = s.validateResourceDependencies(manifests)
if err != nil {
return nil, starkit.Model{}, err
}
Expand Down Expand Up @@ -1629,7 +1629,7 @@ func (s *tiltfileState) tempDir() (*fwatch.TempDir, error) {
return s.scratchDir, nil
}

func validateResourceDependencies(ms []model.Manifest) error {
func (s *tiltfileState) validateResourceDependencies(ms []model.Manifest) error {
// make sure that:
// 1. all deps exist
// 2. we have a DAG
Expand All @@ -1647,7 +1647,8 @@ func validateResourceDependencies(ms []model.Manifest) error {
return fmt.Errorf("resource %s specified a dependency on itself", m.Name)
}
if _, ok := knownResources[b]; !ok {
return fmt.Errorf("resource %s specified a dependency on unknown resource %s", m.Name, b)
logger.Get(s.ctx).Warnf("resource %s specified a dependency on unknown resource %s - dependency ignored", m.Name, b)
continue
}
edges[m.Name] = append(edges[m.Name], b)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tiltfile/tiltfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4878,7 +4878,7 @@ func TestDependsOnMissingResource(t *testing.T) {
local_resource('bar', 'echo bar', resource_deps=['foo'])
`)

f.loadErrString("resource bar specified a dependency on unknown resource fo")
f.loadAssertWarnings("resource bar specified a dependency on unknown resource foo - dependency ignored")
}

func TestDependsOnSelf(t *testing.T) {
Expand Down

0 comments on commit 93c726e

Please sign in to comment.