From 3c51453a2d0fd176e2675461dc236473d727daa5 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 15 Oct 2026 10:37:00 +0200 Subject: [PATCH 1/2] Remove old fallback path logic --- acceptance/bundle/paths/fallback/README.md | 42 ---------- .../bundle/paths/fallback/databricks.yml | 13 --- .../bundle/paths/fallback/out.test.toml | 2 - .../bundle/paths/fallback/output.job.json | 67 ---------------- .../paths/fallback/output.pipeline.json | 22 ------ acceptance/bundle/paths/fallback/output.txt | 49 ------------ .../bundle/paths/fallback/override_job.yml | 41 ---------- .../paths/fallback/override_pipeline.yml | 13 --- .../paths/fallback/resources/my_job.yml | 48 ----------- .../paths/fallback/resources/my_pipeline.yml | 9 --- acceptance/bundle/paths/fallback/script | 10 --- .../bundle/paths/fallback/script.cleanup | 1 - .../paths/fallback/src/dbt_project/.gitkeep | 0 acceptance/bundle/paths/fallback/src/file.py | 1 - acceptance/bundle/paths/fallback/src/file1.py | 1 - acceptance/bundle/paths/fallback/src/file2.py | 1 - .../bundle/paths/fallback/src/notebook.py | 2 - .../bundle/paths/fallback/src/notebook1.py | 2 - .../bundle/paths/fallback/src/notebook2.py | 2 - acceptance/bundle/paths/fallback/src/sql.sql | 1 - acceptance/bundle/paths/fallback/test.toml | 3 - .../bundle/paths/fallback_metric/output.txt | 79 ------------------- bundle/config/mutator/translate_paths.go | 30 ------- bundle/config/mutator/translate_paths_jobs.go | 41 ---------- .../mutator/translate_paths_pipelines.go | 41 ---------- 25 files changed, 521 deletions(-) delete mode 100644 acceptance/bundle/paths/fallback/README.md delete mode 100644 acceptance/bundle/paths/fallback/databricks.yml delete mode 100644 acceptance/bundle/paths/fallback/out.test.toml delete mode 100644 acceptance/bundle/paths/fallback/output.job.json delete mode 100644 acceptance/bundle/paths/fallback/output.pipeline.json delete mode 100644 acceptance/bundle/paths/fallback/output.txt delete mode 100644 acceptance/bundle/paths/fallback/override_job.yml delete mode 100644 acceptance/bundle/paths/fallback/override_pipeline.yml delete mode 100644 acceptance/bundle/paths/fallback/resources/my_job.yml delete mode 100644 acceptance/bundle/paths/fallback/resources/my_pipeline.yml delete mode 100644 acceptance/bundle/paths/fallback/script delete mode 100644 acceptance/bundle/paths/fallback/script.cleanup delete mode 100644 acceptance/bundle/paths/fallback/src/dbt_project/.gitkeep delete mode 100644 acceptance/bundle/paths/fallback/src/file.py delete mode 100644 acceptance/bundle/paths/fallback/src/file1.py delete mode 100644 acceptance/bundle/paths/fallback/src/file2.py delete mode 100644 acceptance/bundle/paths/fallback/src/notebook.py delete mode 100644 acceptance/bundle/paths/fallback/src/notebook1.py delete mode 100644 acceptance/bundle/paths/fallback/src/notebook2.py delete mode 100644 acceptance/bundle/paths/fallback/src/sql.sql delete mode 100644 acceptance/bundle/paths/fallback/test.toml delete mode 100644 acceptance/bundle/paths/fallback_metric/output.txt diff --git a/acceptance/bundle/paths/fallback/README.md b/acceptance/bundle/paths/fallback/README.md deleted file mode 100644 index ec5f6c74098..00000000000 --- a/acceptance/bundle/paths/fallback/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Test path translation (with fallback to previous behavior) - -As of v0.214.0, all paths in a resource definition were resolved relative to the path -where that resource was first defined. If those paths were specified in the same file, -or in a different file in the same directory, this would be intuitive. - -If those paths were specified in a different file in a different directory, they would -still be resolved relative to the original file. - -For example, a job defined in `./resources/my_job.yml` with an override -in `./override.yml` would have to use paths relative to `./resources`. -This is counter-intuitive and error-prone, and we changed this behavior -in https://github.com/databricks/cli/pull/1273. - -## Appendix - -Q: Why did this behavior apply as of v0.214.0? - -A: With the introduction of dynamic configuration loading, we keep track - of the location (file, line, column) where a resource is defined. - This location information is used to perform path translation, but upon - introduction in v0.214.0, the code still used only a single path per resource. - Due to the semantics of merging two `dyn.Value` objects, the location - information of the first existing value is used for the merged value. - This meant that all paths for a resource were resolved relative to the - location where the resource was first defined. - -Q: What was the behavior before v0.214.0? - -A: Before we relied on dynamic configuration loading, all configuration was - maintained in a typed struct. The path for a resource was an unexported field on the - resource and was set right after loading the configuration file that contains it. - Target overrides contained the same path field, and applying a target override - would set the path for the resource to the path of the target override. - This meant that all paths for a resource were resolved relative to the - location where the resource was last defined. - -Q: Why are we maintaining compatibility with the old behavior? - -A: We want to avoid breaking existing configurations that depend on this behavior. - Use of the old behavior should trigger warnings with a call to action to update. - We can include a deprecation timeline to remove the old behavior in the future. diff --git a/acceptance/bundle/paths/fallback/databricks.yml b/acceptance/bundle/paths/fallback/databricks.yml deleted file mode 100644 index c6d0abe0aa4..00000000000 --- a/acceptance/bundle/paths/fallback/databricks.yml +++ /dev/null @@ -1,13 +0,0 @@ -bundle: - name: fallback - -include: - - "resources/*.yml" - - "override_*.yml" - -targets: - development: - default: true - - error: - default: false diff --git a/acceptance/bundle/paths/fallback/out.test.toml b/acceptance/bundle/paths/fallback/out.test.toml deleted file mode 100644 index a927a5fbc06..00000000000 --- a/acceptance/bundle/paths/fallback/out.test.toml +++ /dev/null @@ -1,2 +0,0 @@ -Cloud = false -EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/paths/fallback/output.job.json b/acceptance/bundle/paths/fallback/output.job.json deleted file mode 100644 index 98bb2e40e20..00000000000 --- a/acceptance/bundle/paths/fallback/output.job.json +++ /dev/null @@ -1,67 +0,0 @@ -[ - { - "dbt_task": { - "commands": [ - "dbt run", - "dbt run" - ], - "project_directory": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/dbt_project" - }, - "job_cluster_key": "default", - "task_key": "dbt_example" - }, - { - "job_cluster_key": "default", - "notebook_task": { - "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/notebook" - }, - "task_key": "notebook_example" - }, - { - "job_cluster_key": "default", - "libraries": [ - { - "whl": "dist/wheel1.whl" - }, - { - "whl": "../dist/wheel2.whl" - } - ], - "python_wheel_task": { - "package_name": "my_package" - }, - "task_key": "python_wheel_example" - }, - { - "job_cluster_key": "default", - "libraries": [ - { - "jar": "target/jar1.jar" - }, - { - "jar": "../target/jar2.jar" - } - ], - "spark_jar_task": { - "main_class_name": "com.example.Main" - }, - "task_key": "spark_jar_example" - }, - { - "job_cluster_key": "default", - "spark_python_task": { - "python_file": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/file.py" - }, - "task_key": "spark_python_example" - }, - { - "job_cluster_key": "default", - "sql_task": { - "file": { - "path": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/sql.sql" - }, - "warehouse_id": "cafef00d" - }, - "task_key": "sql_example" - } -] diff --git a/acceptance/bundle/paths/fallback/output.pipeline.json b/acceptance/bundle/paths/fallback/output.pipeline.json deleted file mode 100644 index 7ed4f74e690..00000000000 --- a/acceptance/bundle/paths/fallback/output.pipeline.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "file": { - "path": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/file1.py" - } - }, - { - "notebook": { - "path": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/notebook1" - } - }, - { - "file": { - "path": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/file2.py" - } - }, - { - "notebook": { - "path": "/Workspace/Users/[USERNAME]/.bundle/fallback/development/files/src/notebook2" - } - } -] diff --git a/acceptance/bundle/paths/fallback/output.txt b/acceptance/bundle/paths/fallback/output.txt deleted file mode 100644 index 078943ad41e..00000000000 --- a/acceptance/bundle/paths/fallback/output.txt +++ /dev/null @@ -1,49 +0,0 @@ - ->>> [CLI] bundle validate -t development -o json -Warning: required field "entry_point" is not set - at resources.jobs.my_job.tasks[2].python_wheel_task - in resources/my_job.yml:33:13 - override_job.yml:29:17 - -Error: path ../src/notebook.py is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/override_job.yml:9:32). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in override_job.yml:9:32 - resources/my_job.yml:9:28 - -Error: path ../src/file.py is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/override_job.yml:13:30). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in override_job.yml:13:30 - resources/my_job.yml:14:26 - -Error: path ../src/dbt_project is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/override_job.yml:17:36). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in override_job.yml:17:36 - resources/my_job.yml:19:32 - -Error: path ../src/sql.sql is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/override_job.yml:24:25). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in override_job.yml:24:25 - resources/my_job.yml:27:21 - -Error: path ../src/notebook2.py is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/override_pipeline.yml:13:23). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in override_pipeline.yml:13:23 - -Error: path ../src/file2.py is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/override_pipeline.yml:10:23). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in override_pipeline.yml:10:23 - - -Exit code: 1 - ->>> [CLI] bundle validate -t error -Warning: required field "entry_point" is not set - at resources.jobs.my_job.tasks[2].python_wheel_task - in resources/my_job.yml:33:13 - -Error: notebook "resources/this value is overridden" not found. Local notebook references are expected -to contain one of the following file extensions: [.py, .r, .scala, .sql, .ipynb] - -Name: fallback -Target: error -Workspace: - User: [USERNAME] - Path: /Workspace/Users/[USERNAME]/.bundle/fallback/error - -Found 1 error and 1 warning - -Exit code: 1 diff --git a/acceptance/bundle/paths/fallback/override_job.yml b/acceptance/bundle/paths/fallback/override_job.yml deleted file mode 100644 index c4354b14bb3..00000000000 --- a/acceptance/bundle/paths/fallback/override_job.yml +++ /dev/null @@ -1,41 +0,0 @@ -targets: - development: - resources: - jobs: - my_job: - tasks: - - task_key: notebook_example - notebook_task: - notebook_path: ../src/notebook.py - - - task_key: spark_python_example - spark_python_task: - python_file: ../src/file.py - - - task_key: dbt_example - dbt_task: - project_directory: ../src/dbt_project - commands: - - "dbt run" - - - task_key: sql_example - sql_task: - file: - path: ../src/sql.sql - warehouse_id: cafef00d - - - task_key: python_wheel_example - python_wheel_task: - package_name: my_package - - # Append library; the path is resolved relative to the job's directory. - libraries: - - whl: ../dist/wheel2.whl - - - task_key: spark_jar_example - spark_jar_task: - main_class_name: com.example.Main - - # Append library; the path is resolved relative to the job's directory. - libraries: - - jar: ../target/jar2.jar diff --git a/acceptance/bundle/paths/fallback/override_pipeline.yml b/acceptance/bundle/paths/fallback/override_pipeline.yml deleted file mode 100644 index e5790256aae..00000000000 --- a/acceptance/bundle/paths/fallback/override_pipeline.yml +++ /dev/null @@ -1,13 +0,0 @@ -targets: - development: - resources: - pipelines: - my_pipeline: - - # Append library; the path is resolved relative to the pipeline's directory. - libraries: - - file: - path: ../src/file2.py - - - notebook: - path: ../src/notebook2.py diff --git a/acceptance/bundle/paths/fallback/resources/my_job.yml b/acceptance/bundle/paths/fallback/resources/my_job.yml deleted file mode 100644 index 921ee412b98..00000000000 --- a/acceptance/bundle/paths/fallback/resources/my_job.yml +++ /dev/null @@ -1,48 +0,0 @@ -resources: - jobs: - my_job: - name: "placeholder" - tasks: - - task_key: notebook_example - job_cluster_key: default - notebook_task: - notebook_path: "this value is overridden" - - - task_key: spark_python_example - job_cluster_key: default - spark_python_task: - python_file: "this value is overridden" - - - task_key: dbt_example - job_cluster_key: default - dbt_task: - project_directory: "this value is overridden" - commands: - - "dbt run" - - - task_key: sql_example - job_cluster_key: default - sql_task: - file: - path: "this value is overridden" - warehouse_id: cafef00d - - - task_key: python_wheel_example - job_cluster_key: default - python_wheel_task: - package_name: my_package - libraries: - - whl: ../dist/wheel1.whl - - - task_key: spark_jar_example - job_cluster_key: default - spark_jar_task: - main_class_name: com.example.Main - libraries: - - jar: ../target/jar1.jar - - # Include a job cluster for completeness - job_clusters: - - job_cluster_key: default - new_cluster: - spark_version: 15.4.x-scala2.12 diff --git a/acceptance/bundle/paths/fallback/resources/my_pipeline.yml b/acceptance/bundle/paths/fallback/resources/my_pipeline.yml deleted file mode 100644 index 457856d1d2d..00000000000 --- a/acceptance/bundle/paths/fallback/resources/my_pipeline.yml +++ /dev/null @@ -1,9 +0,0 @@ -resources: - pipelines: - my_pipeline: - name: "placeholder" - libraries: - - file: - path: ../src/file1.py - - notebook: - path: ../src/notebook1.py diff --git a/acceptance/bundle/paths/fallback/script b/acceptance/bundle/paths/fallback/script deleted file mode 100644 index 29aa420c598..00000000000 --- a/acceptance/bundle/paths/fallback/script +++ /dev/null @@ -1,10 +0,0 @@ -errcode trace $CLI bundle validate -t development -o json > output.tmp.json - -# Capture job tasks -jq '.resources.jobs.my_job.tasks' output.tmp.json > output.job.json - -# Capture pipeline libraries -jq '.resources.pipelines.my_pipeline.libraries' output.tmp.json > output.pipeline.json - -# Expect failure for the "error" target -errcode trace $CLI bundle validate -t error diff --git a/acceptance/bundle/paths/fallback/script.cleanup b/acceptance/bundle/paths/fallback/script.cleanup deleted file mode 100644 index f93425dffdb..00000000000 --- a/acceptance/bundle/paths/fallback/script.cleanup +++ /dev/null @@ -1 +0,0 @@ -rm -f output.tmp.json diff --git a/acceptance/bundle/paths/fallback/src/dbt_project/.gitkeep b/acceptance/bundle/paths/fallback/src/dbt_project/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/acceptance/bundle/paths/fallback/src/file.py b/acceptance/bundle/paths/fallback/src/file.py deleted file mode 100644 index 7df869a15e7..00000000000 --- a/acceptance/bundle/paths/fallback/src/file.py +++ /dev/null @@ -1 +0,0 @@ -print("Hello, World!") diff --git a/acceptance/bundle/paths/fallback/src/file1.py b/acceptance/bundle/paths/fallback/src/file1.py deleted file mode 100644 index 7df869a15e7..00000000000 --- a/acceptance/bundle/paths/fallback/src/file1.py +++ /dev/null @@ -1 +0,0 @@ -print("Hello, World!") diff --git a/acceptance/bundle/paths/fallback/src/file2.py b/acceptance/bundle/paths/fallback/src/file2.py deleted file mode 100644 index 7df869a15e7..00000000000 --- a/acceptance/bundle/paths/fallback/src/file2.py +++ /dev/null @@ -1 +0,0 @@ -print("Hello, World!") diff --git a/acceptance/bundle/paths/fallback/src/notebook.py b/acceptance/bundle/paths/fallback/src/notebook.py deleted file mode 100644 index 38d86b79c70..00000000000 --- a/acceptance/bundle/paths/fallback/src/notebook.py +++ /dev/null @@ -1,2 +0,0 @@ -# Databricks notebook source -print("Hello, World!") diff --git a/acceptance/bundle/paths/fallback/src/notebook1.py b/acceptance/bundle/paths/fallback/src/notebook1.py deleted file mode 100644 index 38d86b79c70..00000000000 --- a/acceptance/bundle/paths/fallback/src/notebook1.py +++ /dev/null @@ -1,2 +0,0 @@ -# Databricks notebook source -print("Hello, World!") diff --git a/acceptance/bundle/paths/fallback/src/notebook2.py b/acceptance/bundle/paths/fallback/src/notebook2.py deleted file mode 100644 index 38d86b79c70..00000000000 --- a/acceptance/bundle/paths/fallback/src/notebook2.py +++ /dev/null @@ -1,2 +0,0 @@ -# Databricks notebook source -print("Hello, World!") diff --git a/acceptance/bundle/paths/fallback/src/sql.sql b/acceptance/bundle/paths/fallback/src/sql.sql deleted file mode 100644 index 24c55832d75..00000000000 --- a/acceptance/bundle/paths/fallback/src/sql.sql +++ /dev/null @@ -1 +0,0 @@ -select "Hello, World!" diff --git a/acceptance/bundle/paths/fallback/test.toml b/acceptance/bundle/paths/fallback/test.toml deleted file mode 100644 index a298217f218..00000000000 --- a/acceptance/bundle/paths/fallback/test.toml +++ /dev/null @@ -1,3 +0,0 @@ -[[Repls]] -Old = '\\' -New = '/' diff --git a/acceptance/bundle/paths/fallback_metric/output.txt b/acceptance/bundle/paths/fallback_metric/output.txt deleted file mode 100644 index a98e275088d..00000000000 --- a/acceptance/bundle/paths/fallback_metric/output.txt +++ /dev/null @@ -1,79 +0,0 @@ - ->>> [CLI] bundle deploy -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/fallback_metric/default/files... -Deploying resources... -Updating deployment state... -Deployment complete! - ->>> [CLI] bundle deploy -t fallback -Warn: path ../src/notebook.py is defined relative to the [TEST_TMP_DIR]/resources directory ([TEST_TMP_DIR]/databricks.yml:15:32). Please update the path to be relative to the file where it is defined. The current value will no longer be valid in the next release. -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/fallback_metric/fallback/files... -Deploying resources... -Updating deployment state... -Deployment complete! - ->>> cat out.requests.txt -[ - { - "key": "experimental.use_legacy_run_as", - "value": false - }, - { - "key": "presets_name_prefix_is_set", - "value": false - }, - { - "key": "python_wheel_wrapper_is_set", - "value": false - }, - { - "key": "skip_artifact_cleanup", - "value": false - }, - { - "key": "has_serverless_compute", - "value": false - }, - { - "key": "has_classic_job_compute", - "value": true - }, - { - "key": "has_classic_interactive_compute", - "value": false - } -] -[ - { - "key": "experimental.use_legacy_run_as", - "value": false - }, - { - "key": "presets_name_prefix_is_set", - "value": false - }, - { - "key": "is_job_path_fallback", - "value": true - }, - { - "key": "python_wheel_wrapper_is_set", - "value": false - }, - { - "key": "skip_artifact_cleanup", - "value": false - }, - { - "key": "has_serverless_compute", - "value": false - }, - { - "key": "has_classic_job_compute", - "value": true - }, - { - "key": "has_classic_interactive_compute", - "value": false - } -] diff --git a/bundle/config/mutator/translate_paths.go b/bundle/config/mutator/translate_paths.go index 8798364fec3..f44c7235043 100644 --- a/bundle/config/mutator/translate_paths.go +++ b/bundle/config/mutator/translate_paths.go @@ -383,33 +383,3 @@ func (m *translatePathsDashboards) Apply(ctx context.Context, b *bundle.Bundle) t.applyGenieSpaceTranslations, }) } - -// gatherFallbackPaths collects the fallback paths for relative paths in the configuration. -// Read more about the motivation for this functionality in the "fallback" path translation tests. -func gatherFallbackPaths(v dyn.Value, typ string) (map[string]string, error) { - fallback := make(map[string]string) - pattern := dyn.NewPattern(dyn.Key("resources"), dyn.Key(typ), dyn.AnyKey()) - - // Previous behavior was to use a resource's location as the base path to resolve - // relative paths in its definition. With the introduction of [dyn.Value] throughout, - // we can use the location of the [dyn.Value] of the relative path itself. - // - // This is more flexible, as resources may have overrides that are not - // located in the same directory as the resource configuration file. - // - // To maintain backwards compatibility, we allow relative paths to be resolved using - // the original approach as fallback if the [dyn.Value] location cannot be resolved. - _, err := dyn.MapByPattern(v, pattern, func(p dyn.Path, v dyn.Value) (dyn.Value, error) { - key := p[2].Key() - dir, err := locationDirectory(v.Location()) - if err != nil { - return dyn.InvalidValue, fmt.Errorf("unable to determine directory for %s: %w", p, err) - } - fallback[key] = dir - return v, nil - }) - if err != nil { - return nil, err - } - return fallback, nil -} diff --git a/bundle/config/mutator/translate_paths_jobs.go b/bundle/config/mutator/translate_paths_jobs.go index 4ffab62c89b..2c94e21802b 100644 --- a/bundle/config/mutator/translate_paths_jobs.go +++ b/bundle/config/mutator/translate_paths_jobs.go @@ -2,15 +2,11 @@ package mutator import ( "context" - "fmt" - "path/filepath" "slices" "github.com/databricks/cli/bundle/config/mutator/paths" - "github.com/databricks/cli/libs/diag" "github.com/databricks/cli/libs/dyn" - "github.com/databricks/cli/libs/logdiag" ) type ( @@ -20,13 +16,6 @@ type ( func (t *translateContext) applyJobTranslations(visitor visitFunc, allowOutsideSyncRoot bool) translateFunc { return func(ctx context.Context, v dyn.Value) (dyn.Value, error) { - var err error - - fallback, err := gatherFallbackPaths(v, "jobs") - if err != nil { - return dyn.InvalidValue, err - } - // Do not translate job task paths if using Git source var ignore []string for key, job := range t.b.Config.Resources.Jobs { @@ -54,36 +43,6 @@ func (t *translateContext) applyJobTranslations(visitor visitFunc, allowOutsideS return nv, nil } - // If we failed to rewrite the path, try to rewrite it relative to the fallback directory. - // We only do this for jobs and pipelines because of the comment in [gatherFallbackPaths]. - if fallback[key] != "" { - dir, nerr := locationDirectory(v.Location()) - if nerr != nil { - return dyn.InvalidValue, nerr - } - - dirRel, nerr := filepath.Rel(t.b.BundleRootPath, dir) - if nerr != nil { - return dyn.InvalidValue, nerr - } - - originalPath, nerr := filepath.Rel(dirRel, v.MustString()) - if nerr != nil { - return dyn.InvalidValue, nerr - } - - originalValue := dyn.NewValue(originalPath, v.Locations()) - nv, nerr := t.rewriteValue(ctx, p, originalValue, fallback[key], opts) - if nerr == nil { - logdiag.LogDiag(ctx, diag.Diagnostic{ - Severity: diag.Error, - Summary: fmt.Sprintf("path %s is defined relative to the %s directory (%s). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier).", originalPath, fallback[key], v.Location()), - Locations: v.Locations(), - }) - return nv, nil - } - } - return dyn.InvalidValue, err }) } diff --git a/bundle/config/mutator/translate_paths_pipelines.go b/bundle/config/mutator/translate_paths_pipelines.go index 53848461bd2..07c2e58cd93 100644 --- a/bundle/config/mutator/translate_paths_pipelines.go +++ b/bundle/config/mutator/translate_paths_pipelines.go @@ -2,27 +2,15 @@ package mutator import ( "context" - "fmt" - "path/filepath" "github.com/databricks/cli/bundle/config/mutator/paths" - "github.com/databricks/cli/libs/diag" "github.com/databricks/cli/libs/dyn" - "github.com/databricks/cli/libs/logdiag" ) func (t *translateContext) applyPipelineTranslations(visitor visitFunc, allowOutsideSyncRoot bool) translateFunc { return func(ctx context.Context, v dyn.Value) (dyn.Value, error) { - var err error - - fallback, err := gatherFallbackPaths(v, "pipelines") - if err != nil { - return dyn.InvalidValue, err - } - return visitor(v, func(p dyn.Path, mode paths.TranslateMode, v dyn.Value) (dyn.Value, error) { - key := p[2].Key() opts := translateOptions{ Mode: mode, AllowPathOutsideSyncRoot: allowOutsideSyncRoot, @@ -34,35 +22,6 @@ func (t *translateContext) applyPipelineTranslations(visitor visitFunc, allowOut return nv, nil } - // If we failed to rewrite the path, it uses an old path format which relied on fallback. - if fallback[key] != "" { - dir, nerr := locationDirectory(v.Location()) - if nerr != nil { - return dyn.InvalidValue, nerr - } - - dirRel, nerr := filepath.Rel(t.b.BundleRootPath, dir) - if nerr != nil { - return dyn.InvalidValue, nerr - } - - originalPath, nerr := filepath.Rel(dirRel, v.MustString()) - if nerr != nil { - return dyn.InvalidValue, nerr - } - - originalValue := dyn.NewValue(originalPath, v.Locations()) - nv, nerr := t.rewriteValue(ctx, p, originalValue, fallback[key], opts) - if nerr == nil { - logdiag.LogDiag(ctx, diag.Diagnostic{ - Severity: diag.Error, - Summary: fmt.Sprintf("path %s is defined relative to the %s directory (%s). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier).", originalPath, fallback[key], v.Location()), - Locations: v.Locations(), - }) - return nv, nil - } - } - return dyn.InvalidValue, err }) } From 2e93c0ac6f48b212bfa6743124e73508b1713b5d Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 15 Oct 2026 13:13:33 +0200 Subject: [PATCH 2/2] update output --- .../validate/variable_overrides_file_complex_path/output.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt b/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt index 87fb1b3b20b..91342a421cb 100644 --- a/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt +++ b/acceptance/bundle/validate/variable_overrides_file_complex_path/output.txt @@ -1,7 +1,6 @@ >>> [CLI] bundle validate -o json -Error: path src/main.py is defined relative to the [TEST_TMP_DIR] directory ([TEST_TMP_DIR]/.databricks/bundle/default/variable-overrides.json:6:37). Please update the path to be relative to the file where it is defined or use earlier version of CLI (0.261.0 or earlier). - in .databricks/bundle/default/variable-overrides.json:6:37 +Error: file .databricks/bundle/default/src/main.py not found Exit code: 1 @@ -14,7 +13,7 @@ Exit code: 1 } ], "spark_python_task": { - "python_file": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/src/main.py" + "python_file": ".databricks/bundle/default/src/main.py" }, "task_key": "main" }