From 322640c107e54bf031ddb876293dc8d3ea896e8d Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Wed, 4 Nov 2026 15:41:10 +0000 Subject: [PATCH 1/9] Use .workspace.URL for the host in built-in templates Built-in templates, except dbt-sql, write the workspace URL to workspace.host. It has ?w= when the profile or an environment variable sets the workspace ID. Other profiles keep the same host as before. The value is quoted so the YAML stays valid for any URL. Template schemas keep workspace_host. Co-authored-by: Isaac --- .../builtin-templates-workspace-url.md | 1 + .../strict_profile_match/host/databricks.yml | 6 ++ .../strict_profile_match/host/output.txt | 8 +++ .../bundle/strict_profile_match/host/script | 2 +- .../extra-workspace-input/input.json | 5 ++ .../extra-workspace-input/out.test.toml | 2 + .../extra-workspace-input/output.txt | 17 +++++ .../extra-workspace-input/script | 5 ++ .../default-minimal/profiles/input.json | 4 ++ .../default-minimal/profiles/out.test.toml | 2 + .../default-minimal/profiles/output.txt | 68 +++++++++++++++++++ .../templates/default-minimal/profiles/script | 33 +++++++++ .../default-minimal/profiles/test.toml | 2 + .../output/my_default_minimal/databricks.yml | 4 +- .../output/my_default_minimal/databricks.yml | 4 +- .../output/my_default_minimal/databricks.yml | 4 +- .../output/my_default_python/databricks.yml | 4 +- .../serverless-customcatalog/output.txt | 2 +- .../output/my_default_python/databricks.yml | 4 +- .../output/my_default_scala/databricks.yml | 6 +- .../output/my_default_sql/databricks.yml | 4 +- .../out.default-python.databricks.yml | 4 +- .../my_lakeflow_integrations/databricks.yml | 4 +- .../my_lakeflow_pipelines/databricks.yml | 4 +- .../my_lakeflow_pipelines/databricks.yml | 4 +- .../output/my_pydabs/databricks.yml | 4 +- .../default-python/out.databricks.yml | 4 +- .../telemetry/default-sql/out.databricks.yml | 4 +- .../output/lakeflow_project/databricks.yml | 4 +- .../output/my_python_project/databricks.yml | 4 +- .../sql/output/my_sql_project/databricks.yml | 4 +- libs/template/renderer_test.go | 5 ++ .../{{.project_name}}/databricks.yml.tmpl | 6 +- .../{{.project_name}}/databricks.yml.tmpl | 4 +- .../{{.project_name}}/databricks.yml.tmpl | 4 +- .../{{.project_name}}/databricks.yml.tmpl | 4 +- 36 files changed, 204 insertions(+), 46 deletions(-) create mode 100644 .nextchanges/bundles/builtin-templates-workspace-url.md create mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json create mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml create mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt create mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/script create mode 100644 acceptance/bundle/templates/default-minimal/profiles/input.json create mode 100644 acceptance/bundle/templates/default-minimal/profiles/out.test.toml create mode 100644 acceptance/bundle/templates/default-minimal/profiles/output.txt create mode 100644 acceptance/bundle/templates/default-minimal/profiles/script create mode 100644 acceptance/bundle/templates/default-minimal/profiles/test.toml diff --git a/.nextchanges/bundles/builtin-templates-workspace-url.md b/.nextchanges/bundles/builtin-templates-workspace-url.md new file mode 100644 index 00000000000..534ca9bd8c8 --- /dev/null +++ b/.nextchanges/bundles/builtin-templates-workspace-url.md @@ -0,0 +1 @@ +* Built-in templates (except `dbt-sql`) add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. ([#7350](https://github.com/databricks/cli/pull/7350)) diff --git a/acceptance/bundle/strict_profile_match/host/databricks.yml b/acceptance/bundle/strict_profile_match/host/databricks.yml index 5643f1b38c2..55cbbe1aae8 100644 --- a/acceptance/bundle/strict_profile_match/host/databricks.yml +++ b/acceptance/bundle/strict_profile_match/host/databricks.yml @@ -18,6 +18,12 @@ targets: custom_host: workspace: host: $CUSTOM_HOST/?o=$WORKSPACE_ID + classic_with_w: + workspace: + host: $CLASSIC_HOST?w=$WORKSPACE_ID + custom_host_with_w: + workspace: + host: $CUSTOM_HOST?w=$WORKSPACE_ID custom_host_workspace_id_field: workspace: host: $CUSTOM_HOST diff --git a/acceptance/bundle/strict_profile_match/host/output.txt b/acceptance/bundle/strict_profile_match/host/output.txt index 6c3dcbeefab..56cbb88faae 100644 --- a/acceptance/bundle/strict_profile_match/host/output.txt +++ b/acceptance/bundle/strict_profile_match/host/output.txt @@ -15,6 +15,14 @@ profile=workspace_custom_host host=[CUSTOM_HOST] workspace_id=[WORKSPACE_ID] >>> errcode [CLI] bundle run -t custom_host_workspace_id_field show_auth profile=workspace_custom_host host=[CUSTOM_HOST] workspace_id=[WORKSPACE_ID] +=== Target classic_with_w matches one profile +>>> errcode [CLI] bundle run -t classic_with_w show_auth +profile=workspace_classic_id host=[DATABRICKS_URL] workspace_id=[WORKSPACE_ID] + +=== Target custom_host_with_w matches one profile +>>> errcode [CLI] bundle run -t custom_host_with_w show_auth +profile=workspace_custom_host host=[CUSTOM_HOST] workspace_id=[WORKSPACE_ID] + === Target classic_other_workspace is rejected >>> errcode [CLI] bundle validate -t classic_other_workspace Error: cannot resolve bundle auth configuration: resolve: strict profile matching: no profile for host [DATABRICKS_URL] has workspace_id 2222222222. Config: host=[DATABRICKS_URL], workspace_id=2222222222, config_file=[TEST_TMP_DIR]/.databrickscfg, databricks_cli_path=[CLI]. Env: DATABRICKS_CONFIG_FILE, DATABRICKS_CLI_PATH diff --git a/acceptance/bundle/strict_profile_match/host/script b/acceptance/bundle/strict_profile_match/host/script index 1a5e32067eb..cac18599733 100644 --- a/acceptance/bundle/strict_profile_match/host/script +++ b/acceptance/bundle/strict_profile_match/host/script @@ -1,4 +1,4 @@ -for target in classic classic_with_workspace_id custom_host custom_host_workspace_id_field; do +for target in classic classic_with_workspace_id custom_host custom_host_workspace_id_field classic_with_w custom_host_with_w; do title "Target $target matches one profile" trace errcode $CLI bundle run -t $target show_auth done diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json b/acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json new file mode 100644 index 00000000000..0b2cdd03139 --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json @@ -0,0 +1,5 @@ +{ + "project_name": "my_default_minimal", + "language_choice": "python", + "workspace": "team-dev" +} diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml b/acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml new file mode 100644 index 00000000000..19b5b15d11f --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = [""] diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt b/acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt new file mode 100644 index 00000000000..dc72ad846ae --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt @@ -0,0 +1,17 @@ + +>>> [CLI] bundle init default-minimal --config-file ./input.json +Welcome to the minimal Declarative Automation Bundle template! + +This template creates a minimal project structure without sample code, ideal for advanced users. +(For getting started with Python or SQL code, use the default-python or default-sql templates instead.) + +Your workspace at [DATABRICKS_URL] is used for initialization. +(See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.) + +✨ Your new project has been created in the 'my_default_minimal' 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 host: my_default_minimal/databricks.yml + host: "[DATABRICKS_URL]" + host: "[DATABRICKS_URL]" diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/script b/acceptance/bundle/templates/default-minimal/extra-workspace-input/script new file mode 100644 index 00000000000..e01fbd1a2f6 --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/extra-workspace-input/script @@ -0,0 +1,5 @@ +# The template doesn't declare a workspace input, so the extra key is ignored +# and the template still gets the workspace context. +trace $CLI bundle init default-minimal --config-file ./input.json +trace grep 'host:' my_default_minimal/databricks.yml +rm -r my_default_minimal diff --git a/acceptance/bundle/templates/default-minimal/profiles/input.json b/acceptance/bundle/templates/default-minimal/profiles/input.json new file mode 100644 index 00000000000..c620c3159b5 --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/profiles/input.json @@ -0,0 +1,4 @@ +{ + "project_name": "my_default_minimal", + "language_choice": "python" +} diff --git a/acceptance/bundle/templates/default-minimal/profiles/out.test.toml b/acceptance/bundle/templates/default-minimal/profiles/out.test.toml new file mode 100644 index 00000000000..19b5b15d11f --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/profiles/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = [""] diff --git a/acceptance/bundle/templates/default-minimal/profiles/output.txt b/acceptance/bundle/templates/default-minimal/profiles/output.txt new file mode 100644 index 00000000000..0e6af63730a --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/profiles/output.txt @@ -0,0 +1,68 @@ + +=== Profile classic + +>>> [CLI] bundle init default-minimal --config-file ./input.json --profile classic +Welcome to the minimal Declarative Automation Bundle template! + +This template creates a minimal project structure without sample code, ideal for advanced users. +(For getting started with Python or SQL code, use the default-python or default-sql templates instead.) + +Your workspace at [DATABRICKS_URL] is used for initialization. +(See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.) + +✨ Your new project has been created in the 'my_default_minimal' 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 host: databricks.yml + host: "[DATABRICKS_URL]" + host: "[DATABRICKS_URL]" + +>>> DATABRICKS_BUNDLE_STRICT_PROFILE_MATCH=1 [CLI] bundle validate -t dev +Name: my_default_minimal +Target: dev +Workspace: + Host: [DATABRICKS_URL] + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/my_default_minimal/dev + +Validation OK! + +>>> [CLI] bundle deploy -t dev +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_default_minimal/dev/files... +Files: 10 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged + +=== Profile custom_host + +>>> [CLI] bundle init default-minimal --config-file ./input.json --profile custom_host +Welcome to the minimal Declarative Automation Bundle template! + +This template creates a minimal project structure without sample code, ideal for advanced users. +(For getting started with Python or SQL code, use the default-python or default-sql templates instead.) + +Your workspace at [CUSTOM_HOST] is used for initialization. +(See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.) + +✨ Your new project has been created in the 'my_default_minimal' 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 host: databricks.yml + host: "[CUSTOM_HOST]?w=[WORKSPACE_ID]" + host: "[CUSTOM_HOST]?w=[WORKSPACE_ID]" + +>>> DATABRICKS_BUNDLE_STRICT_PROFILE_MATCH=1 [CLI] bundle validate -t dev +Name: my_default_minimal +Target: dev +Workspace: + Host: [CUSTOM_HOST]?w=[WORKSPACE_ID] + User: [USERNAME] + Path: /Workspace/Users/[USERNAME]/.bundle/my_default_minimal/dev + +Validation OK! + +>>> [CLI] bundle deploy -t dev +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_default_minimal/dev/files... +Files: 10 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged diff --git a/acceptance/bundle/templates/default-minimal/profiles/script b/acceptance/bundle/templates/default-minimal/profiles/script new file mode 100644 index 00000000000..00a3795fdaf --- /dev/null +++ b/acceptance/bundle/templates/default-minimal/profiles/script @@ -0,0 +1,33 @@ +# The test server is reachable as both 127.0.0.1 and localhost. The second +# stands in for a host shared by several workspaces. +CUSTOM_HOST=${DATABRICKS_HOST/127.0.0.1/localhost} +add_repl "$CUSTOM_HOST" CUSTOM_HOST +WORKSPACE_ID=$(curl -s "$DATABRICKS_HOST/.well-known/databricks-config" | jq -r .workspace_id) + +# The classic profile has no workspace_id. The SDK resolves the ID from host +# metadata, but the generated host stays without ?w= so that it matches the +# profile in strict mode too. +cat > .databrickscfg < Date: Wed, 4 Nov 2026 16:47:59 +0000 Subject: [PATCH 2/9] Show .workspace.URL in the welcome messages of built-in templates The welcome messages showed workspace_host, which has no workspace ID. They now show the URL that the bundle uses, so they match workspace.host in the generated databricks.yml. Messages that printed "workspace_host:" now print "workspace_url:". Co-authored-by: Isaac --- acceptance/bundle/templates/dbt-sql-classic/output.txt | 2 +- acceptance/bundle/templates/dbt-sql/output.txt | 2 +- .../bundle/templates/default-minimal/profiles/output.txt | 2 +- .../bundle/templates/default-scala-classic/output.txt | 2 +- acceptance/bundle/templates/default-scala/output.txt | 2 +- .../bundle/templates/default-sql-catalog-dash/output.txt | 2 +- acceptance/bundle/templates/default-sql/output.txt | 2 +- acceptance/bundle/templates/deployment-history/output.txt | 6 +++--- acceptance/bundle/templates/telemetry/dbt-sql/output.txt | 2 +- .../bundle/templates/telemetry/default-sql/output.txt | 2 +- .../templates/dbt-sql/databricks_template_schema.json | 2 +- .../default-minimal/databricks_template_schema.json | 2 +- .../default-python/databricks_template_schema.json | 2 +- .../templates/default-scala/databricks_template_schema.json | 2 +- .../templates/default-sql/databricks_template_schema.json | 2 +- .../lakeflow-pipelines/databricks_template_schema.json | 2 +- .../templates/pydabs/databricks_template_schema.json | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/acceptance/bundle/templates/dbt-sql-classic/output.txt b/acceptance/bundle/templates/dbt-sql-classic/output.txt index 66c5cf492e0..9d9c3dd15e4 100644 --- a/acceptance/bundle/templates/dbt-sql-classic/output.txt +++ b/acceptance/bundle/templates/dbt-sql-classic/output.txt @@ -4,7 +4,7 @@ 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] +workspace_url: [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. diff --git a/acceptance/bundle/templates/dbt-sql/output.txt b/acceptance/bundle/templates/dbt-sql/output.txt index 8555f15292c..340d69955a2 100644 --- a/acceptance/bundle/templates/dbt-sql/output.txt +++ b/acceptance/bundle/templates/dbt-sql/output.txt @@ -4,7 +4,7 @@ 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] +workspace_url: [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. diff --git a/acceptance/bundle/templates/default-minimal/profiles/output.txt b/acceptance/bundle/templates/default-minimal/profiles/output.txt index 0e6af63730a..3bbc918ef62 100644 --- a/acceptance/bundle/templates/default-minimal/profiles/output.txt +++ b/acceptance/bundle/templates/default-minimal/profiles/output.txt @@ -41,7 +41,7 @@ Welcome to the minimal Declarative Automation Bundle template! This template creates a minimal project structure without sample code, ideal for advanced users. (For getting started with Python or SQL code, use the default-python or default-sql templates instead.) -Your workspace at [CUSTOM_HOST] is used for initialization. +Your workspace at [CUSTOM_HOST]?w=[WORKSPACE_ID] is used for initialization. (See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.) ✨ Your new project has been created in the 'my_default_minimal' directory! diff --git a/acceptance/bundle/templates/default-scala-classic/output.txt b/acceptance/bundle/templates/default-scala-classic/output.txt index 6ceb22ee71b..f6649f78380 100644 --- a/acceptance/bundle/templates/default-scala-classic/output.txt +++ b/acceptance/bundle/templates/default-scala-classic/output.txt @@ -4,7 +4,7 @@ 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_scala' directory! diff --git a/acceptance/bundle/templates/default-scala/output.txt b/acceptance/bundle/templates/default-scala/output.txt index 8a4f23f5a32..3d43242bc4e 100644 --- a/acceptance/bundle/templates/default-scala/output.txt +++ b/acceptance/bundle/templates/default-scala/output.txt @@ -4,7 +4,7 @@ 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_scala' directory! diff --git a/acceptance/bundle/templates/default-sql-catalog-dash/output.txt b/acceptance/bundle/templates/default-sql-catalog-dash/output.txt index 23a18c5d02c..85c1ebf6e27 100644 --- a/acceptance/bundle/templates/default-sql-catalog-dash/output.txt +++ b/acceptance/bundle/templates/default-sql-catalog-dash/output.txt @@ -4,7 +4,7 @@ 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! diff --git a/acceptance/bundle/templates/default-sql/output.txt b/acceptance/bundle/templates/default-sql/output.txt index 222e5d7e1e6..6dde88fb158 100644 --- a/acceptance/bundle/templates/default-sql/output.txt +++ b/acceptance/bundle/templates/default-sql/output.txt @@ -4,7 +4,7 @@ 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! diff --git a/acceptance/bundle/templates/deployment-history/output.txt b/acceptance/bundle/templates/deployment-history/output.txt index a6f06bdcb77..c9f9febde46 100644 --- a/acceptance/bundle/templates/deployment-history/output.txt +++ b/acceptance/bundle/templates/deployment-history/output.txt @@ -17,7 +17,7 @@ experimental: 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! @@ -31,7 +31,7 @@ experimental: 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_scala' directory! @@ -45,7 +45,7 @@ experimental: 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] +workspace_url: [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. diff --git a/acceptance/bundle/templates/telemetry/dbt-sql/output.txt b/acceptance/bundle/templates/telemetry/dbt-sql/output.txt index 74e0bac9312..606fd91719e 100644 --- a/acceptance/bundle/templates/telemetry/dbt-sql/output.txt +++ b/acceptance/bundle/templates/telemetry/dbt-sql/output.txt @@ -2,7 +2,7 @@ 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] +workspace_url: [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. diff --git a/acceptance/bundle/templates/telemetry/default-sql/output.txt b/acceptance/bundle/templates/telemetry/default-sql/output.txt index 775d86933af..67ebb78d0e9 100644 --- a/acceptance/bundle/templates/telemetry/default-sql/output.txt +++ b/acceptance/bundle/templates/telemetry/default-sql/output.txt @@ -2,7 +2,7 @@ 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] +workspace_url: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! diff --git a/libs/template/templates/dbt-sql/databricks_template_schema.json b/libs/template/templates/dbt-sql/databricks_template_schema.json index 17c93ca76e0..15cae9ae393 100644 --- a/libs/template/templates/dbt-sql/databricks_template_schema.json +++ b/libs/template/templates/dbt-sql/databricks_template_schema.json @@ -1,5 +1,5 @@ { - "welcome_message": "\nWelcome to the dbt template for Declarative Automation Bundles!\n\nA 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.\nworkspace_host: {{workspace_host}}", + "welcome_message": "\nWelcome to the dbt template for Declarative Automation Bundles!\n\nA 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.\nworkspace_url: {{.workspace.URL}}", "properties": { "project_name": { "type": "string", diff --git a/libs/template/templates/default-minimal/databricks_template_schema.json b/libs/template/templates/default-minimal/databricks_template_schema.json index 0935684256b..b8df334a017 100644 --- a/libs/template/templates/default-minimal/databricks_template_schema.json +++ b/libs/template/templates/default-minimal/databricks_template_schema.json @@ -1,6 +1,6 @@ { "template_dir": "../default", - "welcome_message": "Welcome to the minimal Declarative Automation Bundle template!\n\nThis template creates a minimal project structure without sample code, ideal for advanced users.\n(For getting started with Python or SQL code, use the default-python or default-sql templates instead.)\n\nYour workspace at {{workspace_host}} is used for initialization.\n(See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.)", + "welcome_message": "Welcome to the minimal Declarative Automation Bundle template!\n\nThis template creates a minimal project structure without sample code, ideal for advanced users.\n(For getting started with Python or SQL code, use the default-python or default-sql templates instead.)\n\nYour workspace at {{.workspace.URL}} is used for initialization.\n(See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.)", "properties": { "template_name": { "//": "This property is always set to 'default-minimal'", diff --git a/libs/template/templates/default-python/databricks_template_schema.json b/libs/template/templates/default-python/databricks_template_schema.json index d8d5e485ced..e9e61f4a924 100644 --- a/libs/template/templates/default-python/databricks_template_schema.json +++ b/libs/template/templates/default-python/databricks_template_schema.json @@ -1,6 +1,6 @@ { "template_dir": "../default", - "welcome_message": "Welcome to the default Python template for Declarative Automation Bundles!\n\nAnswer the following questions to customize your project.\nYou can always change your configuration in the databricks.yml file later.\n\nNote that {{workspace_host}} is used for initialization.\n(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)", + "welcome_message": "Welcome to the default Python template for Declarative Automation Bundles!\n\nAnswer the following questions to customize your project.\nYou can always change your configuration in the databricks.yml file later.\n\nNote that {{.workspace.URL}} is used for initialization.\n(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)", "properties": { "template_name": { "//": "This property is always set to 'default-python'", diff --git a/libs/template/templates/default-scala/databricks_template_schema.json b/libs/template/templates/default-scala/databricks_template_schema.json index 9501c56196d..2a9e5cc72a4 100644 --- a/libs/template/templates/default-scala/databricks_template_schema.json +++ b/libs/template/templates/default-scala/databricks_template_schema.json @@ -1,5 +1,5 @@ { - "welcome_message": "\nWelcome to the default-scala template for Declarative Automation Bundles!\n\nA 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.\nworkspace_host: {{workspace_host}}", + "welcome_message": "\nWelcome to the default-scala template for Declarative Automation Bundles!\n\nA 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.\nworkspace_url: {{.workspace.URL}}", "properties": { "project_name": { "type": "string", diff --git a/libs/template/templates/default-sql/databricks_template_schema.json b/libs/template/templates/default-sql/databricks_template_schema.json index c6f66d495a8..2fc7e31ec15 100644 --- a/libs/template/templates/default-sql/databricks_template_schema.json +++ b/libs/template/templates/default-sql/databricks_template_schema.json @@ -1,5 +1,5 @@ { - "welcome_message": "\nWelcome to the default SQL template for Declarative Automation Bundles!\n\nA 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.\nworkspace_host: {{workspace_host}}", + "welcome_message": "\nWelcome to the default SQL template for Declarative Automation Bundles!\n\nA 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.\nworkspace_url: {{.workspace.URL}}", "properties": { "project_name": { "type": "string", diff --git a/libs/template/templates/lakeflow-pipelines/databricks_template_schema.json b/libs/template/templates/lakeflow-pipelines/databricks_template_schema.json index 8639acc49e9..ddd17278829 100644 --- a/libs/template/templates/lakeflow-pipelines/databricks_template_schema.json +++ b/libs/template/templates/lakeflow-pipelines/databricks_template_schema.json @@ -1,6 +1,6 @@ { "template_dir": "../default", - "welcome_message": "Welcome to the template for Lakeflow Spark Declarative Pipelines!\n\nPlease answer the below to tailor your project to your preferences.\nYou can always change your mind and change your configuration in the databricks.yml file later.\n\nNote that {{workspace_host}} is used for initialization\n(see https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile).", + "welcome_message": "Welcome to the template for Lakeflow Spark Declarative Pipelines!\n\nPlease answer the below to tailor your project to your preferences.\nYou can always change your mind and change your configuration in the databricks.yml file later.\n\nNote that {{.workspace.URL}} is used for initialization\n(see https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile).", "properties": { "template_name": { "//": "This property is always set to 'lakeflow-pipelines'", diff --git a/libs/template/templates/pydabs/databricks_template_schema.json b/libs/template/templates/pydabs/databricks_template_schema.json index 4819b5bb773..d53f8ba85cc 100644 --- a/libs/template/templates/pydabs/databricks_template_schema.json +++ b/libs/template/templates/pydabs/databricks_template_schema.json @@ -1,6 +1,6 @@ { "template_dir": "../default", - "welcome_message": "Welcome to PyDABs template for Declarative Automation Bundles!\n\nAnswer the following questions to customize your project.\nYou can always change your configuration in the databricks.yml file later.\n\nNote that {{workspace_host}} is used for initialization.\n(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)", + "welcome_message": "Welcome to PyDABs template for Declarative Automation Bundles!\n\nAnswer the following questions to customize your project.\nYou can always change your configuration in the databricks.yml file later.\n\nNote that {{.workspace.URL}} is used for initialization.\n(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.)", "properties": { "template_name": { "//": "This property is always set to 'PyDABs'", From cabcf65cf57a3d68702e074d28e3280afae52b96 Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Wed, 4 Nov 2026 16:55:41 +0000 Subject: [PATCH 3/9] Use .workspace in the dbt-sql template The bundle host now comes from .workspace.URL like in the other built-in templates. dbt jobs get their host from Databricks, so they are not affected. The dbt profile default uses .workspace.Hostname, which gives the same value as stripping the scheme from workspace_host. No built-in template uses workspace_host now. Co-authored-by: Isaac --- .nextchanges/bundles/builtin-templates-workspace-url.md | 2 +- .../bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml | 4 ++-- .../bundle/templates/telemetry/dbt-sql/out.databricks.yml | 4 ++-- .../dbt-sql/template/{{.project_name}}/databricks.yml.tmpl | 4 ++-- .../template/{{.project_name}}/profile_template.yml.tmpl | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.nextchanges/bundles/builtin-templates-workspace-url.md b/.nextchanges/bundles/builtin-templates-workspace-url.md index 534ca9bd8c8..230f2be6513 100644 --- a/.nextchanges/bundles/builtin-templates-workspace-url.md +++ b/.nextchanges/bundles/builtin-templates-workspace-url.md @@ -1 +1 @@ -* Built-in templates (except `dbt-sql`) add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. ([#7350](https://github.com/databricks/cli/pull/7350)) +* Built-in templates add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. Their welcome messages show the same URL. ([#7350](https://github.com/databricks/cli/pull/7350)) diff --git a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml index 5f2a8cd93b0..8e4aabcebb3 100644 --- a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml +++ b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml @@ -19,12 +19,12 @@ targets: mode: development default: true workspace: - host: [DATABRICKS_URL] + host: "[DATABRICKS_URL]" prod: mode: production workspace: - host: [DATABRICKS_URL] + 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} permissions: diff --git a/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml b/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml index d4e7a980b0b..a4c3028ffa4 100644 --- a/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml +++ b/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml @@ -19,12 +19,12 @@ targets: mode: development default: true workspace: - host: [DATABRICKS_URL] + host: "[DATABRICKS_URL]" prod: mode: production workspace: - host: [DATABRICKS_URL] + 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} permissions: diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl index 21c82234a83..fd41553f4ad 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl @@ -20,12 +20,12 @@ targets: mode: development default: true workspace: - host: {{workspace_host}} + host: "{{.workspace.URL}}" prod: mode: production workspace: - host: {{workspace_host}} + host: "{{.workspace.URL}}" # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} permissions: diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl index 1bab573f2fa..57e56e2d27b 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl @@ -5,7 +5,7 @@ fixed: type: databricks prompts: host: - default: {{(regexp "^https?://").ReplaceAllString workspace_host ""}} + default: {{.workspace.Hostname}} token: hint: 'personal access token to use, dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' hide_input: true From 4710000dc3ad96b5e3510960ff4f4bc8bab47329 Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Wed, 4 Nov 2026 17:18:13 +0000 Subject: [PATCH 4/9] Update dbt-sql output for .workspace.Hostname without the port The dbt profile default no longer has the port of the test server. Databricks hosts don't have an explicit port, so for them the default is the same as before. Co-authored-by: Isaac --- .../templates/dbt-sql/output/my_dbt_sql/profile_template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml index bdb41ab202e..49b872b6d55 100644 --- a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml +++ b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml @@ -5,7 +5,7 @@ fixed: type: databricks prompts: host: - default: [DATABRICKS_HOST] + default: 127.0.0.1 token: hint: 'personal access token to use, dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' hide_input: true From bb816f442e893e5f198f151c4b9f8eb652aaa81f Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Thu, 5 Nov 2026 09:17:02 +0000 Subject: [PATCH 5/9] Keep workspace_host in the dbt-sql template dbt-sql keeps workspace_host for its bundle host and its dbt profile default until we check that dbt accepts the new host format. This reverts 78cc12216 and c6c9291d8. Its welcome message still shows .workspace.URL like the other built-in templates. Co-authored-by: Isaac --- .nextchanges/bundles/builtin-templates-workspace-url.md | 2 +- .../bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml | 4 ++-- .../templates/dbt-sql/output/my_dbt_sql/profile_template.yml | 2 +- .../bundle/templates/telemetry/dbt-sql/out.databricks.yml | 4 ++-- .../dbt-sql/template/{{.project_name}}/databricks.yml.tmpl | 4 ++-- .../template/{{.project_name}}/profile_template.yml.tmpl | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.nextchanges/bundles/builtin-templates-workspace-url.md b/.nextchanges/bundles/builtin-templates-workspace-url.md index 230f2be6513..cb97fad3984 100644 --- a/.nextchanges/bundles/builtin-templates-workspace-url.md +++ b/.nextchanges/bundles/builtin-templates-workspace-url.md @@ -1 +1 @@ -* Built-in templates add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. Their welcome messages show the same URL. ([#7350](https://github.com/databricks/cli/pull/7350)) +* Built-in templates (except `dbt-sql`) add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. Welcome messages of all built-in templates show the workspace URL. ([#7350](https://github.com/databricks/cli/pull/7350)) diff --git a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml index 8e4aabcebb3..5f2a8cd93b0 100644 --- a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml +++ b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/databricks.yml @@ -19,12 +19,12 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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} permissions: diff --git a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml index 49b872b6d55..bdb41ab202e 100644 --- a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml +++ b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml @@ -5,7 +5,7 @@ fixed: type: databricks prompts: host: - default: 127.0.0.1 + default: [DATABRICKS_HOST] token: hint: 'personal access token to use, dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' hide_input: true diff --git a/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml b/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml index a4c3028ffa4..d4e7a980b0b 100644 --- a/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml +++ b/acceptance/bundle/templates/telemetry/dbt-sql/out.databricks.yml @@ -19,12 +19,12 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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} permissions: diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl index fd41553f4ad..21c82234a83 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl @@ -20,12 +20,12 @@ targets: mode: development default: true workspace: - host: "{{.workspace.URL}}" + host: {{workspace_host}} prod: mode: production workspace: - host: "{{.workspace.URL}}" + host: {{workspace_host}} # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} permissions: diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl index 57e56e2d27b..1bab573f2fa 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl @@ -5,7 +5,7 @@ fixed: type: databricks prompts: host: - default: {{.workspace.Hostname}} + default: {{(regexp "^https?://").ReplaceAllString workspace_host ""}} token: hint: 'personal access token to use, dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' hide_input: true From 8e9774eb4d11fb6a43123bd971018102f844d4f7 Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Thu, 5 Nov 2026 09:26:28 +0000 Subject: [PATCH 6/9] Drop changes the built-in template migration doesn't need The host is no longer quoted. A URL with ?w= is a valid plain YAML value, and the quotes were only needed for test outputs, which no longer have ?w=. Welcome messages keep their "workspace_host:" label. The ?w= targets in strict_profile_match/host and the extra-workspace-input test are removed: the profiles test and the input tests in templates-machinery cover the same cases. Template outputs are now the same as before for auth without a workspace ID. Co-authored-by: Isaac --- .../strict_profile_match/host/databricks.yml | 6 ------ .../bundle/strict_profile_match/host/output.txt | 8 -------- .../bundle/strict_profile_match/host/script | 2 +- .../bundle/templates/dbt-sql-classic/output.txt | 2 +- acceptance/bundle/templates/dbt-sql/output.txt | 2 +- .../extra-workspace-input/input.json | 5 ----- .../extra-workspace-input/out.test.toml | 2 -- .../extra-workspace-input/output.txt | 17 ----------------- .../extra-workspace-input/script | 5 ----- .../default-minimal/profiles/output.txt | 8 ++++---- .../output/my_default_minimal/databricks.yml | 4 ++-- .../output/my_default_minimal/databricks.yml | 4 ++-- .../output/my_default_minimal/databricks.yml | 4 ++-- .../output/my_default_python/databricks.yml | 4 ++-- .../serverless-customcatalog/output.txt | 2 +- .../output/my_default_python/databricks.yml | 4 ++-- .../templates/default-scala-classic/output.txt | 2 +- .../bundle/templates/default-scala/output.txt | 2 +- .../output/my_default_scala/databricks.yml | 6 +++--- .../default-sql-catalog-dash/output.txt | 2 +- .../bundle/templates/default-sql/output.txt | 2 +- .../output/my_default_sql/databricks.yml | 4 ++-- .../out.default-python.databricks.yml | 4 ++-- .../templates/deployment-history/output.txt | 6 +++--- .../my_lakeflow_integrations/databricks.yml | 4 ++-- .../output/my_lakeflow_pipelines/databricks.yml | 4 ++-- .../output/my_lakeflow_pipelines/databricks.yml | 4 ++-- .../output/my_pydabs/databricks.yml | 4 ++-- .../templates/telemetry/dbt-sql/output.txt | 2 +- .../telemetry/default-python/out.databricks.yml | 4 ++-- .../telemetry/default-sql/out.databricks.yml | 4 ++-- .../templates/telemetry/default-sql/output.txt | 2 +- .../e2e/output/lakeflow_project/databricks.yml | 4 ++-- .../output/my_python_project/databricks.yml | 4 ++-- .../sql/output/my_sql_project/databricks.yml | 4 ++-- .../dbt-sql/databricks_template_schema.json | 2 +- .../databricks_template_schema.json | 2 +- .../{{.project_name}}/databricks.yml.tmpl | 6 +++--- .../default-sql/databricks_template_schema.json | 2 +- .../{{.project_name}}/databricks.yml.tmpl | 4 ++-- .../{{.project_name}}/databricks.yml.tmpl | 4 ++-- .../{{.project_name}}/databricks.yml.tmpl | 4 ++-- 42 files changed, 64 insertions(+), 107 deletions(-) delete mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json delete mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml delete mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt delete mode 100644 acceptance/bundle/templates/default-minimal/extra-workspace-input/script diff --git a/acceptance/bundle/strict_profile_match/host/databricks.yml b/acceptance/bundle/strict_profile_match/host/databricks.yml index 55cbbe1aae8..5643f1b38c2 100644 --- a/acceptance/bundle/strict_profile_match/host/databricks.yml +++ b/acceptance/bundle/strict_profile_match/host/databricks.yml @@ -18,12 +18,6 @@ targets: custom_host: workspace: host: $CUSTOM_HOST/?o=$WORKSPACE_ID - classic_with_w: - workspace: - host: $CLASSIC_HOST?w=$WORKSPACE_ID - custom_host_with_w: - workspace: - host: $CUSTOM_HOST?w=$WORKSPACE_ID custom_host_workspace_id_field: workspace: host: $CUSTOM_HOST diff --git a/acceptance/bundle/strict_profile_match/host/output.txt b/acceptance/bundle/strict_profile_match/host/output.txt index 56cbb88faae..6c3dcbeefab 100644 --- a/acceptance/bundle/strict_profile_match/host/output.txt +++ b/acceptance/bundle/strict_profile_match/host/output.txt @@ -15,14 +15,6 @@ profile=workspace_custom_host host=[CUSTOM_HOST] workspace_id=[WORKSPACE_ID] >>> errcode [CLI] bundle run -t custom_host_workspace_id_field show_auth profile=workspace_custom_host host=[CUSTOM_HOST] workspace_id=[WORKSPACE_ID] -=== Target classic_with_w matches one profile ->>> errcode [CLI] bundle run -t classic_with_w show_auth -profile=workspace_classic_id host=[DATABRICKS_URL] workspace_id=[WORKSPACE_ID] - -=== Target custom_host_with_w matches one profile ->>> errcode [CLI] bundle run -t custom_host_with_w show_auth -profile=workspace_custom_host host=[CUSTOM_HOST] workspace_id=[WORKSPACE_ID] - === Target classic_other_workspace is rejected >>> errcode [CLI] bundle validate -t classic_other_workspace Error: cannot resolve bundle auth configuration: resolve: strict profile matching: no profile for host [DATABRICKS_URL] has workspace_id 2222222222. Config: host=[DATABRICKS_URL], workspace_id=2222222222, config_file=[TEST_TMP_DIR]/.databrickscfg, databricks_cli_path=[CLI]. Env: DATABRICKS_CONFIG_FILE, DATABRICKS_CLI_PATH diff --git a/acceptance/bundle/strict_profile_match/host/script b/acceptance/bundle/strict_profile_match/host/script index cac18599733..1a5e32067eb 100644 --- a/acceptance/bundle/strict_profile_match/host/script +++ b/acceptance/bundle/strict_profile_match/host/script @@ -1,4 +1,4 @@ -for target in classic classic_with_workspace_id custom_host custom_host_workspace_id_field classic_with_w custom_host_with_w; do +for target in classic classic_with_workspace_id custom_host custom_host_workspace_id_field; do title "Target $target matches one profile" trace errcode $CLI bundle run -t $target show_auth done diff --git a/acceptance/bundle/templates/dbt-sql-classic/output.txt b/acceptance/bundle/templates/dbt-sql-classic/output.txt index 9d9c3dd15e4..66c5cf492e0 100644 --- a/acceptance/bundle/templates/dbt-sql-classic/output.txt +++ b/acceptance/bundle/templates/dbt-sql-classic/output.txt @@ -4,7 +4,7 @@ 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_url: [DATABRICKS_URL] +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. diff --git a/acceptance/bundle/templates/dbt-sql/output.txt b/acceptance/bundle/templates/dbt-sql/output.txt index 340d69955a2..8555f15292c 100644 --- a/acceptance/bundle/templates/dbt-sql/output.txt +++ b/acceptance/bundle/templates/dbt-sql/output.txt @@ -4,7 +4,7 @@ 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_url: [DATABRICKS_URL] +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. diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json b/acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json deleted file mode 100644 index 0b2cdd03139..00000000000 --- a/acceptance/bundle/templates/default-minimal/extra-workspace-input/input.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "project_name": "my_default_minimal", - "language_choice": "python", - "workspace": "team-dev" -} diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml b/acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml deleted file mode 100644 index 19b5b15d11f..00000000000 --- a/acceptance/bundle/templates/default-minimal/extra-workspace-input/out.test.toml +++ /dev/null @@ -1,2 +0,0 @@ -Cloud = false -EnvMatrix.DMS = [""] diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt b/acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt deleted file mode 100644 index dc72ad846ae..00000000000 --- a/acceptance/bundle/templates/default-minimal/extra-workspace-input/output.txt +++ /dev/null @@ -1,17 +0,0 @@ - ->>> [CLI] bundle init default-minimal --config-file ./input.json -Welcome to the minimal Declarative Automation Bundle template! - -This template creates a minimal project structure without sample code, ideal for advanced users. -(For getting started with Python or SQL code, use the default-python or default-sql templates instead.) - -Your workspace at [DATABRICKS_URL] is used for initialization. -(See https://docs.databricks.com/dev-tools/cli/profiles.html for how to change your profile.) - -✨ Your new project has been created in the 'my_default_minimal' 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 host: my_default_minimal/databricks.yml - host: "[DATABRICKS_URL]" - host: "[DATABRICKS_URL]" diff --git a/acceptance/bundle/templates/default-minimal/extra-workspace-input/script b/acceptance/bundle/templates/default-minimal/extra-workspace-input/script deleted file mode 100644 index e01fbd1a2f6..00000000000 --- a/acceptance/bundle/templates/default-minimal/extra-workspace-input/script +++ /dev/null @@ -1,5 +0,0 @@ -# The template doesn't declare a workspace input, so the extra key is ignored -# and the template still gets the workspace context. -trace $CLI bundle init default-minimal --config-file ./input.json -trace grep 'host:' my_default_minimal/databricks.yml -rm -r my_default_minimal diff --git a/acceptance/bundle/templates/default-minimal/profiles/output.txt b/acceptance/bundle/templates/default-minimal/profiles/output.txt index 3bbc918ef62..1c2849442ae 100644 --- a/acceptance/bundle/templates/default-minimal/profiles/output.txt +++ b/acceptance/bundle/templates/default-minimal/profiles/output.txt @@ -15,8 +15,8 @@ Your workspace at [DATABRICKS_URL] is used for initialization. To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. >>> grep host: databricks.yml - host: "[DATABRICKS_URL]" - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] + host: [DATABRICKS_URL] >>> DATABRICKS_BUNDLE_STRICT_PROFILE_MATCH=1 [CLI] bundle validate -t dev Name: my_default_minimal @@ -49,8 +49,8 @@ Your workspace at [CUSTOM_HOST]?w=[WORKSPACE_ID] is used for initialization. To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. >>> grep host: databricks.yml - host: "[CUSTOM_HOST]?w=[WORKSPACE_ID]" - host: "[CUSTOM_HOST]?w=[WORKSPACE_ID]" + host: [CUSTOM_HOST]?w=[WORKSPACE_ID] + host: [CUSTOM_HOST]?w=[WORKSPACE_ID] >>> DATABRICKS_BUNDLE_STRICT_PROFILE_MATCH=1 [CLI] bundle validate -t dev Name: my_default_minimal diff --git a/acceptance/bundle/templates/default-minimal/python/output/my_default_minimal/databricks.yml b/acceptance/bundle/templates/default-minimal/python/output/my_default_minimal/databricks.yml index 7a4c3fb8ba2..ec72bde8b31 100644 --- a/acceptance/bundle/templates/default-minimal/python/output/my_default_minimal/databricks.yml +++ b/acceptance/bundle/templates/default-minimal/python/output/my_default_minimal/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/default-minimal/skip/output/my_default_minimal/databricks.yml b/acceptance/bundle/templates/default-minimal/skip/output/my_default_minimal/databricks.yml index 7a4c3fb8ba2..ec72bde8b31 100644 --- a/acceptance/bundle/templates/default-minimal/skip/output/my_default_minimal/databricks.yml +++ b/acceptance/bundle/templates/default-minimal/skip/output/my_default_minimal/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/default-minimal/sql/output/my_default_minimal/databricks.yml b/acceptance/bundle/templates/default-minimal/sql/output/my_default_minimal/databricks.yml index 7a4c3fb8ba2..ec72bde8b31 100644 --- a/acceptance/bundle/templates/default-minimal/sql/output/my_default_minimal/databricks.yml +++ b/acceptance/bundle/templates/default-minimal/sql/output/my_default_minimal/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/default-python/classic/output/my_default_python/databricks.yml b/acceptance/bundle/templates/default-python/classic/output/my_default_python/databricks.yml index 78dfa622a77..d5abd8c8fa4 100644 --- a/acceptance/bundle/templates/default-python/classic/output/my_default_python/databricks.yml +++ b/acceptance/bundle/templates/default-python/classic/output/my_default_python/databricks.yml @@ -28,7 +28,7 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} @@ -37,7 +37,7 @@ targets: prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/default-python/serverless-customcatalog/output.txt b/acceptance/bundle/templates/default-python/serverless-customcatalog/output.txt index a33b555196a..3fe9b24b805 100644 --- a/acceptance/bundle/templates/default-python/serverless-customcatalog/output.txt +++ b/acceptance/bundle/templates/default-python/serverless-customcatalog/output.txt @@ -16,7 +16,7 @@ To get started, refer to the project README.md file and the documentation at htt --- [TESTROOT]/bundle/templates/default-python/serverless-customcatalog/../serverless/output/my_default_python/databricks.yml +++ output/my_default_python/databricks.yml @@ -31,5 +31,5 @@ - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: - catalog: hive_metastore + catalog: customcatalog diff --git a/acceptance/bundle/templates/default-python/serverless/output/my_default_python/databricks.yml b/acceptance/bundle/templates/default-python/serverless/output/my_default_python/databricks.yml index 25ecf7c58fc..b8ad3140314 100644 --- a/acceptance/bundle/templates/default-python/serverless/output/my_default_python/databricks.yml +++ b/acceptance/bundle/templates/default-python/serverless/output/my_default_python/databricks.yml @@ -28,14 +28,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/default-scala-classic/output.txt b/acceptance/bundle/templates/default-scala-classic/output.txt index f6649f78380..6ceb22ee71b 100644 --- a/acceptance/bundle/templates/default-scala-classic/output.txt +++ b/acceptance/bundle/templates/default-scala-classic/output.txt @@ -4,7 +4,7 @@ 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_scala' directory! diff --git a/acceptance/bundle/templates/default-scala/output.txt b/acceptance/bundle/templates/default-scala/output.txt index 3d43242bc4e..8a4f23f5a32 100644 --- a/acceptance/bundle/templates/default-scala/output.txt +++ b/acceptance/bundle/templates/default-scala/output.txt @@ -4,7 +4,7 @@ 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_scala' directory! diff --git a/acceptance/bundle/templates/default-scala/output/my_default_scala/databricks.yml b/acceptance/bundle/templates/default-scala/output/my_default_scala/databricks.yml index 4cde008ef58..9c979f25424 100644 --- a/acceptance/bundle/templates/default-scala/output/my_default_scala/databricks.yml +++ b/acceptance/bundle/templates/default-scala/output/my_default_scala/databricks.yml @@ -14,7 +14,7 @@ variables: description: The schema to use workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] artifact_path: /Volumes/test-folder/${bundle.name}/${bundle.target}/${workspace.current_user.short_name} artifacts: @@ -34,7 +34,7 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: main schema: ${workspace.current_user.short_name} @@ -42,7 +42,7 @@ targets: prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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} permissions: diff --git a/acceptance/bundle/templates/default-sql-catalog-dash/output.txt b/acceptance/bundle/templates/default-sql-catalog-dash/output.txt index 85c1ebf6e27..23a18c5d02c 100644 --- a/acceptance/bundle/templates/default-sql-catalog-dash/output.txt +++ b/acceptance/bundle/templates/default-sql-catalog-dash/output.txt @@ -4,7 +4,7 @@ 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! diff --git a/acceptance/bundle/templates/default-sql/output.txt b/acceptance/bundle/templates/default-sql/output.txt index 6dde88fb158..222e5d7e1e6 100644 --- a/acceptance/bundle/templates/default-sql/output.txt +++ b/acceptance/bundle/templates/default-sql/output.txt @@ -4,7 +4,7 @@ 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! diff --git a/acceptance/bundle/templates/default-sql/output/my_default_sql/databricks.yml b/acceptance/bundle/templates/default-sql/output/my_default_sql/databricks.yml index d4fb2b9b9f4..965975a424a 100644 --- a/acceptance/bundle/templates/default-sql/output/my_default_sql/databricks.yml +++ b/acceptance/bundle/templates/default-sql/output/my_default_sql/databricks.yml @@ -25,7 +25,7 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: warehouse_id: f00dcafe catalog: main @@ -34,7 +34,7 @@ targets: prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/deployment-history/out.default-python.databricks.yml b/acceptance/bundle/templates/deployment-history/out.default-python.databricks.yml index b27b6fcd224..1de7c602976 100644 --- a/acceptance/bundle/templates/deployment-history/out.default-python.databricks.yml +++ b/acceptance/bundle/templates/deployment-history/out.default-python.databricks.yml @@ -31,14 +31,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/deployment-history/output.txt b/acceptance/bundle/templates/deployment-history/output.txt index c9f9febde46..a6f06bdcb77 100644 --- a/acceptance/bundle/templates/deployment-history/output.txt +++ b/acceptance/bundle/templates/deployment-history/output.txt @@ -17,7 +17,7 @@ experimental: 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! @@ -31,7 +31,7 @@ experimental: 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_scala' directory! @@ -45,7 +45,7 @@ experimental: 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_url: [DATABRICKS_URL] +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. diff --git a/acceptance/bundle/templates/lakeflow-integrations/output/my_lakeflow_integrations/databricks.yml b/acceptance/bundle/templates/lakeflow-integrations/output/my_lakeflow_integrations/databricks.yml index 92972c0592f..02aa0c5ad78 100644 --- a/acceptance/bundle/templates/lakeflow-integrations/output/my_lakeflow_integrations/databricks.yml +++ b/acceptance/bundle/templates/lakeflow-integrations/output/my_lakeflow_integrations/databricks.yml @@ -37,11 +37,11 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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} permissions: diff --git a/acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/databricks.yml b/acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/databricks.yml index 998fa4f2f5f..a86e4e792a1 100644 --- a/acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/databricks.yml +++ b/acceptance/bundle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: main schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/databricks.yml b/acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/databricks.yml index 998fa4f2f5f..a86e4e792a1 100644 --- a/acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/databricks.yml +++ b/acceptance/bundle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: main schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/pydabs/init-classic/output/my_pydabs/databricks.yml b/acceptance/bundle/templates/pydabs/init-classic/output/my_pydabs/databricks.yml index 7de11c34913..299ee6fd9ac 100644 --- a/acceptance/bundle/templates/pydabs/init-classic/output/my_pydabs/databricks.yml +++ b/acceptance/bundle/templates/pydabs/init-classic/output/my_pydabs/databricks.yml @@ -34,7 +34,7 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} @@ -43,7 +43,7 @@ targets: prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/telemetry/dbt-sql/output.txt b/acceptance/bundle/templates/telemetry/dbt-sql/output.txt index 606fd91719e..74e0bac9312 100644 --- a/acceptance/bundle/templates/telemetry/dbt-sql/output.txt +++ b/acceptance/bundle/templates/telemetry/dbt-sql/output.txt @@ -2,7 +2,7 @@ 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_url: [DATABRICKS_URL] +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. diff --git a/acceptance/bundle/templates/telemetry/default-python/out.databricks.yml b/acceptance/bundle/templates/telemetry/default-python/out.databricks.yml index 9124e938957..964e6e704f4 100644 --- a/acceptance/bundle/templates/telemetry/default-python/out.databricks.yml +++ b/acceptance/bundle/templates/telemetry/default-python/out.databricks.yml @@ -28,7 +28,7 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} @@ -37,7 +37,7 @@ targets: prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/telemetry/default-sql/out.databricks.yml b/acceptance/bundle/templates/telemetry/default-sql/out.databricks.yml index a8d6191d630..bdc9573808d 100644 --- a/acceptance/bundle/templates/telemetry/default-sql/out.databricks.yml +++ b/acceptance/bundle/templates/telemetry/default-sql/out.databricks.yml @@ -25,7 +25,7 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: warehouse_id: f00dcafe catalog: main @@ -34,7 +34,7 @@ targets: prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/bundle/templates/telemetry/default-sql/output.txt b/acceptance/bundle/templates/telemetry/default-sql/output.txt index 67ebb78d0e9..775d86933af 100644 --- a/acceptance/bundle/templates/telemetry/default-sql/output.txt +++ b/acceptance/bundle/templates/telemetry/default-sql/output.txt @@ -2,7 +2,7 @@ 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_url: [DATABRICKS_URL] +workspace_host: [DATABRICKS_URL] ✨ Your new project has been created in the 'my_default_sql' directory! diff --git a/acceptance/pipelines/e2e/output/lakeflow_project/databricks.yml b/acceptance/pipelines/e2e/output/lakeflow_project/databricks.yml index fe9666ebe34..67f65788f23 100644 --- a/acceptance/pipelines/e2e/output/lakeflow_project/databricks.yml +++ b/acceptance/pipelines/e2e/output/lakeflow_project/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/pipelines/init/python/output/my_python_project/databricks.yml b/acceptance/pipelines/init/python/output/my_python_project/databricks.yml index 2fceec998e7..6fee1dfff76 100644 --- a/acceptance/pipelines/init/python/output/my_python_project/databricks.yml +++ b/acceptance/pipelines/init/python/output/my_python_project/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: main schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/acceptance/pipelines/init/sql/output/my_sql_project/databricks.yml b/acceptance/pipelines/init/sql/output/my_sql_project/databricks.yml index b7d2d716e29..60823122702 100644 --- a/acceptance/pipelines/init/sql/output/my_sql_project/databricks.yml +++ b/acceptance/pipelines/init/sql/output/my_sql_project/databricks.yml @@ -23,14 +23,14 @@ targets: mode: development default: true workspace: - host: "[DATABRICKS_URL]" + host: [DATABRICKS_URL] variables: catalog: main schema: ${workspace.current_user.short_name} prod: mode: production workspace: - host: "[DATABRICKS_URL]" + 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: diff --git a/libs/template/templates/dbt-sql/databricks_template_schema.json b/libs/template/templates/dbt-sql/databricks_template_schema.json index 15cae9ae393..7e6c0b93952 100644 --- a/libs/template/templates/dbt-sql/databricks_template_schema.json +++ b/libs/template/templates/dbt-sql/databricks_template_schema.json @@ -1,5 +1,5 @@ { - "welcome_message": "\nWelcome to the dbt template for Declarative Automation Bundles!\n\nA 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.\nworkspace_url: {{.workspace.URL}}", + "welcome_message": "\nWelcome to the dbt template for Declarative Automation Bundles!\n\nA 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.\nworkspace_host: {{.workspace.URL}}", "properties": { "project_name": { "type": "string", diff --git a/libs/template/templates/default-scala/databricks_template_schema.json b/libs/template/templates/default-scala/databricks_template_schema.json index 2a9e5cc72a4..652c0d374e4 100644 --- a/libs/template/templates/default-scala/databricks_template_schema.json +++ b/libs/template/templates/default-scala/databricks_template_schema.json @@ -1,5 +1,5 @@ { - "welcome_message": "\nWelcome to the default-scala template for Declarative Automation Bundles!\n\nA 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.\nworkspace_url: {{.workspace.URL}}", + "welcome_message": "\nWelcome to the default-scala template for Declarative Automation Bundles!\n\nA 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.\nworkspace_host: {{.workspace.URL}}", "properties": { "project_name": { "type": "string", diff --git a/libs/template/templates/default-scala/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/default-scala/template/{{.project_name}}/databricks.yml.tmpl index 1351441e11b..ec11354f3b6 100644 --- a/libs/template/templates/default-scala/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/default-scala/template/{{.project_name}}/databricks.yml.tmpl @@ -22,7 +22,7 @@ variables: {{- end}} workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} artifact_path: {{.artifacts_dest_path}}/${bundle.name}/${bundle.target}/${workspace.current_user.short_name} artifacts: @@ -42,7 +42,7 @@ targets: mode: development default: true workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} variables: catalog: {{.default_catalog}} schema: {{$dev_schema}} @@ -50,7 +50,7 @@ targets: prod: mode: production workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} permissions: diff --git a/libs/template/templates/default-sql/databricks_template_schema.json b/libs/template/templates/default-sql/databricks_template_schema.json index 2fc7e31ec15..6967c3ec123 100644 --- a/libs/template/templates/default-sql/databricks_template_schema.json +++ b/libs/template/templates/default-sql/databricks_template_schema.json @@ -1,5 +1,5 @@ { - "welcome_message": "\nWelcome to the default SQL template for Declarative Automation Bundles!\n\nA 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.\nworkspace_url: {{.workspace.URL}}", + "welcome_message": "\nWelcome to the default SQL template for Declarative Automation Bundles!\n\nA 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.\nworkspace_host: {{.workspace.URL}}", "properties": { "project_name": { "type": "string", diff --git a/libs/template/templates/default-sql/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/default-sql/template/{{.project_name}}/databricks.yml.tmpl index c57b8594f26..cfc2c2cc2fc 100644 --- a/libs/template/templates/default-sql/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/default-sql/template/{{.project_name}}/databricks.yml.tmpl @@ -33,7 +33,7 @@ targets: mode: development default: true workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} variables: warehouse_id: {{index ((regexp "[^/]+$").FindStringSubmatch .http_path) 0}} catalog: {{.default_catalog}} @@ -42,7 +42,7 @@ targets: prod: mode: production workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} variables: diff --git a/libs/template/templates/default/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/default/template/{{.project_name}}/databricks.yml.tmpl index 1ea3bf752d2..42b15164c8e 100644 --- a/libs/template/templates/default/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/default/template/{{.project_name}}/databricks.yml.tmpl @@ -49,7 +49,7 @@ targets: mode: development default: true workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} variables: catalog: {{.default_catalog}} schema: {{$dev_schema}} @@ -60,7 +60,7 @@ targets: prod: mode: production workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} variables: diff --git a/libs/template/templates/lakeflow-integrations/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/lakeflow-integrations/template/{{.project_name}}/databricks.yml.tmpl index cf75bae798f..ba651def676 100644 --- a/libs/template/templates/lakeflow-integrations/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/lakeflow-integrations/template/{{.project_name}}/databricks.yml.tmpl @@ -38,11 +38,11 @@ targets: mode: development default: true workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} prod: mode: production workspace: - host: "{{.workspace.URL}}" + host: {{.workspace.URL}} # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} permissions: From 67b856dcbd993729f98b7581ed1a858cc0101389 Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Thu, 5 Nov 2026 12:19:33 +0000 Subject: [PATCH 7/9] Use .workspace in the dbt-sql template The bundle host comes from .workspace.URL like in the other built-in templates. Deployed dbt jobs get their host from Databricks, so they don't read it. The HTTP path suggested for dbt init gets ?o= when the workspace URL has the ID, because dbt selects the workspace on a host shared by several workspaces with ?o= in the HTTP path. The host suggested for dbt init is .workspace.Hostname. Co-authored-by: Isaac --- .../builtin-templates-workspace-url.md | 2 +- .../templates/dbt-sql-workspace-id/input.json | 6 ++++ .../dbt-sql-workspace-id/out.test.toml | 2 ++ .../templates/dbt-sql-workspace-id/output.txt | 24 +++++++++++++++ .../templates/dbt-sql-workspace-id/script | 29 +++++++++++++++++++ .../templates/dbt-sql-workspace-id/test.toml | 1 + .../output/my_dbt_sql/profile_template.yml | 2 +- .../{{.project_name}}/databricks.yml.tmpl | 4 +-- .../profile_template.yml.tmpl | 7 +++-- 9 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 acceptance/bundle/templates/dbt-sql-workspace-id/input.json create mode 100644 acceptance/bundle/templates/dbt-sql-workspace-id/out.test.toml create mode 100644 acceptance/bundle/templates/dbt-sql-workspace-id/output.txt create mode 100644 acceptance/bundle/templates/dbt-sql-workspace-id/script create mode 100644 acceptance/bundle/templates/dbt-sql-workspace-id/test.toml diff --git a/.nextchanges/bundles/builtin-templates-workspace-url.md b/.nextchanges/bundles/builtin-templates-workspace-url.md index cb97fad3984..76e97992a1e 100644 --- a/.nextchanges/bundles/builtin-templates-workspace-url.md +++ b/.nextchanges/bundles/builtin-templates-workspace-url.md @@ -1 +1 @@ -* Built-in templates (except `dbt-sql`) add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. Welcome messages of all built-in templates show the workspace URL. ([#7350](https://github.com/databricks/cli/pull/7350)) +* Built-in templates add the workspace ID to `workspace.host` (`?w=`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. Welcome messages show the same URL, and `dbt-sql` also adds `?o=` to the HTTP path it suggests for `dbt init`. ([#7350](https://github.com/databricks/cli/pull/7350)) diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/input.json b/acceptance/bundle/templates/dbt-sql-workspace-id/input.json new file mode 100644 index 00000000000..ca84320e6d7 --- /dev/null +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/input.json @@ -0,0 +1,6 @@ +{ + "project_name": "my_dbt_sql", + "http_path": "/sql/2.0/warehouses/f00dcafe", + "default_catalog": "main", + "personal_schemas": "yes" +} diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/out.test.toml b/acceptance/bundle/templates/dbt-sql-workspace-id/out.test.toml new file mode 100644 index 00000000000..19b5b15d11f --- /dev/null +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = [""] diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt b/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt new file mode 100644 index 00000000000..9a9b24857de --- /dev/null +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt @@ -0,0 +1,24 @@ + +=== Profile no_workspace_id + +>>> grep host: my_dbt_sql/databricks.yml + host: [DATABRICKS_URL] + host: [DATABRICKS_URL] + +>>> grep -E ^ default: [^{] my_dbt_sql/profile_template.yml + default: 127.0.0.1 + default: /sql/2.0/warehouses/f00dcafe + default: main + default: 4 + +=== Profile custom_host + +>>> grep host: my_dbt_sql/databricks.yml + host: [CUSTOM_HOST]?w=[WORKSPACE_ID] + host: [CUSTOM_HOST]?w=[WORKSPACE_ID] + +>>> grep -E ^ default: [^{] my_dbt_sql/profile_template.yml + default: localhost + default: /sql/2.0/warehouses/f00dcafe?o=[WORKSPACE_ID] + default: main + default: 4 diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/script b/acceptance/bundle/templates/dbt-sql-workspace-id/script new file mode 100644 index 00000000000..2de3af654fd --- /dev/null +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/script @@ -0,0 +1,29 @@ +# The test server is reachable as both 127.0.0.1 and localhost. The second +# stands in for a host shared by several workspaces. +CUSTOM_HOST=${DATABRICKS_HOST/127.0.0.1/localhost} +add_repl "$CUSTOM_HOST" CUSTOM_HOST +WORKSPACE_ID=$(curl -s "$DATABRICKS_HOST/.well-known/databricks-config" | jq -r .workspace_id) + +cat > .databrickscfg < /dev/null 2>&1 + trace grep 'host:' my_dbt_sql/databricks.yml + trace grep -E "^ default: [^{]" my_dbt_sql/profile_template.yml + rm -r my_dbt_sql +done diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/test.toml b/acceptance/bundle/templates/dbt-sql-workspace-id/test.toml new file mode 100644 index 00000000000..7b3e1dcab84 --- /dev/null +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/test.toml @@ -0,0 +1 @@ +Ignore = [".databrickscfg"] diff --git a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml index bdb41ab202e..49b872b6d55 100644 --- a/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml +++ b/acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/profile_template.yml @@ -5,7 +5,7 @@ fixed: type: databricks prompts: host: - default: [DATABRICKS_HOST] + default: 127.0.0.1 token: hint: 'personal access token to use, dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' hide_input: true diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl index 21c82234a83..0f6ea969c30 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/databricks.yml.tmpl @@ -20,12 +20,12 @@ targets: mode: development default: true workspace: - host: {{workspace_host}} + host: {{.workspace.URL}} prod: mode: production workspace: - host: {{workspace_host}} + host: {{.workspace.URL}} # We explicitly deploy to /Workspace/Users/{{user_name}} to make sure we only have a single copy. root_path: /Workspace/Users/{{user_name}}/.bundle/${bundle.name}/${bundle.target} permissions: diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl index 1bab573f2fa..a591e8ae495 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl @@ -5,13 +5,16 @@ fixed: type: databricks prompts: host: - default: {{(regexp "^https?://").ReplaceAllString workspace_host ""}} + default: {{.workspace.Hostname}} token: hint: 'personal access token to use, dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' hide_input: true http_path: hint: 'HTTP path of SQL warehouse to use' - default: {{.http_path}} + {{- /* dbt selects the workspace on a host shared by several workspaces with ?o= in the + HTTP path. Use the ID from the workspace URL, which has it when the profile sets it. */}} + {{- $id := (regexp `[?&]w=([^&#]+)`).FindStringSubmatch .workspace.URL}} + default: {{.http_path}}{{if $id}}?o={{index $id 1}}{{end}} {{- if eq .default_catalog ""}} _choose_unity_catalog: 'use the default workspace catalog (or do not use Unity Catalog)': From c19f462de25e7f9de130e8b6bca19039b531242a Mon Sep 17 00:00:00 2001 From: "pavlo.kozlov" Date: Thu, 5 Nov 2026 13:55:10 +0000 Subject: [PATCH 8/9] Update outputs for .workspace.Hostname with the port The dbt-sql profile default for dbt init is host:port again, so its output is the same as before. Co-authored-by: Isaac --- acceptance/bundle/templates/dbt-sql-workspace-id/output.txt | 4 ++-- acceptance/bundle/templates/dbt-sql-workspace-id/script | 1 + .../templates/dbt-sql/output/my_dbt_sql/profile_template.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt b/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt index 9a9b24857de..a65193b343f 100644 --- a/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt @@ -6,7 +6,7 @@ host: [DATABRICKS_URL] >>> grep -E ^ default: [^{] my_dbt_sql/profile_template.yml - default: 127.0.0.1 + default: [DATABRICKS_HOST] default: /sql/2.0/warehouses/f00dcafe default: main default: 4 @@ -18,7 +18,7 @@ host: [CUSTOM_HOST]?w=[WORKSPACE_ID] >>> grep -E ^ default: [^{] my_dbt_sql/profile_template.yml - default: localhost + default: [CUSTOM_HOSTNAME] default: /sql/2.0/warehouses/f00dcafe?o=[WORKSPACE_ID] default: main default: 4 diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/script b/acceptance/bundle/templates/dbt-sql-workspace-id/script index 2de3af654fd..adc37b81794 100644 --- a/acceptance/bundle/templates/dbt-sql-workspace-id/script +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/script @@ -2,6 +2,7 @@ # stands in for a host shared by several workspaces. CUSTOM_HOST=${DATABRICKS_HOST/127.0.0.1/localhost} add_repl "$CUSTOM_HOST" CUSTOM_HOST +add_repl "${CUSTOM_HOST#*://}" CUSTOM_HOSTNAME WORKSPACE_ID=$(curl -s "$DATABRICKS_HOST/.well-known/databricks-config" | jq -r .workspace_id) cat > .databrickscfg < Date: Fri, 6 Nov 2026 14:04:12 +0000 Subject: [PATCH 9/9] Use .workspace.URLID and setup_custom_host in built-in template tests dbt-sql adds ?o= from .workspace.URLID, escaped, instead of parsing the rendered URL with a regex. The profiles and dbt-sql-workspace-id tests use setup_custom_host instead of their own copy of that setup, and the dbt-sql-workspace-id test traces bundle init so a failed init shows its error. Co-authored-by: Isaac --- .../templates/dbt-sql-workspace-id/output.txt | 24 +++++++++++++++++++ .../templates/dbt-sql-workspace-id/script | 9 ++----- .../templates/default-minimal/profiles/script | 6 +---- .../default-minimal/profiles/test.toml | 2 +- .../profile_template.yml.tmpl | 5 ++-- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt b/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt index a65193b343f..836fba4f276 100644 --- a/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/output.txt @@ -1,6 +1,18 @@ === Profile no_workspace_id +>>> [CLI] bundle init dbt-sql --config-file ./input.json --profile no_workspace_id + +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 host: my_dbt_sql/databricks.yml host: [DATABRICKS_URL] host: [DATABRICKS_URL] @@ -13,6 +25,18 @@ === Profile custom_host +>>> [CLI] bundle init dbt-sql --config-file ./input.json --profile custom_host + +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: [CUSTOM_HOST]?w=[WORKSPACE_ID] + +📊 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 host: my_dbt_sql/databricks.yml host: [CUSTOM_HOST]?w=[WORKSPACE_ID] host: [CUSTOM_HOST]?w=[WORKSPACE_ID] diff --git a/acceptance/bundle/templates/dbt-sql-workspace-id/script b/acceptance/bundle/templates/dbt-sql-workspace-id/script index adc37b81794..f7cfa1bd350 100644 --- a/acceptance/bundle/templates/dbt-sql-workspace-id/script +++ b/acceptance/bundle/templates/dbt-sql-workspace-id/script @@ -1,9 +1,4 @@ -# The test server is reachable as both 127.0.0.1 and localhost. The second -# stands in for a host shared by several workspaces. -CUSTOM_HOST=${DATABRICKS_HOST/127.0.0.1/localhost} -add_repl "$CUSTOM_HOST" CUSTOM_HOST -add_repl "${CUSTOM_HOST#*://}" CUSTOM_HOSTNAME -WORKSPACE_ID=$(curl -s "$DATABRICKS_HOST/.well-known/databricks-config" | jq -r .workspace_id) +setup_custom_host cat > .databrickscfg < /dev/null 2>&1 + trace $CLI bundle init dbt-sql --config-file ./input.json --profile $profile trace grep 'host:' my_dbt_sql/databricks.yml trace grep -E "^ default: [^{]" my_dbt_sql/profile_template.yml rm -r my_dbt_sql diff --git a/acceptance/bundle/templates/default-minimal/profiles/script b/acceptance/bundle/templates/default-minimal/profiles/script index 00a3795fdaf..f3d1d94a153 100644 --- a/acceptance/bundle/templates/default-minimal/profiles/script +++ b/acceptance/bundle/templates/default-minimal/profiles/script @@ -1,8 +1,4 @@ -# The test server is reachable as both 127.0.0.1 and localhost. The second -# stands in for a host shared by several workspaces. -CUSTOM_HOST=${DATABRICKS_HOST/127.0.0.1/localhost} -add_repl "$CUSTOM_HOST" CUSTOM_HOST -WORKSPACE_ID=$(curl -s "$DATABRICKS_HOST/.well-known/databricks-config" | jq -r .workspace_id) +setup_custom_host # The classic profile has no workspace_id. The SDK resolves the ID from host # metadata, but the generated host stays without ?w= so that it matches the diff --git a/acceptance/bundle/templates/default-minimal/profiles/test.toml b/acceptance/bundle/templates/default-minimal/profiles/test.toml index 75cb7d8de44..c6eb8cb8eb3 100644 --- a/acceptance/bundle/templates/default-minimal/profiles/test.toml +++ b/acceptance/bundle/templates/default-minimal/profiles/test.toml @@ -1,2 +1,2 @@ -# Written by script. +# The script writes .databrickscfg. Ignore = [".databrickscfg"] diff --git a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl index a591e8ae495..279b5bf63b6 100644 --- a/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl +++ b/libs/template/templates/dbt-sql/template/{{.project_name}}/profile_template.yml.tmpl @@ -12,9 +12,8 @@ prompts: http_path: hint: 'HTTP path of SQL warehouse to use' {{- /* dbt selects the workspace on a host shared by several workspaces with ?o= in the - HTTP path. Use the ID from the workspace URL, which has it when the profile sets it. */}} - {{- $id := (regexp `[?&]w=([^&#]+)`).FindStringSubmatch .workspace.URL}} - default: {{.http_path}}{{if $id}}?o={{index $id 1}}{{end}} + HTTP path. Add it when the workspace URL has the ID. */}} + default: {{.http_path}}{{with .workspace.URLID}}?o={{urlquery .}}{{end}} {{- if eq .default_catalog ""}} _choose_unity_catalog: 'use the default workspace catalog (or do not use Unity Catalog)':