Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 134
Example to show how bundle variables work#21
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .databricks |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,65 @@ | ||||||||||||
| # bundle_variables | ||||||||||||
| Example to show how bundle variables work. | ||||||||||||
| We will focus on the behavior of the variables section alone. To do so, we exclusively use | ||||||||||||
| the `validate` command, and use its JSON output mode to focus on the variables section. | ||||||||||||
Comment on lines
+3
to
+6
| ||||||||||||
| Example to show how bundle variables work. | |
| We will focus on the behavior of the variables section alone. To do so, we exclusively use | |
| the `validate` command, and use its JSON output mode to focus on the variables section. | |
| This example shows how to validate and set values for the custom variables defined for a bundle using the `bundle validate` command and its JSON output mode. |
juliacrawf-dbFeb 15, 2024 •
edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
I think that is the main intent of this KB, but another sentence could also be added about showing how to set variable defaults. (Update: I tinkered with that suggestion.)
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.
Are there any prerequisites worth mentioning? It might be a good standard just to list the supported CLI version for any KB?
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.
This singular heading feels unnecessary and also doesn't seem like quite the right word. I'd either remove it (acceptable for a KB e.g., https://kb.databricks.com/en_US/clusters/calculate-number-of-cores) or break up the content into at least two headings. (I'd lean towards the former.)
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.
| Configure the workspace to use: | |
| First, configure your workspace: |
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.
| Try to run validate without arguments: | |
| Next, run `bundle validate` using the JSON output mode and `jq` to retrieve just the variables node. |
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.
I wasn't sure how this command was "without arguments" but maybe I'm misunderstanding the intent there. Also, I'm not sure if it's necessary to state that last bit as most devs know all about jq, but it feels most complete.
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.
| Because the configuration includes a variable definition without a value, it returns an error | |
| saying that the value must be defined: | |
| Because the configuration includes a variable definition without a value, it returns the following error: |
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.
| Assign a value for this variable by either: | |
| To assign a value to this variable, you can either: |
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.
| 1. Adding a `--var` flag to all bundle commands: | |
| - Add a `--var` flag to all bundle commands: |
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.
These aren't steps (numbered list) but a list of options (bulleted list). However, I like making it really clear (see the next comment)...
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.
Indent these to fit under the bullet.
juliacrawf-dbFeb 15, 2024 •
edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
| 2. Configuring an environment variable: | |
| OR | |
| - Configure an environment variable: |
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.
(But this might look weird, or not follow our style)
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.
Indent this to fit under the bullet.
juliacrawf-dbFeb 15, 2024 •
edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
| Now, try to run validate again, and observe that it passes: | |
| Nowrun validate again, and observe that it succeeds in outputting valid JSON: |
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.
| Example output: |
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.
| What we've seen: | |
| In summary: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| bundle: | ||
| name: bundle_variables | ||
| variables: | ||
| no_default: | ||
| description: This is a variable with no default value | ||
| with_default: | ||
| description: This is a variable with a default value | ||
| value: hello | ||
| with_default_in_targets: | ||
| description: This is a variable with its default value defined in the targets section | ||
| ||
| targets: | ||
| development: | ||
| default: true | ||
| variables: | ||
| with_default_in_targets: value_in_development | ||
| production: | ||
| variables: | ||
| with_default_in_targets: value_in_production | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
I think a real title would be nice. Given it's a KB topic, how about "How to validate bundle variables"? Or maybe that's not quite right... "How to validate and set variable values"?