From c768353470e105a66a244ff6a8529d628720726d Mon Sep 17 00:00:00 2001 From: "ilya.kuznetsov" Date: Tue, 24 Nov 2026 21:03:50 +0000 Subject: [PATCH 1/2] WIP: implement Co-authored-by: Isaac --- .../yaml_anchors/databricks.yml.tmpl | 36 ++++++++ .../yaml_anchors/out.test.toml | 3 + .../yaml_anchors/output.txt | 55 ++++++++++++ .../config-remote-sync/yaml_anchors/script | 31 +++++++ .../config-remote-sync/yaml_anchors/test.toml | 6 ++ bundle/configsync/patch.go | 86 ++++++++++++++++++- bundle/configsync/patch_test.go | 48 +++++++++++ 7 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 acceptance/bundle/config-remote-sync/yaml_anchors/databricks.yml.tmpl create mode 100644 acceptance/bundle/config-remote-sync/yaml_anchors/out.test.toml create mode 100644 acceptance/bundle/config-remote-sync/yaml_anchors/output.txt create mode 100644 acceptance/bundle/config-remote-sync/yaml_anchors/script create mode 100644 acceptance/bundle/config-remote-sync/yaml_anchors/test.toml diff --git a/acceptance/bundle/config-remote-sync/yaml_anchors/databricks.yml.tmpl b/acceptance/bundle/config-remote-sync/yaml_anchors/databricks.yml.tmpl new file mode 100644 index 00000000000..dbd4ec74bda --- /dev/null +++ b/acceptance/bundle/config-remote-sync/yaml_anchors/databricks.yml.tmpl @@ -0,0 +1,36 @@ +bundle: + name: test-bundle-$UNIQUE_NAME + +resources: + jobs: + my_job: + job_clusters: + - job_cluster_key: main + new_cluster: &cluster + spark_version: $DEFAULT_SPARK_VERSION + node_type_id: $NODE_TYPE_ID + num_workers: 1 + - job_cluster_key: large + new_cluster: *cluster + tasks: + - task_key: setup + job_cluster_key: main + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/setup + libraries: &common_libs + - pypi: + package: requests + - task_key: ingest + job_cluster_key: main + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/ingest + libraries: *common_libs + - task_key: transform + job_cluster_key: main + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/transform + libraries: *common_libs + +targets: + default: + mode: development diff --git a/acceptance/bundle/config-remote-sync/yaml_anchors/out.test.toml b/acceptance/bundle/config-remote-sync/yaml_anchors/out.test.toml new file mode 100644 index 00000000000..a4f8dd5ef74 --- /dev/null +++ b/acceptance/bundle/config-remote-sync/yaml_anchors/out.test.toml @@ -0,0 +1,3 @@ +Cloud = true +GOOS.windows = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt b/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt new file mode 100644 index 00000000000..fb4db09ca17 --- /dev/null +++ b/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt @@ -0,0 +1,55 @@ +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... +Created jobs.my_job +Files: 2 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged + +=== Remove libraries from the task that defines the anchor and move another task to the large cluster + +=== Detect and save changes +Detected changes in 1 resource(s): + +Resource: resources.jobs.my_job + tasks[task_key='setup'].libraries: remove + tasks[task_key='transform'].job_cluster_key: replace + + + +=== Configuration changes + +>>> diff.py databricks.yml.backup databricks.yml +--- databricks.yml.backup ++++ databricks.yml +@@ -18,14 +18,13 @@ + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/setup +- libraries: &common_libs +- - pypi: +- package: requests + - task_key: ingest + job_cluster_key: main + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/ingest +- libraries: *common_libs ++ libraries: &common_libs ++ - pypi: ++ package: requests + - task_key: transform +- job_cluster_key: main ++ job_cluster_key: large + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/transform + +=== Remaining tasks keep the shared libraries + +>>> [CLI] bundle validate -o json +{"task_key":"ingest","job_cluster_key":"main","libraries":[{"pypi":{"package":"requests"}}]} +{"task_key":"setup","job_cluster_key":"main","libraries":null} +{"task_key":"transform","job_cluster_key":"large","libraries":[{"pypi":{"package":"requests"}}]} + +>>> [CLI] bundle destroy --auto-approve +The following resources will be deleted: + delete resources.jobs.my_job + +All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default + +Destroy: 1 deleted diff --git a/acceptance/bundle/config-remote-sync/yaml_anchors/script b/acceptance/bundle/config-remote-sync/yaml_anchors/script new file mode 100644 index 00000000000..cd9050adfdc --- /dev/null +++ b/acceptance/bundle/config-remote-sync/yaml_anchors/script @@ -0,0 +1,31 @@ +#!/bin/bash + +envsubst < databricks.yml.tmpl > databricks.yml + +cleanup() { + trace $CLI bundle destroy --auto-approve +} +trap cleanup EXIT + +$CLI bundle deploy +job_id="$(read_id.py my_job)" + +title "Remove libraries from the task that defines the anchor and move another task to the large cluster" +edit_resource.py jobs $job_id < Date: Tue, 24 Nov 2026 21:19:32 +0000 Subject: [PATCH 2/2] WIP: review round 1 fixes Co-authored-by: Isaac --- .../yaml_anchors/output.txt | 19 ++- .../config-remote-sync/yaml_anchors/script | 6 +- bundle/configsync/patch.go | 119 ++++++++++++------ bundle/configsync/patch_test.go | 51 +++++++- 4 files changed, 149 insertions(+), 46 deletions(-) diff --git a/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt b/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt index fb4db09ca17..0f503724607 100644 --- a/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt +++ b/acceptance/bundle/config-remote-sync/yaml_anchors/output.txt @@ -3,12 +3,13 @@ Created jobs.my_job Files: 2 uploaded, 0 deleted Resources: 1 created, 0 changed, 0 deleted, 0 unchanged -=== Remove libraries from the task that defines the anchor and move another task to the large cluster +=== Remove the libraries of the task that defines the anchor, change the library of one aliased task and move another to the large cluster === Detect and save changes Detected changes in 1 resource(s): Resource: resources.jobs.my_job + tasks[task_key='ingest'].libraries[0].pypi.package: replace tasks[task_key='setup'].libraries: remove tasks[task_key='transform'].job_cluster_key: replace @@ -19,7 +20,7 @@ Resource: resources.jobs.my_job >>> diff.py databricks.yml.backup databricks.yml --- databricks.yml.backup +++ databricks.yml -@@ -18,14 +18,13 @@ +@@ -18,17 +18,18 @@ notebook_task: notebook_path: /Users/{{workspace_user_name}}/setup - libraries: &common_libs @@ -30,19 +31,25 @@ Resource: resources.jobs.my_job notebook_task: notebook_path: /Users/{{workspace_user_name}}/ingest - libraries: *common_libs -+ libraries: &common_libs ++ libraries: + - pypi: -+ package: requests ++ package: httpx - task_key: transform - job_cluster_key: main + job_cluster_key: large notebook_task: notebook_path: /Users/{{workspace_user_name}}/transform +- libraries: *common_libs ++ libraries: &common_libs ++ - pypi: ++ package: requests + + targets: -=== Remaining tasks keep the shared libraries +=== Only the changed tasks differ >>> [CLI] bundle validate -o json -{"task_key":"ingest","job_cluster_key":"main","libraries":[{"pypi":{"package":"requests"}}]} +{"task_key":"ingest","job_cluster_key":"main","libraries":[{"pypi":{"package":"httpx"}}]} {"task_key":"setup","job_cluster_key":"main","libraries":null} {"task_key":"transform","job_cluster_key":"large","libraries":[{"pypi":{"package":"requests"}}]} diff --git a/acceptance/bundle/config-remote-sync/yaml_anchors/script b/acceptance/bundle/config-remote-sync/yaml_anchors/script index cd9050adfdc..f74f9840148 100644 --- a/acceptance/bundle/config-remote-sync/yaml_anchors/script +++ b/acceptance/bundle/config-remote-sync/yaml_anchors/script @@ -10,11 +10,13 @@ trap cleanup EXIT $CLI bundle deploy job_id="$(read_id.py my_job)" -title "Remove libraries from the task that defines the anchor and move another task to the large cluster" +title "Remove the libraries of the task that defines the anchor, change the library of one aliased task and move another to the large cluster" edit_resource.py jobs $job_id <