From 1713b488f999cb8002a505931faec10eff7b21db Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Fri, 17 Apr 2026 13:38:24 +0200 Subject: [PATCH 1/2] acc: Fix the output for run_as/job_default test --- .../bundle/run_as/job_default/output.txt | 66 +------------------ acceptance/bundle/run_as/job_default/script | 4 +- 2 files changed, 4 insertions(+), 66 deletions(-) diff --git a/acceptance/bundle/run_as/job_default/output.txt b/acceptance/bundle/run_as/job_default/output.txt index a9212a7da5..5722187e8f 100644 --- a/acceptance/bundle/run_as/job_default/output.txt +++ b/acceptance/bundle/run_as/job_default/output.txt @@ -8,37 +8,7 @@ Deployment complete! >>> print_requests.py //jobs { - "method": "POST", - "path": "/api/2.2/jobs/create", - "body": { - "deployment": { - "kind": "BUNDLE", - "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default/state/metadata.json" - }, - "edit_mode": "UI_LOCKED", - "format": "MULTI_TASK", - "max_concurrent_runs": 1, - "name": "Untitled", - "queue": { - "enabled": true - }, - "run_as": { - "user_name": "deco-test-user@databricks.com" - }, - "tasks": [ - { - "new_cluster": { - "node_type_id": "[NODE_TYPE_ID]", - "num_workers": 1, - "spark_version": "13.3.x-snapshot-scala2.12" - }, - "notebook_task": { - "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default/files/test" - }, - "task_key": "task_one" - } - ] - } + "user_name": "deco-test-user@databricks.com" } >>> [CLI] jobs get [NUMID] @@ -59,39 +29,7 @@ Updating deployment state... Deployment complete! >>> print_requests.py //jobs -{ - "method": "POST", - "path": "/api/2.2/jobs/reset", - "body": { - "job_id": [NUMID], - "new_settings": { - "deployment": { - "kind": "BUNDLE", - "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default/state/metadata.json" - }, - "edit_mode": "UI_LOCKED", - "format": "MULTI_TASK", - "max_concurrent_runs": 1, - "name": "Untitled", - "queue": { - "enabled": true - }, - "tasks": [ - { - "new_cluster": { - "node_type_id": "[NODE_TYPE_ID]", - "num_workers": 1, - "spark_version": "13.3.x-snapshot-scala2.12" - }, - "notebook_task": { - "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default/files/test" - }, - "task_key": "task_one" - } - ] - } - } -} +null >>> [CLI] jobs get [NUMID] { diff --git a/acceptance/bundle/run_as/job_default/script b/acceptance/bundle/run_as/job_default/script index 3e80f98838..b3a3adf1a3 100644 --- a/acceptance/bundle/run_as/job_default/script +++ b/acceptance/bundle/run_as/job_default/script @@ -8,7 +8,7 @@ trap cleanup EXIT title "Deploy with run_as" trace $CLI bundle deploy -trace print_requests.py //jobs | contains.py "!GET" "POST" +trace print_requests.py //jobs | contains.py "!GET" "POST" | jq '.body.run_as' JOB_ID=$($CLI bundle summary -o json | jq -r '.resources.jobs.job_with_run_as.id') trace $CLI jobs get $JOB_ID | jq -r '.settings.run_as' @@ -18,5 +18,5 @@ update_file.py databricks.yml "run_as: title "Remove run_as and redeploy" trace $CLI bundle plan trace $CLI bundle deploy -trace print_requests.py //jobs | contains.py "!GET" "POST" +trace print_requests.py //jobs | contains.py "!GET" "POST" | jq '.body.run_as' trace $CLI jobs get $JOB_ID | jq -r '.settings.run_as' From fc0afca7e598ce2bd84f19226483a4cd7cde075a Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Fri, 17 Apr 2026 14:48:05 +0200 Subject: [PATCH 2/2] fix --- .../run_as/job_default/databricks.yml.tmpl | 2 +- .../bundle/run_as/job_default/out.test.toml | 2 +- .../bundle/run_as/job_default/output.txt | 72 +++++++++++++++++-- acceptance/bundle/run_as/job_default/script | 4 +- .../bundle/run_as/job_default/test.toml | 2 +- 5 files changed, 72 insertions(+), 10 deletions(-) diff --git a/acceptance/bundle/run_as/job_default/databricks.yml.tmpl b/acceptance/bundle/run_as/job_default/databricks.yml.tmpl index 0099613dc1..31a49d96ef 100644 --- a/acceptance/bundle/run_as/job_default/databricks.yml.tmpl +++ b/acceptance/bundle/run_as/job_default/databricks.yml.tmpl @@ -1,5 +1,5 @@ bundle: - name: "run_as_job_default" + name: "run_as_job_default_$UNIQUE_NAME" resources: jobs: diff --git a/acceptance/bundle/run_as/job_default/out.test.toml b/acceptance/bundle/run_as/job_default/out.test.toml index f474b1b917..1ae6b5ffce 100644 --- a/acceptance/bundle/run_as/job_default/out.test.toml +++ b/acceptance/bundle/run_as/job_default/out.test.toml @@ -2,4 +2,4 @@ Local = false Cloud = true [EnvMatrix] - DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] + DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/run_as/job_default/output.txt b/acceptance/bundle/run_as/job_default/output.txt index 5722187e8f..137a49cbd8 100644 --- a/acceptance/bundle/run_as/job_default/output.txt +++ b/acceptance/bundle/run_as/job_default/output.txt @@ -1,14 +1,44 @@ === Deploy with run_as >>> [CLI] bundle deploy -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default/files... +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... Deployment complete! >>> print_requests.py //jobs { - "user_name": "deco-test-user@databricks.com" + "method": "POST", + "path": "/api/2.2/jobs/create", + "body": { + "deployment": { + "kind": "BUNDLE", + "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/state/metadata.json" + }, + "edit_mode": "UI_LOCKED", + "format": "MULTI_TASK", + "max_concurrent_runs": 1, + "name": "Untitled", + "queue": { + "enabled": true + }, + "run_as": { + "user_name": "deco-test-user@databricks.com" + }, + "tasks": [ + { + "new_cluster": { + "node_type_id": "[NODE_TYPE_ID]", + "num_workers": 1, + "spark_version": "13.3.x-snapshot-scala2.12" + }, + "notebook_task": { + "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/files/test" + }, + "task_key": "task_one" + } + ] + } } >>> [CLI] jobs get [NUMID] @@ -23,13 +53,45 @@ update jobs.job_with_run_as Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged >>> [CLI] bundle deploy -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default/files... +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... Deployment complete! >>> print_requests.py //jobs -null +{ + "method": "POST", + "path": "/api/2.2/jobs/reset", + "body": { + "job_id": [NUMID], + "new_settings": { + "deployment": { + "kind": "BUNDLE", + "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/state/metadata.json" + }, + "edit_mode": "UI_LOCKED", + "format": "MULTI_TASK", + "max_concurrent_runs": 1, + "name": "Untitled", + "queue": { + "enabled": true + }, + "tasks": [ + { + "new_cluster": { + "node_type_id": "[NODE_TYPE_ID]", + "num_workers": 1, + "spark_version": "13.3.x-snapshot-scala2.12" + }, + "notebook_task": { + "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default/files/test" + }, + "task_key": "task_one" + } + ] + } + } +} >>> [CLI] jobs get [NUMID] { @@ -40,7 +102,7 @@ null The following resources will be deleted: delete resources.jobs.job_with_run_as -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/run_as_job_default/default +All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/run_as_job_default_[UNIQUE_NAME]/default Deleting files... Destroy complete! diff --git a/acceptance/bundle/run_as/job_default/script b/acceptance/bundle/run_as/job_default/script index b3a3adf1a3..3e80f98838 100644 --- a/acceptance/bundle/run_as/job_default/script +++ b/acceptance/bundle/run_as/job_default/script @@ -8,7 +8,7 @@ trap cleanup EXIT title "Deploy with run_as" trace $CLI bundle deploy -trace print_requests.py //jobs | contains.py "!GET" "POST" | jq '.body.run_as' +trace print_requests.py //jobs | contains.py "!GET" "POST" JOB_ID=$($CLI bundle summary -o json | jq -r '.resources.jobs.job_with_run_as.id') trace $CLI jobs get $JOB_ID | jq -r '.settings.run_as' @@ -18,5 +18,5 @@ update_file.py databricks.yml "run_as: title "Remove run_as and redeploy" trace $CLI bundle plan trace $CLI bundle deploy -trace print_requests.py //jobs | contains.py "!GET" "POST" | jq '.body.run_as' +trace print_requests.py //jobs | contains.py "!GET" "POST" trace $CLI jobs get $JOB_ID | jq -r '.settings.run_as' diff --git a/acceptance/bundle/run_as/job_default/test.toml b/acceptance/bundle/run_as/job_default/test.toml index dc759097e8..8429d3c7e1 100644 --- a/acceptance/bundle/run_as/job_default/test.toml +++ b/acceptance/bundle/run_as/job_default/test.toml @@ -5,4 +5,4 @@ Cloud = true RecordRequests = true [EnvMatrix] - DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] + DATABRICKS_BUNDLE_ENGINE = ["direct"]