tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.69k stars 303 forks source link

version_settings constraints don't take precedence over undefined function errors #6015

Open mterwill opened 1 year ago

mterwill commented 1 year ago

Expected Behavior

When new top-level functions like ci_settings are added, if there is an unmet version_settings constraint, Tilt fails with that error rather than an "undefined" message.

Current Behavior

Tiltfile fails with, e.g. undefined: ci_settings.

Steps to Reproduce

Tiltfile:

version_settings(constraint = '>=0.31.1')
ci_settings(k8s_grace_period='30s')

Output:

$ tilt ci
Tilt started on http://localhost:10350/
v0.30.13, built 2022-12-05

Initial Build
Loading Tiltfile at: /private/tmp/tilt/Tiltfile
ERROR: /private/tmp/tilt/Tiltfile:2:1: undefined: ci_settings
Error: /private/tmp/tilt/Tiltfile:2:1: undefined: ci_settings

About Your Use Case

I want to be able to use the new ci_settings function in my Tiltfile. Engineers at my company should get a helpful error message to upgrade Tilt, rather than the above.

nicks commented 1 year ago

ahhh ya i thought we had a bug for this already but i can't find it right now.

Starlark treats undefined variables as syntax errors rather than as runtime errors. See: https://github.com/bazelbuild/starlark/blob/master/spec.md#name-binding-and-variables

so it's not really possible to fix this without pretty deep changes to the language itself (e.g., making a version_settings function that checks version at syntax-validation time)

mterwill commented 1 year ago

Bummer 😕 appreciate the quick response though!