-
Notifications
You must be signed in to change notification settings - Fork 274
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
[FEATURE]: Enable the var
template key in template strings for variables
#2730
Comments
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product! |
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product! |
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product! |
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product! |
@thsig do we still want this? |
This is possible in the next release with #6745 |
Will be fully resolved in #6814 |
* feat: allow cross-referencing variables in the same scope Fixes #2730 * feat: allow variable cross-referencing in the project configuration Avoid resolving variables before creating the variable context; Otherwise variables cannot reference parent scope and their peers. * test: add basic test coverage in general and project-level vars * fix: display resolved variables in `garden get config` * fix: make sure that variables have access to full context We need to make sure variables have access to the entire surrounding context, but we also retain fine-grained control over precendence and cross-referencing. * fix: ensure that higher-precedence variables can refer to root context variables * test: adapt assertions in project resolve test * test: add test for action crossreferences * test: delete unused files * fix: allow access access to variables with unresolvable $merge when resolving built-in keys like dependencies early Add an `isFinalContext` flag to `VariablesContext`, encapsulating the behaviour we require where we have to allow access to variables despite a `$merge` operation on the same nesting level cannot be resolved. We only store resolved variables in `ResolveActionTask`, and rely on the nature of lazy evaluation to fail when we have to.
Feature Request
Currently, the
var
/variables
template key is not available when resolving template keys invariables
. So, for example, something like this is currently not possible:Supporting this would require us to resolve
var
references insidevariables
blocks in dependency order.Background / Motivation
Supporting this would enable users to further reduce repetition in their configs.
Suggested Implementation(s)
When resolving a variables block (e.g. for the project, or for an environment or module), construct a simple dependency graph of variable references (indexed by the variable key).
Then, resolve the variables in dependency order and incrementally populate the key/value pairs available under the
var
key and use them to resolve template strings further up the reference graph.There should also be circular dependency detection with informative error messages.
How important is this feature for you/your team?
🌹 It’s a nice to have, but nice things are nice 🙂
The text was updated successfully, but these errors were encountered: