databricks / cli

Databricks CLI
Other
132 stars 50 forks source link

Alias variables block in the `Target` struct #1748

Closed shreyas-goenka closed 2 weeks ago

shreyas-goenka commented 3 weeks ago

Changes

This PR aliases and overrides the schema associated with the variables block in target to allow for directly specifying a variable value in the JSON schema (without an levels of nesting). This is needed because this direct value is resolved by dynamically parsing the configuration tree. https://github.com/databricks/cli/blob/ca6332a5a4325aff1be848536f45d13bd74d93b3/bundle/config/root.go#L424

Tests

Existing unit tests.

shreyas-goenka commented 3 weeks ago

Is it worth the effort to deprecate this? At this point it seems easier to continue maintaining this and it likely costs more to deprecate this than to continue supporting it.

If we deprecate this:

  1. We'll need to show a warning when users use this pattern, and modify the documentation.
  2. Customers will need to manually modify these variable references in their code.
shreyas-goenka commented 3 weeks ago

@andrewnester Ah I see that we also support the override syntax for complex variables. That gets complex because of the inherent ambiguity of whether it's an override or the full definition. Maybe it makes sense to deprecate this for complex variables, but keep supporting it for primitive?

shreyas-goenka commented 3 weeks ago

Note: This PR builds on top of https://github.com/databricks/cli/pull/1700 and has to wait for it.