diff --git a/acceptance/bundle/config-remote-sync/task_rename_revert/databricks.yml.tmpl b/acceptance/bundle/config-remote-sync/task_rename_revert/databricks.yml.tmpl new file mode 100644 index 0000000000..7aa0dbecc2 --- /dev/null +++ b/acceptance/bundle/config-remote-sync/task_rename_revert/databricks.yml.tmpl @@ -0,0 +1,18 @@ +bundle: + name: test-bundle-$UNIQUE_NAME + +resources: + jobs: + sample_job: + tasks: + - task_key: new_task + notebook_task: + notebook_path: /Users/{{workspace_user_name}}/new_task + new_cluster: + spark_version: $DEFAULT_SPARK_VERSION + node_type_id: $NODE_TYPE_ID + num_workers: 1 + +targets: + default: + mode: development diff --git a/acceptance/bundle/config-remote-sync/task_rename_revert/out.test.toml b/acceptance/bundle/config-remote-sync/task_rename_revert/out.test.toml new file mode 100644 index 0000000000..579b1e4a3c --- /dev/null +++ b/acceptance/bundle/config-remote-sync/task_rename_revert/out.test.toml @@ -0,0 +1,4 @@ +Local = true +Cloud = true +GOOS.windows = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"] diff --git a/acceptance/bundle/config-remote-sync/task_rename_revert/output.txt b/acceptance/bundle/config-remote-sync/task_rename_revert/output.txt new file mode 100644 index 0000000000..f05ccc1c74 --- /dev/null +++ b/acceptance/bundle/config-remote-sync/task_rename_revert/output.txt @@ -0,0 +1,67 @@ +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... +Deploying resources... +Updating deployment state... +Deployment complete! + +=== Rename task to new_task_2 remotely + +=== Sync the rename into config (no redeploy) +Detected changes in 1 resource(s): + +Resource: resources.jobs.sample_job + tasks[task_key='new_task']: remove + tasks[task_key='new_task_2']: add + + + +>>> diff.py databricks.yml.backup databricks.yml +--- databricks.yml.backup ++++ databricks.yml +@@ -6,11 +6,11 @@ + sample_job: + tasks: +- - task_key: new_task +- notebook_task: +- notebook_path: /Users/{{workspace_user_name}}/new_task +- new_cluster: +- spark_version: 13.3.x-snapshot-scala2.12 ++ - new_cluster: + node_type_id: [NODE_TYPE_ID] + num_workers: 1 ++ spark_version: 13.3.x-snapshot-scala2.12 ++ notebook_task: ++ notebook_path: '/Users/{{workspace_user_name}}/new_task' ++ task_key: new_task_2 + + targets: + +=== Rename task back to new_task remotely + +=== Sync the revert into config +Detected changes in 1 resource(s): + +Resource: resources.jobs.sample_job + tasks[task_key='new_task']: add + tasks[task_key='new_task_2']: remove + + + +>>> diff.py databricks.yml.backup databricks.yml +--- databricks.yml.backup ++++ databricks.yml +@@ -12,5 +12,5 @@ + notebook_task: + notebook_path: '/Users/{{workspace_user_name}}/new_task' +- task_key: new_task_2 ++ task_key: new_task + + targets: + +>>> [CLI] bundle destroy --auto-approve +The following resources will be deleted: + delete resources.jobs.sample_job + +All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default + +Deleting files... +Destroy complete! diff --git a/acceptance/bundle/config-remote-sync/task_rename_revert/script b/acceptance/bundle/config-remote-sync/task_rename_revert/script new file mode 100644 index 0000000000..a01c1196de --- /dev/null +++ b/acceptance/bundle/config-remote-sync/task_rename_revert/script @@ -0,0 +1,45 @@ +#!/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 sample_job)" + +title "Rename task to new_task_2 remotely" +echo +edit_resource.py jobs $job_id <