Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bundle:
name: out-of-band-delete

resources:
jobs:
foo:
name: test-job
tasks:
- task_key: my_task
spark_python_task:
python_file: ./hello_world.py
new_cluster:
num_workers: 1
spark_version: 13.3.x-snapshot-scala2.12
node_type_id: i3.xlarge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello World!")

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

=== After the initial deploy the python_file exists
>>> [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py
{
"object_type": "FILE",
"path": "/Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py"
}

=== Delete the remote bundle directory out-of-band (simulates deleting it in the UI)
>>> [CLI] workspace delete --recursive /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete

=== Redeploy reuses the stale snapshot, so the python_file is NOT re-uploaded
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> musterr [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py
Error: Workspace path not found

=== Removing the sync snapshot forces a full re-upload, restoring the python_file
>>> rm -rf .databricks/bundle/default/sync-snapshots

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> [CLI] workspace get-status /Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py
{
"object_type": "FILE",
"path": "/Workspace/Users/[USERNAME]/.bundle/out-of-band-delete/default/files/hello_world.py"
}
21 changes: 21 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Reproduces https://github.com/databricks/cli/issues/1976: after the remote bundle
# files are deleted out-of-band, a plain redeploy does not re-upload them.

BUNDLE_PATH="/Workspace/Users/${CURRENT_USER_NAME}/.bundle/out-of-band-delete/default"

trace $CLI bundle deploy

title "After the initial deploy the python_file exists"
trace $CLI workspace get-status "$BUNDLE_PATH/files/hello_world.py" | jq '{object_type,path}'

title "Delete the remote bundle directory out-of-band (simulates deleting it in the UI)"
trace $CLI workspace delete --recursive "/Workspace/Users/${CURRENT_USER_NAME}/.bundle/out-of-band-delete"

title "Redeploy reuses the stale snapshot, so the python_file is NOT re-uploaded"
trace $CLI bundle deploy
trace musterr $CLI workspace get-status "$BUNDLE_PATH/files/hello_world.py"

title "Removing the sync snapshot forces a full re-upload, restoring the python_file"
trace rm -rf .databricks/bundle/default/sync-snapshots
trace $CLI bundle deploy
trace $CLI workspace get-status "$BUNDLE_PATH/files/hello_world.py" | jq '{object_type,path}'
9 changes: 9 additions & 0 deletions acceptance/bundle/deploy/files/out-of-band-delete/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Badness = "After the remote bundle files are deleted out-of-band, the next deploy does not re-upload them until the local sync snapshot is removed."

[Env]
# This test passes absolute workspace paths like /Workspace/Users/.../hello_world.py
# as CLI arguments. On Windows the script runs under MSYS2, which rewrites such
# leading-slash arguments to Windows paths (e.g. C:/Program Files/Git/Workspace/...)
# before the CLI sees them, so workspace get-status would query the wrong path.
# Setting this environment variable disables that conversion.
MSYS_NO_PATHCONV = "1"
Loading