Is ${VAR:-default} substitution in task YAML still wanted, given envs: already supports defaults?
#10371
MitaliMSahoo
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi maintainers,
I was looking at
_fill_in_env_varsinsky/task.pyand noticed this commented-out line with a TODO above it:This looks like it was exploring bash-style default-value syntax (
${VAR:-default}) for env var substitution insidefile_mounts,service,workdir, andvolumesfields.Before I dig into implementing it, I wanted to check: is this still desired? From what I can tell, the current docs already cover the main motivating use case, setting a default directly in
envs:and letting users override it with--env:So
${VAR:-default}would mostly be a more compact/inline alternative to that, rather than solving something uncovered. Implementing it cleanly also has a real wrinkle:_fill_in_env_varsdoes substitution on the whole field afterjson.dumps, so a default value containing},", or\would need care to avoid corrupting the JSON round-trip beforejson.loads.A few questions:
1. Is there still appetite for this, or has the
envs:-defaultpattern made it redundant?2. If it's still wanted, is inline-only support acceptable (i.e., only
${VAR:-default}, not${VAR:-${OTHER}}recursively), or does it need to compose with the existing substitution?3. Any specific edge cases (e.g., defaults containing special chars) you'd want covered in tests if I pick this up?
Happy to send a PR if this is still valued, just want to avoid duplicating a mechanism you've already deliberately built a different way, thanks!
All reactions