Skip to content

Commit 6444cb8

Browse files
authored
bundle deploy/destroy: report per-resource actions and a summary (#5720)
`bundle deploy` now lists the per-resource actions and summary lines, instead of generic progress chatter: ``` Uploading bundle files to /Workspace/Users/me@example.com/.bundle/my_project/dev/files... Created jobs.my_job Created jobs.no_tasks_job Files: 7 uploaded, 0 deleted Resources: 2 created, 0 changed, 0 deleted, 0 unchanged ``` `Files:` is reported separately because a deploy that only changes business logic (a `.py` or `.sql` file) leaves every resource unchanged, so a lone `0 changed` reads like a no-op. Both lines always print, so the shape of the output does not vary between deploys. A deploy that fails after uploading still reports `Files:` — those files were uploaded. It does not report `Resources:`, which would describe what was intended rather than what was applied. `bundle destroy` gets a matching summary line (`Destroy: N deleted`), counting top-level resources to match its approval list. ## Details - Add `CountActions()`/`ActionCounts` and `NotSelected` to `deployplan.Plan`. - `libs/sync` retains the upload/delete counts from its diff; `b.Files` lists every tracked file, not the changed ones. - `-q`/`--quiet` prints only the summary lines. Repeat it (`-qq`) to print only warnings and errors, which also drops progress messages (`Uploading bundle files to ...`, `Building ...`, `Executing 'postdeploy' script`). Supported on `plan`, `deploy`, `destroy` and `pipelines deploy`; `destroy` did not have `-q` before. It is a repeat counter, and progress suppression travels on the context (`cmdio.WithQuiet`/`LogProgress`) because those messages come from mutators that receive no bundle. `acceptance/bundle/quiet-levels` covers all nine command/level combinations; acceptance tests use `-qq` where the engines genuinely diverge per-resource. - With `--select`, the resource summary appends `, N not selected`. - Drop progress chatter: `Deploying resources...`, `Deployment complete!`, `Updating deployment state...`, `Deleting files...`, `Destroy complete!`. - The summary prints after the `postdeploy` script, so a failing script is not preceded by a line that appears to vouch for the run; it still prints on that failure (the resources were applied) and the script's error still propagates.
1 parent b2cee42 commit 6444cb8

676 files changed

Lines changed: 3854 additions & 3444 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* `bundle deploy` now reports the per-resource actions it took, how many files it synced, and a summary of created/changed/deleted/unchanged resources; `bundle destroy` reports how many resources it deleted. `-q` prints only the summaries, `-qq` only warnings and errors. ([#5720](https://github.com/databricks/cli/pull/5720))

acceptance/apps/deploy/bundle-no-args-with-flags/output.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
>>> [CLI] apps deploy --skip-validation --auto-approve --force-lock --fail-on-active-runs
33
Deploying project...
44
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
5-
Deploying resources...
6-
Updating deployment state...
7-
Deployment complete!
5+
Created apps.myapp
6+
Files: 6 uploaded, 0 deleted
7+
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
88
✓ Getting the status of the app myapp
99
✓ App is in UNAVAILABLE state
1010
✓ App compute is in STOPPED state
@@ -21,5 +21,4 @@ The following resources will be deleted:
2121

2222
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
2323

24-
Deleting files...
25-
Destroy complete!
24+
Destroy: 1 deleted

acceptance/apps/deploy/bundle-no-args/output.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
>>> [CLI] apps deploy --skip-validation
33
Deploying project...
44
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
5-
Deploying resources...
6-
Updating deployment state...
7-
Deployment complete!
5+
Created apps.myapp
6+
Files: 6 uploaded, 0 deleted
7+
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
88
✓ Getting the status of the app myapp
99
✓ App is in UNAVAILABLE state
1010
✓ App compute is in STOPPED state
@@ -21,5 +21,4 @@ The following resources will be deleted:
2121

2222
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
2323

24-
Deleting files...
25-
Destroy complete!
24+
Destroy: 1 deleted

acceptance/bundle/ai_runtime_task/local_code_source/output.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
>>> [CLI] bundle deploy
55
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/ai-runtime-test/default/files...
6-
Deploying resources...
7-
Updating deployment state...
8-
Deployment complete!
6+
Created jobs.train
7+
Files: 14 uploaded, 0 deleted
8+
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
99

1010
=== each task's tarball holds only synced files (both under the repo root .air_snapshots)
1111

@@ -110,9 +110,9 @@ Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
110110

111111
>>> [CLI] bundle deploy
112112
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/ai-runtime-test/default/files...
113-
Deploying resources...
114-
Updating deployment state...
115-
Deployment complete!
113+
Updated jobs.train
114+
Files: 4 uploaded, 1 deleted
115+
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
116116

117117
>>> print_requests.py --sort --del-field raw_body //.air_snapshots/
118118
{
@@ -131,5 +131,4 @@ The following resources will be deleted:
131131

132132
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/ai-runtime-test/default
133133

134-
Deleting files...
135-
Destroy complete!
134+
Destroy: 1 deleted

acceptance/bundle/apps/app_yaml/output.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
1515

1616
>>> [CLI] bundle deploy
1717
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
18-
Deploying resources...
19-
Updating deployment state...
20-
Deployment complete!
18+
Created apps.myapp
19+
Files: 7 uploaded, 0 deleted
20+
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
2121

2222
>>> jq select(.path | test("app.yml")) out.requests.txt
2323

@@ -27,8 +27,7 @@ The following resources will be deleted:
2727

2828
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
2929

30-
Deleting files...
31-
Destroy complete!
30+
Destroy: 1 deleted
3231

3332
>>> print_requests.py //apps
3433
{

acceptance/bundle/apps/compute_size/out.update.direct.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
>>> errcode [CLI] bundle deploy
33
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-compute-size-[UNIQUE_NAME]/files...
4-
Deploying resources...
5-
Updating deployment state...
6-
Deployment complete!
4+
Updated apps.my_app
5+
Files: 4 uploaded, 0 deleted
6+
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
77

88
>>> [CLI] apps get app-[UNIQUE_NAME]
99
{

acceptance/bundle/apps/compute_size/out.update.terraform.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
>>> errcode [CLI] bundle deploy
33
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-compute-size-[UNIQUE_NAME]/files...
4-
Deploying resources...
54
Error: terraform apply: exit status 1
65

76
Error: failed to update app
@@ -14,7 +13,7 @@ Compute size updates are not supported in this update API. Please use the new
1413
update API instead.
1514

1615

17-
Updating deployment state...
16+
Files: 4 uploaded, 0 deleted
1817

1918
Exit code: 1
2019

acceptance/bundle/apps/compute_size/output.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
=== Deploy bundle
33
>>> [CLI] bundle deploy
44
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-compute-size-[UNIQUE_NAME]/files...
5-
Deploying resources...
6-
Updating deployment state...
7-
Deployment complete!
5+
Created apps.my_app
6+
Files: 8 uploaded, 0 deleted
7+
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
88

99
=== Update compute size and redeploy
1010
>>> [CLI] bundle destroy --auto-approve
@@ -13,5 +13,4 @@ The following resources will be deleted:
1313

1414
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/app-compute-size-[UNIQUE_NAME]
1515

16-
Deleting files...
17-
Destroy complete!
16+
Destroy: 1 deleted

acceptance/bundle/apps/git_source/output.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
1818
=== Deploy bundle
1919
>>> [CLI] bundle deploy
2020
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-git-source-[UNIQUE_NAME]/files...
21-
Deploying resources...
22-
Updating deployment state...
23-
Deployment complete!
21+
Created apps.my_app
22+
Files: 8 uploaded, 0 deleted
23+
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
2424

2525
>>> [CLI] bundle run my_app
2626
✓ Getting the status of the app [APP_NAME]
@@ -61,9 +61,8 @@ You can access the app at [APP_NAME]-123.cloud.databricksapps.com
6161
=== Update git_source branch and redeploy
6262
>>> [CLI] bundle deploy
6363
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-git-source-[UNIQUE_NAME]/files...
64-
Deploying resources...
65-
Updating deployment state...
66-
Deployment complete!
64+
Files: 5 uploaded, 0 deleted
65+
Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
6766

6867
=== Verify config update was applied
6968
>>> [CLI] apps get [APP_NAME] --output json
@@ -78,5 +77,4 @@ The following resources will be deleted:
7877

7978
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/app-git-source-[UNIQUE_NAME]
8079

81-
Deleting files...
82-
Destroy complete!
80+
Destroy: 1 deleted

acceptance/bundle/apps/job_permissions/databricks.yml.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
bundle:
22
name: test-bundle-$UNIQUE_NAME
33

4+
# This test deploys several times and reports how many files each deploy uploaded, so
5+
# nothing written between the deploys may end up in the synced tree: the script's own
6+
# out.after_first_deploy.*, and the test runner's output.txt / ACC_REPLS, which it keeps
7+
# appending to while the deploy runs.
8+
sync:
9+
exclude:
10+
- out*
11+
- ACC_REPLS
12+
413
permissions:
514
- level: CAN_MANAGE
615
user_name: ${workspace.current_user.userName}

0 commit comments

Comments
 (0)