Repository navigation
Include variable locations in --include-locations output #7351
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
Open
petrapostelnicu-db
wants to merge
3
commits into
main
Choose a base branch
from
variable-locations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Include variable declarations and the source of each resolved value in the `--include-locations` output of `bundle validate` and `bundle summary`. ([#7351](https://github.com/databricks/cli/pull/7351)) |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/variables/locations/.databricks/bundle/dev/variable-overrides.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "from_file": "file-value" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| !.databricks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| bundle: | ||
| name: variable_locations | ||
|
|
||
| include: | ||
| - variables/*.yml | ||
| - targets.yml | ||
|
|
||
| variables: | ||
| simple: | ||
| default: simple-default | ||
| from_cli: | ||
| description: Required, assigned with --var | ||
| from_env: | ||
| description: Required, assigned with BUNDLE_VAR_from_env | ||
| from_file: | ||
| description: Required, assigned in variable-overrides.json | ||
| complex_var: | ||
| type: complex | ||
| default: | ||
| key: value | ||
| var_in_var: | ||
| default: ${var.simple}-suffix | ||
| override_short: | ||
| default: base | ||
| override_full: | ||
| default: base | ||
| split: | ||
| description: Declared here, default in an included file | ||
| dash-name: | ||
| default: dash-default | ||
| lookup_overridden: | ||
| lookup: | ||
| service_principal: deco-test-spn | ||
|
|
||
| targets: | ||
| dev: | ||
| default: true | ||
| variables: | ||
| override_short: dev-short | ||
| override_full: | ||
| default: dev-full | ||
| complex_var: | ||
| key: dev-value | ||
| lookup_overridden: dev-instead-of-lookup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
|
|
||
| === Resolved variable values | ||
| >>> [CLI] bundle summary -o json --include-locations --var from_cli=cli-value | ||
| { | ||
| "complex_var": { | ||
| "key": "dev-value" | ||
| }, | ||
| "dash-name": "dash-default", | ||
| "from_cli": "cli-value", | ||
| "from_env": "env-value", | ||
| "from_file": "file-value", | ||
| "included": "dev-included", | ||
| "lookup_overridden": "dev-instead-of-lookup", | ||
| "override_full": "dev-full", | ||
| "override_short": "dev-short", | ||
| "simple": "simple-default", | ||
| "split": "split-default", | ||
| "var_in_var": "simple-default-suffix" | ||
| } | ||
|
|
||
| === Variable locations as file:line:column | ||
| >>> [CLI] bundle summary -o json --include-locations --var from_cli=cli-value | ||
| { | ||
| "variables": [ | ||
| "databricks.yml:9:3", | ||
| "variables/shared.yml:2:3" | ||
| ], | ||
| "variables.complex_var": [ | ||
| "databricks.yml:18:5" | ||
| ], | ||
| "variables.complex_var.value": [ | ||
| "databricks.yml:43:9" | ||
| ], | ||
| "variables.dash-name": [ | ||
| "databricks.yml:30:5" | ||
| ], | ||
| "variables.dash-name.value": [ | ||
| "databricks.yml:30:14" | ||
| ], | ||
| "variables.from_cli": [ | ||
| "databricks.yml:12:5" | ||
| ], | ||
| "variables.from_env": [ | ||
| "databricks.yml:14:5" | ||
| ], | ||
| "variables.from_file": [ | ||
| "databricks.yml:16:5" | ||
| ], | ||
| "variables.from_file.value": [ | ||
| ".databricks/bundle/dev/variable-overrides.json:2:28" | ||
| ], | ||
| "variables.included": [ | ||
| "variables/shared.yml:3:5" | ||
| ], | ||
| "variables.included.value": [ | ||
| "targets.yml:4:17" | ||
| ], | ||
| "variables.lookup_overridden": [ | ||
| "databricks.yml:32:5" | ||
| ], | ||
| "variables.lookup_overridden.value": [ | ||
| "databricks.yml:44:26" | ||
| ], | ||
| "variables.override_full": [ | ||
| "databricks.yml:26:5" | ||
| ], | ||
| "variables.override_full.value": [ | ||
| "databricks.yml:41:18" | ||
| ], | ||
| "variables.override_short": [ | ||
| "databricks.yml:24:5" | ||
| ], | ||
| "variables.override_short.value": [ | ||
| "databricks.yml:39:23" | ||
| ], | ||
| "variables.simple": [ | ||
| "databricks.yml:10:5" | ||
| ], | ||
| "variables.simple.value": [ | ||
| "databricks.yml:10:14" | ||
| ], | ||
| "variables.split": [ | ||
| "databricks.yml:28:5", | ||
| "variables/shared.yml:5:5" | ||
| ], | ||
| "variables.split.value": [ | ||
| "variables/shared.yml:5:14" | ||
| ], | ||
| "variables.var_in_var": [ | ||
| "databricks.yml:22:5" | ||
| ], | ||
| "variables.var_in_var.value": [ | ||
| "databricks.yml:22:14" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export BUNDLE_VAR_from_env=env-value | ||
|
|
||
| title "Resolved variable values" | ||
| trace $CLI bundle summary -o json --include-locations --var from_cli=cli-value | jq '.variables | map_values(.value)' | ||
|
|
||
| title "Variable locations as file:line:column" | ||
| trace $CLI bundle summary -o json --include-locations --var from_cli=cli-value | jq '.__locations as $l | $l.locations | with_entries(select(.key | startswith("variables"))) | map_values(map("\($l.files[.[0]]):\(.[1]):\(.[2])"))' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| targets: | ||
| dev: | ||
| variables: | ||
| included: dev-included |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| variables: | ||
| included: | ||
| default: included-default | ||
| split: | ||
| default: split-default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this get a
.nextchanges/bundles/entry? The last--include-locationschange (#7185) has one in the changelog, and the UI side will want to know which CLI version ships the variable keys.