From fdca90b7dd63b2ac590d39e6f0efa3985cf81caa Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 11 Aug 2026 09:47:39 +0000 Subject: [PATCH 1/4] bundle: add env var to set record_deployment_history in built-in templates Co-authored-by: Isaac --- .../disabled/input.default-python.json | 9 +++ .../disabled/out.test.toml | 2 + .../disabled/output.txt | 30 ++++++++ .../record-deployment-history/disabled/script | 11 +++ .../enabled/input.dbt-sql.json | 6 ++ .../enabled/input.default-python.json | 9 +++ .../enabled/input.default-scala.json | 7 ++ .../enabled/input.default-sql.json | 6 ++ .../enabled/input.lakeflow-integrations.json | 3 + .../enabled/out.default-python.databricks.yml | 44 ++++++++++++ .../enabled/out.test.toml | 2 + .../enabled/output.txt | 70 +++++++++++++++++++ .../record-deployment-history/enabled/script | 18 +++++ .../enabled/test.toml | 5 ++ .../record-deployment-history/test.toml | 2 + libs/template/helpers.go | 13 ++++ .../common/library/experimental.tmpl | 15 ++++ .../{{.project_name}}/databricks.yml.tmpl | 1 + .../{{.project_name}}/databricks.yml.tmpl | 1 + .../{{.project_name}}/databricks.yml.tmpl | 1 + .../{{.project_name}}/databricks.yml.tmpl | 1 + .../{{.project_name}}/databricks.yml.tmpl | 1 + 22 files changed, 257 insertions(+) create mode 100644 acceptance/bundle/templates/record-deployment-history/disabled/input.default-python.json create mode 100644 acceptance/bundle/templates/record-deployment-history/disabled/out.test.toml create mode 100644 acceptance/bundle/templates/record-deployment-history/disabled/output.txt create mode 100644 acceptance/bundle/templates/record-deployment-history/disabled/script create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/input.dbt-sql.json create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/input.default-scala.json create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/input.default-sql.json create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/input.lakeflow-integrations.json create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/out.default-python.databricks.yml create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/output.txt create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/script create mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/test.toml create mode 100644 acceptance/bundle/templates/record-deployment-history/test.toml create mode 100644 libs/template/templates/common/library/experimental.tmpl diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/input.default-python.json b/acceptance/bundle/templates/record-deployment-history/disabled/input.default-python.json new file mode 100644 index 00000000000..0ed89e70ebb --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/disabled/input.default-python.json @@ -0,0 +1,9 @@ +{ + "project_name": "my_default_python", + "include_job": "yes", + "include_pipeline": "no", + "include_python": "no", + "serverless": "yes", + "default_catalog": "main", + "personal_schemas": "yes" +} diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/out.test.toml b/acceptance/bundle/templates/record-deployment-history/disabled/out.test.toml new file mode 100644 index 00000000000..0938e678987 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/disabled/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/output.txt b/acceptance/bundle/templates/record-deployment-history/disabled/output.txt new file mode 100644 index 00000000000..e6ff92cab76 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/disabled/output.txt @@ -0,0 +1,30 @@ +Welcome to the default Python template for Declarative Automation Bundles! + +Answer the following questions to customize your project. +You can always change your configuration in the databricks.yml file later. + +Note that [DATABRICKS_URL] is used for initialization. +(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.) + +✨ Your new project has been created in the 'my_default_python' directory! + +To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. +Welcome to the default Python template for Declarative Automation Bundles! + +Answer the following questions to customize your project. +You can always change your configuration in the databricks.yml file later. + +Note that [DATABRICKS_URL] is used for initialization. +(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.) + +✨ Your new project has been created in the 'my_default_python' directory! + +To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. + +>>> grep ^experimental: unset/my_default_python/databricks.yml + +Exit code: 1 + +>>> grep ^experimental: explicit-false/my_default_python/databricks.yml + +Exit code: 1 diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/script b/acceptance/bundle/templates/record-deployment-history/disabled/script new file mode 100644 index 00000000000..4dcbd305546 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/disabled/script @@ -0,0 +1,11 @@ +# Recording deployment history is opt-in: absent by default, and when explicitly set to false. +$CLI bundle init default-python --config-file input.default-python.json --output-dir unset + +export DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY=false +$CLI bundle init default-python --config-file input.default-python.json --output-dir explicit-false + +for dir in unset explicit-false; do + errcode trace grep '^experimental:' $dir/my_default_python/databricks.yml +done + +rm -r unset explicit-false diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.dbt-sql.json b/acceptance/bundle/templates/record-deployment-history/enabled/input.dbt-sql.json new file mode 100644 index 00000000000..ca84320e6d7 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/input.dbt-sql.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/record-deployment-history/enabled/input.default-python.json b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json new file mode 100644 index 00000000000..0ed89e70ebb --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json @@ -0,0 +1,9 @@ +{ + "project_name": "my_default_python", + "include_job": "yes", + "include_pipeline": "no", + "include_python": "no", + "serverless": "yes", + "default_catalog": "main", + "personal_schemas": "yes" +} diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.default-scala.json b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-scala.json new file mode 100644 index 00000000000..f2c27809bb7 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-scala.json @@ -0,0 +1,7 @@ +{ + "project_name": "my_default_scala", + "compute_type": "serverless", + "artifacts_dest_path": "/Volumes/test-folder", + "default_catalog": "main", + "personal_schemas": "yes" +} diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.default-sql.json b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-sql.json new file mode 100644 index 00000000000..84cc8563164 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-sql.json @@ -0,0 +1,6 @@ +{ + "project_name": "my_default_sql", + "http_path": "/sql/2.0/warehouses/f00dcafe", + "default_catalog": "main", + "personal_schemas": "yes" +} diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.lakeflow-integrations.json b/acceptance/bundle/templates/record-deployment-history/enabled/input.lakeflow-integrations.json new file mode 100644 index 00000000000..f88b7d45310 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/input.lakeflow-integrations.json @@ -0,0 +1,3 @@ +{ + "project_name": "my_lakeflow_integrations" +} diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/out.default-python.databricks.yml b/acceptance/bundle/templates/record-deployment-history/enabled/out.default-python.databricks.yml new file mode 100644 index 00000000000..a3b358d3a91 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/out.default-python.databricks.yml @@ -0,0 +1,44 @@ +# This is a Declarative Automation Bundle definition for my_default_python. +# See https://docs.databricks.com/dev-tools/bundles/index.html for documentation. +bundle: + name: my_default_python + uuid: [BUNDLE_UUID] + +experimental: + record_deployment_history: true + +include: + - resources/*.yml + +# Variable declarations. These variables are assigned in the dev/prod targets below. +variables: + catalog: + description: The catalog to use + schema: + description: The schema to use + +targets: + dev: + # The default target uses 'mode: development' to create a development copy. + # - Deployed resources get prefixed with '[dev my_user_name]' + # - Any job schedules and triggers are paused by default. + # See also https://docs.databricks.com/dev-tools/bundles/deployment-modes.html. + mode: development + default: true + workspace: + host: [DATABRICKS_URL] + variables: + catalog: main + schema: ${workspace.current_user.short_name} + prod: + mode: production + workspace: + host: [DATABRICKS_URL] + # We explicitly deploy to /Workspace/Users/[USERNAME] to make sure we only have a single copy. + root_path: /Workspace/Users/[USERNAME]/.bundle/${bundle.name}/${bundle.target} + variables: + catalog: main + schema: prod + permissions: + - user_name: [USERNAME] + level: CAN_MANAGE diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml b/acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml new file mode 100644 index 00000000000..0938e678987 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/output.txt b/acceptance/bundle/templates/record-deployment-history/enabled/output.txt new file mode 100644 index 00000000000..befcd703c14 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/output.txt @@ -0,0 +1,70 @@ +Welcome to the default Python template for Declarative Automation Bundles! + +Answer the following questions to customize your project. +You can always change your configuration in the databricks.yml file later. + +Note that [DATABRICKS_URL] is used for initialization. +(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.) + +✨ Your new project has been created in the 'my_default_python' directory! + +To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. + +>>> grep -A1 ^experimental: output/default-python/my_default_python/databricks.yml +experimental: + record_deployment_history: true + +Welcome to the default SQL template for Declarative Automation Bundles! + +A workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html. +workspace_host: [DATABRICKS_URL] + +✨ Your new project has been created in the 'my_default_sql' directory! + +Please refer to the README.md file for "getting started" instructions. +See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. + +>>> grep -A1 ^experimental: output/default-sql/my_default_sql/databricks.yml +experimental: + record_deployment_history: true + +Welcome to the default-scala template for Declarative Automation Bundles! + +A workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html. +workspace_host: [DATABRICKS_URL] + +✨ Your new project has been created in the 'my_default_scala' directory! + +Please refer to the README.md file for "getting started" instructions. +See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. + +>>> grep -A1 ^experimental: output/default-scala/my_default_scala/databricks.yml +experimental: + record_deployment_history: true + +Welcome to the dbt template for Declarative Automation Bundles! + +A workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html. +workspace_host: [DATABRICKS_URL] + +📊 Your new project has been created in the 'my_dbt_sql' directory! +If you already have dbt installed, just type 'cd my_dbt_sql; dbt init' to get started. +Refer to the README.md file for full "getting started" guide and production setup instructions. + + +>>> grep -A1 ^experimental: output/dbt-sql/my_dbt_sql/databricks.yml +experimental: + record_deployment_history: true +Welcome to the Lakeflow integrations template! + + +✨ Your new project has been created in the 'my_lakeflow_integrations' directory! + +Please refer to the README.md file for "getting started" instructions. + +>>> grep -A1 ^experimental: output/lakeflow-integrations/my_lakeflow_integrations/databricks.yml +experimental: + record_deployment_history: true + +>>> [CLI] bundle validate -o json +json.experimental.record_deployment_history = true; diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/script b/acceptance/bundle/templates/record-deployment-history/enabled/script new file mode 100644 index 00000000000..c90d580e309 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/script @@ -0,0 +1,18 @@ +# The env vars in test.toml opt every built-in template into recording deployment history. + +# Leaving the generated projects behind would add their .gitignore files to this repo, see #2318. +trap 'rm -rf output' EXIT + +for template in default-python default-sql default-scala dbt-sql lakeflow-integrations; do + $CLI bundle init "$template" --config-file "input.$template.json" --output-dir "output/$template" + trace grep -A1 '^experimental:' output/$template/*/databricks.yml +done + +# The setting is gated off for now, so check that a generated project still loads with the +# force-allow escape hatch that test.toml sets. The gate applies to the field rather than to +# the layout, so one template is enough. +(cd output/default-python/my_default_python && trace $CLI bundle validate -o json | gron.py | grep experimental) + +# Keep one file in full to assert where the stanza lands in the document. +mv output/default-python/my_default_python/databricks.yml out.default-python.databricks.yml +add_repl.py "$(grep -o 'uuid: .*' out.default-python.databricks.yml | cut -d ' ' -f2)" BUNDLE_UUID diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/test.toml b/acceptance/bundle/templates/record-deployment-history/enabled/test.toml new file mode 100644 index 00000000000..868777403d7 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/enabled/test.toml @@ -0,0 +1,5 @@ +Env.DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY = "true" + +# record_deployment_history is gated off for now, so generated projects only validate with the +# force-allow escape hatch set. +Env.DATABRICKS_BUNDLE_FORCE_ALLOW_RECORD_DEPLOYMENT_HISTORY = "true" diff --git a/acceptance/bundle/templates/record-deployment-history/test.toml b/acceptance/bundle/templates/record-deployment-history/test.toml new file mode 100644 index 00000000000..d0af1d83455 --- /dev/null +++ b/acceptance/bundle/templates/record-deployment-history/test.toml @@ -0,0 +1,2 @@ +# What is under test is what `bundle init` writes, so one engine is enough. +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/libs/template/helpers.go b/libs/template/helpers.go index f32ae86c60b..a02efae3ea9 100644 --- a/libs/template/helpers.go +++ b/libs/template/helpers.go @@ -13,6 +13,7 @@ import ( "text/template" "github.com/databricks/cli/libs/cmdctx" + "github.com/databricks/cli/libs/env" "github.com/databricks/cli/libs/iamutil" "github.com/databricks/databricks-sdk-go/apierr" "github.com/databricks/databricks-sdk-go/service/iam" @@ -52,6 +53,14 @@ var metastoreDisabledErrorCodes = []string{ // is run and can be used to attribute DBU revenue to bundle templates. var bundleUuid = uuid.New().String() +// recordDeploymentHistoryEnvVar makes the built-in templates set +// experimental.record_deployment_history in the databricks.yml they generate. It is scoped to +// `bundle init` because it persists the setting in the generated project rather than applying +// it to the bundle being run. +// +// Temporary: remove it and its callers in the templates once this is the default. +const recordDeploymentHistoryEnvVar = "DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY" + func loadHelpers(ctx context.Context) template.FuncMap { w := cmdctx.WorkspaceClient(ctx) return template.FuncMap{ @@ -174,6 +183,10 @@ func loadHelpers(ctx context.Context) template.FuncMap { cachedIsServicePrincipal = &result return result, nil }, + "record_deployment_history": func() bool { + v, _ := env.GetBool(ctx, recordDeploymentHistoryEnvVar) + return v + }, "lower": func(s string) string { return strings.ToLower(s) }, diff --git a/libs/template/templates/common/library/experimental.tmpl b/libs/template/templates/common/library/experimental.tmpl new file mode 100644 index 00000000000..d55f4234b02 --- /dev/null +++ b/libs/template/templates/common/library/experimental.tmpl @@ -0,0 +1,15 @@ +{{- /* + * Temporary opt-in for recording deployment history; remove once it is the default. + * + * The flag is passed in rather than read from the record_deployment_history helper here, + * because this shared library is parsed for every template, including by callers that + * register no helpers. + */ -}} + +{{- define "experimental_record_deployment_history" -}} +{{- if .}} + +experimental: + record_deployment_history: true +{{- end}} +{{- end}} 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 89e66ef929c..ddc236733bf 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 @@ -4,6 +4,7 @@ bundle: name: {{.project_name}} uuid: {{bundle_uuid}} +{{- template "experimental_record_deployment_history" record_deployment_history}} include: - resources/*.yml 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 9ad15fddf19..ad7a32de3e8 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 @@ -3,6 +3,7 @@ bundle: name: {{.project_name}} uuid: {{bundle_uuid}} +{{- template "experimental_record_deployment_history" record_deployment_history}} include: - resources/*.yml 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 f475da8593e..9749477f312 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 @@ -3,6 +3,7 @@ bundle: name: {{.project_name}} uuid: {{bundle_uuid}} +{{- template "experimental_record_deployment_history" record_deployment_history}} include: - resources/*.yml 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 7fb657982aa..6f86e9ae9b1 100644 --- a/libs/template/templates/default/template/{{.project_name}}/databricks.yml.tmpl +++ b/libs/template/templates/default/template/{{.project_name}}/databricks.yml.tmpl @@ -6,6 +6,7 @@ bundle: name: {{.project_name}} uuid: {{bundle_uuid}} +{{- template "experimental_record_deployment_history" record_deployment_history}} {{- if $with_pydabs }} python: 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 da766018c38..0d781d38a8c 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 @@ -4,6 +4,7 @@ bundle: name: {{.project_name}} uuid: {{bundle_uuid}} engine: direct +{{- template "experimental_record_deployment_history" record_deployment_history}} include: - resources/*.yml From 47f5da9a1b653a9d11046f799df5c906861d726d Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 11 Aug 2026 10:01:58 +0000 Subject: [PATCH 2/4] Drop the disabled case and flatten the test dir Co-authored-by: Isaac --- .../disabled/output.txt | 30 ------------------- .../record-deployment-history/disabled/script | 11 ------- .../enabled/input.default-python.json | 9 ------ .../enabled/out.test.toml | 2 -- .../enabled/test.toml | 5 ---- .../{enabled => }/input.dbt-sql.json | 0 .../{disabled => }/input.default-python.json | 0 .../{enabled => }/input.default-scala.json | 0 .../{enabled => }/input.default-sql.json | 0 .../input.lakeflow-integrations.json | 0 .../out.default-python.databricks.yml | 0 .../{disabled => }/out.test.toml | 0 .../{enabled => }/output.txt | 0 .../{enabled => }/script | 0 .../record-deployment-history/test.toml | 6 ++++ 15 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 acceptance/bundle/templates/record-deployment-history/disabled/output.txt delete mode 100644 acceptance/bundle/templates/record-deployment-history/disabled/script delete mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json delete mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml delete mode 100644 acceptance/bundle/templates/record-deployment-history/enabled/test.toml rename acceptance/bundle/templates/record-deployment-history/{enabled => }/input.dbt-sql.json (100%) rename acceptance/bundle/templates/record-deployment-history/{disabled => }/input.default-python.json (100%) rename acceptance/bundle/templates/record-deployment-history/{enabled => }/input.default-scala.json (100%) rename acceptance/bundle/templates/record-deployment-history/{enabled => }/input.default-sql.json (100%) rename acceptance/bundle/templates/record-deployment-history/{enabled => }/input.lakeflow-integrations.json (100%) rename acceptance/bundle/templates/record-deployment-history/{enabled => }/out.default-python.databricks.yml (100%) rename acceptance/bundle/templates/record-deployment-history/{disabled => }/out.test.toml (100%) rename acceptance/bundle/templates/record-deployment-history/{enabled => }/output.txt (100%) rename acceptance/bundle/templates/record-deployment-history/{enabled => }/script (100%) diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/output.txt b/acceptance/bundle/templates/record-deployment-history/disabled/output.txt deleted file mode 100644 index e6ff92cab76..00000000000 --- a/acceptance/bundle/templates/record-deployment-history/disabled/output.txt +++ /dev/null @@ -1,30 +0,0 @@ -Welcome to the default Python template for Declarative Automation Bundles! - -Answer the following questions to customize your project. -You can always change your configuration in the databricks.yml file later. - -Note that [DATABRICKS_URL] is used for initialization. -(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.) - -✨ Your new project has been created in the 'my_default_python' directory! - -To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. -Welcome to the default Python template for Declarative Automation Bundles! - -Answer the following questions to customize your project. -You can always change your configuration in the databricks.yml file later. - -Note that [DATABRICKS_URL] is used for initialization. -(For information on how to change your profile, see https://docs.databricks.com/dev-tools/cli/profiles.html.) - -✨ Your new project has been created in the 'my_default_python' directory! - -To get started, refer to the project README.md file and the documentation at https://docs.databricks.com/dev-tools/bundles/index.html. - ->>> grep ^experimental: unset/my_default_python/databricks.yml - -Exit code: 1 - ->>> grep ^experimental: explicit-false/my_default_python/databricks.yml - -Exit code: 1 diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/script b/acceptance/bundle/templates/record-deployment-history/disabled/script deleted file mode 100644 index 4dcbd305546..00000000000 --- a/acceptance/bundle/templates/record-deployment-history/disabled/script +++ /dev/null @@ -1,11 +0,0 @@ -# Recording deployment history is opt-in: absent by default, and when explicitly set to false. -$CLI bundle init default-python --config-file input.default-python.json --output-dir unset - -export DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY=false -$CLI bundle init default-python --config-file input.default-python.json --output-dir explicit-false - -for dir in unset explicit-false; do - errcode trace grep '^experimental:' $dir/my_default_python/databricks.yml -done - -rm -r unset explicit-false diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json b/acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json deleted file mode 100644 index 0ed89e70ebb..00000000000 --- a/acceptance/bundle/templates/record-deployment-history/enabled/input.default-python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "project_name": "my_default_python", - "include_job": "yes", - "include_pipeline": "no", - "include_python": "no", - "serverless": "yes", - "default_catalog": "main", - "personal_schemas": "yes" -} diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml b/acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml deleted file mode 100644 index 0938e678987..00000000000 --- a/acceptance/bundle/templates/record-deployment-history/enabled/out.test.toml +++ /dev/null @@ -1,2 +0,0 @@ -Cloud = false -EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/test.toml b/acceptance/bundle/templates/record-deployment-history/enabled/test.toml deleted file mode 100644 index 868777403d7..00000000000 --- a/acceptance/bundle/templates/record-deployment-history/enabled/test.toml +++ /dev/null @@ -1,5 +0,0 @@ -Env.DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY = "true" - -# record_deployment_history is gated off for now, so generated projects only validate with the -# force-allow escape hatch set. -Env.DATABRICKS_BUNDLE_FORCE_ALLOW_RECORD_DEPLOYMENT_HISTORY = "true" diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.dbt-sql.json b/acceptance/bundle/templates/record-deployment-history/input.dbt-sql.json similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/input.dbt-sql.json rename to acceptance/bundle/templates/record-deployment-history/input.dbt-sql.json diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/input.default-python.json b/acceptance/bundle/templates/record-deployment-history/input.default-python.json similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/disabled/input.default-python.json rename to acceptance/bundle/templates/record-deployment-history/input.default-python.json diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.default-scala.json b/acceptance/bundle/templates/record-deployment-history/input.default-scala.json similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/input.default-scala.json rename to acceptance/bundle/templates/record-deployment-history/input.default-scala.json diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.default-sql.json b/acceptance/bundle/templates/record-deployment-history/input.default-sql.json similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/input.default-sql.json rename to acceptance/bundle/templates/record-deployment-history/input.default-sql.json diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/input.lakeflow-integrations.json b/acceptance/bundle/templates/record-deployment-history/input.lakeflow-integrations.json similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/input.lakeflow-integrations.json rename to acceptance/bundle/templates/record-deployment-history/input.lakeflow-integrations.json diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/out.default-python.databricks.yml b/acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/out.default-python.databricks.yml rename to acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml diff --git a/acceptance/bundle/templates/record-deployment-history/disabled/out.test.toml b/acceptance/bundle/templates/record-deployment-history/out.test.toml similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/disabled/out.test.toml rename to acceptance/bundle/templates/record-deployment-history/out.test.toml diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/output.txt b/acceptance/bundle/templates/record-deployment-history/output.txt similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/output.txt rename to acceptance/bundle/templates/record-deployment-history/output.txt diff --git a/acceptance/bundle/templates/record-deployment-history/enabled/script b/acceptance/bundle/templates/record-deployment-history/script similarity index 100% rename from acceptance/bundle/templates/record-deployment-history/enabled/script rename to acceptance/bundle/templates/record-deployment-history/script diff --git a/acceptance/bundle/templates/record-deployment-history/test.toml b/acceptance/bundle/templates/record-deployment-history/test.toml index d0af1d83455..9c47efa40f8 100644 --- a/acceptance/bundle/templates/record-deployment-history/test.toml +++ b/acceptance/bundle/templates/record-deployment-history/test.toml @@ -1,2 +1,8 @@ +Env.DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY = "true" + +# record_deployment_history is gated off for now, so generated projects only validate with the +# force-allow escape hatch set. +Env.DATABRICKS_BUNDLE_FORCE_ALLOW_RECORD_DEPLOYMENT_HISTORY = "true" + # What is under test is what `bundle init` writes, so one engine is enough. EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] From 3250df5330154015723a636aac76a81ee0405615 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 11 Aug 2026 10:12:47 +0000 Subject: [PATCH 3/4] Trim template inputs to only the required properties Co-authored-by: Isaac --- .../record-deployment-history/input.dbt-sql.json | 5 +---- .../record-deployment-history/input.default-python.json | 8 +------- .../record-deployment-history/input.default-scala.json | 5 +---- .../record-deployment-history/input.default-sql.json | 5 +---- .../out.default-python.databricks.yml | 9 +++++++-- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/acceptance/bundle/templates/record-deployment-history/input.dbt-sql.json b/acceptance/bundle/templates/record-deployment-history/input.dbt-sql.json index ca84320e6d7..8a0fef4dcd4 100644 --- a/acceptance/bundle/templates/record-deployment-history/input.dbt-sql.json +++ b/acceptance/bundle/templates/record-deployment-history/input.dbt-sql.json @@ -1,6 +1,3 @@ { - "project_name": "my_dbt_sql", - "http_path": "/sql/2.0/warehouses/f00dcafe", - "default_catalog": "main", - "personal_schemas": "yes" + "project_name": "my_dbt_sql" } diff --git a/acceptance/bundle/templates/record-deployment-history/input.default-python.json b/acceptance/bundle/templates/record-deployment-history/input.default-python.json index 0ed89e70ebb..697fc31dd1b 100644 --- a/acceptance/bundle/templates/record-deployment-history/input.default-python.json +++ b/acceptance/bundle/templates/record-deployment-history/input.default-python.json @@ -1,9 +1,3 @@ { - "project_name": "my_default_python", - "include_job": "yes", - "include_pipeline": "no", - "include_python": "no", - "serverless": "yes", - "default_catalog": "main", - "personal_schemas": "yes" + "project_name": "my_default_python" } diff --git a/acceptance/bundle/templates/record-deployment-history/input.default-scala.json b/acceptance/bundle/templates/record-deployment-history/input.default-scala.json index f2c27809bb7..f35206cac89 100644 --- a/acceptance/bundle/templates/record-deployment-history/input.default-scala.json +++ b/acceptance/bundle/templates/record-deployment-history/input.default-scala.json @@ -1,7 +1,4 @@ { "project_name": "my_default_scala", - "compute_type": "serverless", - "artifacts_dest_path": "/Volumes/test-folder", - "default_catalog": "main", - "personal_schemas": "yes" + "artifacts_dest_path": "/Volumes/test-folder" } diff --git a/acceptance/bundle/templates/record-deployment-history/input.default-sql.json b/acceptance/bundle/templates/record-deployment-history/input.default-sql.json index 84cc8563164..5bb0b317d93 100644 --- a/acceptance/bundle/templates/record-deployment-history/input.default-sql.json +++ b/acceptance/bundle/templates/record-deployment-history/input.default-sql.json @@ -1,6 +1,3 @@ { - "project_name": "my_default_sql", - "http_path": "/sql/2.0/warehouses/f00dcafe", - "default_catalog": "main", - "personal_schemas": "yes" + "project_name": "my_default_sql" } diff --git a/acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml b/acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml index a3b358d3a91..b9ede45b676 100644 --- a/acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml +++ b/acceptance/bundle/templates/record-deployment-history/out.default-python.databricks.yml @@ -10,6 +10,11 @@ experimental: include: - resources/*.yml +artifacts: + python_artifact: + type: whl + build: uv build --wheel + # Variable declarations. These variables are assigned in the dev/prod targets below. variables: catalog: @@ -28,7 +33,7 @@ targets: workspace: host: [DATABRICKS_URL] variables: - catalog: main + catalog: hive_metastore schema: ${workspace.current_user.short_name} prod: mode: production @@ -37,7 +42,7 @@ targets: # We explicitly deploy to /Workspace/Users/[USERNAME] to make sure we only have a single copy. root_path: /Workspace/Users/[USERNAME]/.bundle/${bundle.name}/${bundle.target} variables: - catalog: main + catalog: hive_metastore schema: prod permissions: - user_name: [USERNAME] From 0b3d04e570d7100a23791c93c54932026dc3da21 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 11 Aug 2026 16:50:54 +0000 Subject: [PATCH 4/4] Drop the force-allow env var from the record-deployment-history test Co-authored-by: Isaac --- .../bundle/templates/record-deployment-history/script | 7 +++---- .../bundle/templates/record-deployment-history/test.toml | 4 ---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/acceptance/bundle/templates/record-deployment-history/script b/acceptance/bundle/templates/record-deployment-history/script index c90d580e309..bad50ccad90 100644 --- a/acceptance/bundle/templates/record-deployment-history/script +++ b/acceptance/bundle/templates/record-deployment-history/script @@ -1,4 +1,4 @@ -# The env vars in test.toml opt every built-in template into recording deployment history. +# The env var in test.toml opts every built-in template into recording deployment history. # Leaving the generated projects behind would add their .gitignore files to this repo, see #2318. trap 'rm -rf output' EXIT @@ -8,9 +8,8 @@ for template in default-python default-sql default-scala dbt-sql lakeflow-integr trace grep -A1 '^experimental:' output/$template/*/databricks.yml done -# The setting is gated off for now, so check that a generated project still loads with the -# force-allow escape hatch that test.toml sets. The gate applies to the field rather than to -# the layout, so one template is enough. +# Check that a generated project still loads and keeps the field through validation. +# This applies to the field rather than to the layout, so one template is enough. (cd output/default-python/my_default_python && trace $CLI bundle validate -o json | gron.py | grep experimental) # Keep one file in full to assert where the stanza lands in the document. diff --git a/acceptance/bundle/templates/record-deployment-history/test.toml b/acceptance/bundle/templates/record-deployment-history/test.toml index 9c47efa40f8..a1d3232167a 100644 --- a/acceptance/bundle/templates/record-deployment-history/test.toml +++ b/acceptance/bundle/templates/record-deployment-history/test.toml @@ -1,8 +1,4 @@ Env.DATABRICKS_BUNDLE_INIT_RECORD_DEPLOYMENT_HISTORY = "true" -# record_deployment_history is gated off for now, so generated projects only validate with the -# force-allow escape hatch set. -Env.DATABRICKS_BUNDLE_FORCE_ALLOW_RECORD_DEPLOYMENT_HISTORY = "true" - # What is under test is what `bundle init` writes, so one engine is enough. EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]