-
Notifications
You must be signed in to change notification settings - Fork 234
bundle: add env var to set record_deployment_history in built-in templates #6220
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fdca90b
bundle: add env var to set record_deployment_history in built-in temp…
ilyakuz-db 47f5da9
Drop the disabled case and flatten the test dir
ilyakuz-db 3250df5
Trim template inputs to only the required properties
ilyakuz-db 0b3d04e
Drop the force-allow env var from the record-deployment-history test
ilyakuz-db 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
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/templates/record-deployment-history/input.dbt-sql.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 @@ | ||
| { | ||
| "project_name": "my_dbt_sql" | ||
| } |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/templates/record-deployment-history/input.default-python.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 @@ | ||
| { | ||
| "project_name": "my_default_python" | ||
| } |
4 changes: 4 additions & 0 deletions
4
acceptance/bundle/templates/record-deployment-history/input.default-scala.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,4 @@ | ||
| { | ||
| "project_name": "my_default_scala", | ||
| "artifacts_dest_path": "/Volumes/test-folder" | ||
| } |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/templates/record-deployment-history/input.default-sql.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 @@ | ||
| { | ||
| "project_name": "my_default_sql" | ||
| } |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/templates/record-deployment-history/input.lakeflow-integrations.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 @@ | ||
| { | ||
| "project_name": "my_lakeflow_integrations" | ||
| } |
49 changes: 49 additions & 0 deletions
49
acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml
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,49 @@ | ||
| # This is a Declarative Automation Bundle definition for my_default_python. | ||
| # See https://docs.databricks.com/dev-tools/bundles/index.html for documentation. | ||
| bundle: | ||
| name: my_default_python | ||
| uuid: [BUNDLE_UUID] | ||
|
|
||
| experimental: | ||
| record_deployment_history: true | ||
|
|
||
| include: | ||
| - resources/*.yml | ||
|
|
||
| artifacts: | ||
| python_artifact: | ||
| type: whl | ||
| build: uv build --wheel | ||
|
|
||
| # Variable declarations. These variables are assigned in the dev/prod targets below. | ||
| variables: | ||
| catalog: | ||
| description: The catalog to use | ||
| schema: | ||
| description: The schema to use | ||
|
|
||
| targets: | ||
| dev: | ||
| # The default target uses 'mode: development' to create a development copy. | ||
| # - Deployed resources get prefixed with '[dev my_user_name]' | ||
| # - Any job schedules and triggers are paused by default. | ||
| # See also https://docs.databricks.com/dev-tools/bundles/deployment-modes.html. | ||
| mode: development | ||
| default: true | ||
| workspace: | ||
| host: [DATABRICKS_URL] | ||
| variables: | ||
| catalog: hive_metastore | ||
| schema: ${workspace.current_user.short_name} | ||
| prod: | ||
| mode: production | ||
| workspace: | ||
| host: [DATABRICKS_URL] | ||
| # We explicitly deploy to /Workspace/Users/[USERNAME] to make sure we only have a single copy. | ||
| root_path: /Workspace/Users/[USERNAME]/.bundle/${bundle.name}/${bundle.target} | ||
| variables: | ||
| catalog: hive_metastore | ||
| schema: prod | ||
| permissions: | ||
| - user_name: [USERNAME] | ||
| level: CAN_MANAGE |
2 changes: 2 additions & 0 deletions
2
acceptance/bundle/templates/record-deployment-history/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
acceptance/bundle/templates/record-deployment-history/output.txt
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,70 @@ | ||
| Welcome to the default Python template for Declarative Automation Bundles! | ||
|
|
||
| Answer the following questions to customize your project. | ||
| You can always change your configuration in the databricks.yml file later. | ||
|
|
||
| Note that [DATABRICKS_URL] is used for initialization. | ||
| (For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.) | ||
|
|
||
| ✨ Your new project has been created in the 'my_default_python' directory! | ||
|
|
||
| To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. | ||
|
|
||
| >>> grep -A1 ^experimental: output/default-python/my_default_python/databricks.yml | ||
| experimental: | ||
| record_deployment_history: true | ||
|
|
||
| Welcome to the default SQL template for Declarative Automation Bundles! | ||
|
|
||
| A workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html. | ||
| workspace_host: [DATABRICKS_URL] | ||
|
|
||
| ✨ Your new project has been created in the 'my_default_sql' directory! | ||
|
|
||
| Please refer to the README.md file for "getting started" instructions. | ||
| See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. | ||
|
|
||
| >>> grep -A1 ^experimental: output/default-sql/my_default_sql/databricks.yml | ||
| experimental: | ||
| record_deployment_history: true | ||
|
|
||
| Welcome to the default-scala template for Declarative Automation Bundles! | ||
|
|
||
| A workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html. | ||
| workspace_host: [DATABRICKS_URL] | ||
|
|
||
| ✨ Your new project has been created in the 'my_default_scala' directory! | ||
|
|
||
| Please refer to the README.md file for "getting started" instructions. | ||
| See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. | ||
|
|
||
| >>> grep -A1 ^experimental: output/default-scala/my_default_scala/databricks.yml | ||
| experimental: | ||
| record_deployment_history: true | ||
|
|
||
| Welcome to the dbt template for Declarative Automation Bundles! | ||
|
|
||
| A workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html. | ||
| workspace_host: [DATABRICKS_URL] | ||
|
|
||
| 📊 Your new project has been created in the 'my_dbt_sql' directory! | ||
| If you already have dbt installed, just type 'cd my_dbt_sql; dbt init' to get started. | ||
| Refer to the README.md file for full "getting started" guide and production setup instructions. | ||
|
|
||
|
|
||
| >>> grep -A1 ^experimental: output/dbt-sql/my_dbt_sql/databricks.yml | ||
| experimental: | ||
| record_deployment_history: true | ||
| Welcome to the Lakeflow integrations template! | ||
|
|
||
|
|
||
| ✨ Your new project has been created in the 'my_lakeflow_integrations' directory! | ||
|
|
||
| Please refer to the README.md file for "getting started" instructions. | ||
|
|
||
| >>> grep -A1 ^experimental: output/lakeflow-integrations/my_lakeflow_integrations/databricks.yml | ||
| experimental: | ||
| record_deployment_history: true | ||
|
|
||
| >>> [CLI] bundle validate -o json | ||
| json.experimental.record_deployment_history = true; |
17 changes: 17 additions & 0 deletions
17
acceptance/bundle/templates/record-deployment-history/script
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,17 @@ | ||
| # The env var in test.toml opts every built-in template into recording deployment history. | ||
|
|
||
| # Leaving the generated projects behind would add their .gitignore files to this repo, see #2318. | ||
| trap 'rm -rf output' EXIT | ||
|
|
||
| for template in default-python default-sql default-scala dbt-sql lakeflow-integrations; do | ||
| $CLI bundle init "$template" --config-file "input.$template.json" --output-dir "output/$template" | ||
| trace grep -A1 '^experimental:' output/$template/*/databricks.yml | ||
| done | ||
|
|
||
| # Check that a generated project still loads and keeps the field through validation. | ||
| # This applies to the field rather than to the layout, so one template is enough. | ||
| (cd output/default-python/my_default_python && trace $CLI bundle validate -o json | gron.py | grep experimental) | ||
|
|
||
| # Keep one file in full to assert where the stanza lands in the document. | ||
| mv output/default-python/my_default_python/databricks.yml out.default-python.databricks.yml | ||
| add_repl.py "$(grep -o 'uuid: .*' out.default-python.databricks.yml | cut -d ' ' -f2)" BUNDLE_UUID |
4 changes: 4 additions & 0 deletions
4
acceptance/bundle/templates/record-deployment-history/test.toml
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 @@ | ||
| Env.DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY = "true" | ||
|
|
||
| # What is under test is what `bundle init` writes, so one engine is enough. | ||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] |
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
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,15 @@ | ||
| {{- /* | ||
| * Temporary opt-in for recording deployment history; remove once it is the default. | ||
| * | ||
| * The flag is passed in rather than read from the record_deployment_history helper here, | ||
| * because this shared library is parsed for every template, including by callers that | ||
| * register no helpers. | ||
| */ -}} | ||
|
|
||
| {{- define "experimental_record_deployment_history" -}} | ||
| {{- if .}} | ||
|
|
||
| experimental: | ||
| record_deployment_history: true | ||
| {{- end}} | ||
| {{- end}} |
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
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
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
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
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.
lets call it
DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY?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.
DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY sounds like a more generic name, which we may use for general enablement? I wanted to keep this specific variable only for templates
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.
Discussed in DM that we keep a separate var for init for now, and further decide if we want to migrate to generic var in the workspace