Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jazzdan opened this issue Jun 29, 2020 · 4 comments
Open

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

jazzdan opened this issue Jun 29, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@jazzdan
Copy link
Contributor

jazzdan commented Jun 29, 2020

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.

@jazzdan jazzdan added the bug Something isn't working label Jun 29, 2020
@nicks
Copy link
Member

nicks commented Jun 29, 2020

I think it's pretty clear allowing load() in an if block was a bug in Starlark-Go.

Starlark-Java doesn't allow this, and in fact, can't allow this, because it would break the ability to determine what files are loaded at parse-time (i.e., without executing the code)

We probably have to move forward with #3433 to resolve this, and recommend include() as the execution-time way to load code

@nicks
Copy link
Member

nicks commented Jun 29, 2020

@jazzdan do you have a sense of how urgent this is? a short-term fix is to fork starlark-go, rollback the fix for now, and then have a plan to move forward with a workaround

@jazzdan
Copy link
Contributor Author

jazzdan commented Jun 29, 2020

@nicks I don't have a sense yet, no. Following up with the user.

@jazzdan
Copy link
Contributor Author

jazzdan commented Jun 30, 2020

@nicks it's not blocking, they can work around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants