tilt-dev / tilt-dev/tilt

Can't call load inside of an if statement in Tiltfile

Open
#3,524 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

Via k8s slack DM:

Hi, do you know smth about such error during tilt up ?
load statement within a conditional
I have a load inside if condition

I traced it to this issue and resulting commit from Starlark where they recently disallowed loads inside if statements and for statements.

There's at least one Tiltfile out there that depends on this behavior, and probably more. In fact our own Tiltfiles used to depend on this behavior when we had our internal services in microrepos with one Tilt repo to manage them. The Tiltfile would check to see which microrepos are cloned locally, and only if it was present in the expected location on disk would it then load that microrepo's Tiltfile. In fact: we still recommend this setup. We've since moved to a monorepo, but if any customers are using a similar set up their Tiltfiles would now be broken.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with how Tiltfile load statements are evaluated, then review the linked Starlark issue and resulting commit. Compare that behavior with the multiple-repository setup described in the issue and determine what compatibility is expected. Done means the documented conditional-load workflow no longer fails during tilt up.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.