Skip to content

Commit efa69f4

Browse files
authored
Add summary for 'bundle plan' output (#3546)
## Changes 1. Changed plan output to be printed from stderr (cmdio.LogString) to stdout (fmt.Printf/fmt.Println) 2. Added summary line with counts: Plan: X to add, Y to change, Z to delete Example output: ``` create job.my_project_job delete job.sample_job create pipeline.my_project_pipeline delete pipeline.sample_etl Plan: 2 to add, 0 to change, 2 to delete ``` ## Why Improving the output before making the command publicly available ## Tests Updated acceptance test output Existing acceptance test updated and passing <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent e4e8e10 commit efa69f4

File tree

33 files changed

+143
-4
lines changed

33 files changed

+143
-4
lines changed

acceptance/bundle/apps/app_yaml/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Validation OK!
1111
>>> [CLI] bundle plan
1212
create apps.myapp
1313

14+
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
15+
1416
>>> [CLI] bundle deploy
1517
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
1618
Deploying resources...

acceptance/bundle/bundle_tag/id/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Validation OK!
3232
>>> [CLI] bundle plan
3333
create jobs.foo
3434

35+
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
36+
3537
>>> [CLI] bundle deploy
3638
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
3739
Deploying resources...

acceptance/bundle/bundle_tag/url/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Validation OK!
3232
>>> [CLI] bundle plan
3333
create jobs.foo
3434

35+
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
36+
3537
>>> [CLI] bundle deploy
3638
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
3739
Deploying resources...
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
create jobs.bar
22
create jobs.foo
3+
4+
Plan: 2 to add, 0 to change, 0 to delete, 0 unchanged

acceptance/bundle/deploy/jobs/task-source/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Deployment complete!
1616
>>> [CLI] bundle plan
1717
update jobs.git_job
1818

19+
Plan: 0 to add, 1 to change, 0 to delete, 1 unchanged
20+
1921
>>> [CLI] bundle deploy
2022
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/task-source/default/files...
2123
Deploying resources...

acceptance/bundle/deploy/pipeline/auto-approve/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Deployment complete!
3939
delete jobs.foo
4040
delete pipelines.bar
4141

42+
Plan: 0 to add, 0 to change, 2 to delete, 0 unchanged
43+
4244
=== Try to redeploy the bundle - should fail without --auto-approve
4345
>>> errcode [CLI] bundle deploy
4446
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files...

acceptance/bundle/deploy/pipeline/recreate/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Deployment complete!
3434
recreate pipelines.foo
3535
recreate schemas.bar
3636

37+
Plan: 2 to add, 0 to change, 2 to delete, 0 unchanged
38+
3739
=== Try to redeploy the bundle, pointing the DLT pipeline to a different UC catalog
3840
>>> errcode [CLI] bundle deploy --force-lock --var=catalog=another_catalog
3941
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files...

acceptance/bundle/deploy/pipeline/recreate/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title "Assert the pipeline is created"
1111
PIPELINE_ID=$($CLI bundle summary -o json | jq -r '.resources.pipelines.foo.id')
1212
trace $CLI pipelines get "${PIPELINE_ID}" | jq "{spec}"
1313

14-
trace $CLI bundle plan --var="catalog=another_catalog" 2>&1 | sort
14+
trace $CLI bundle plan --var="catalog=another_catalog" 2>&1
1515

1616
title "Try to redeploy the bundle, pointing the DLT pipeline to a different UC catalog"
1717
trace errcode $CLI bundle deploy --force-lock --var="catalog=another_catalog"

acceptance/bundle/lifecycle/prevent-destroy/out.direct-exp.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Exit code (musterr): 1
99
>>> errcode [CLI] bundle plan
1010
recreate pipelines.my_pipelines
1111

12+
Plan: 1 to add, 0 to change, 1 to delete, 1 unchanged
13+
1214
>>> musterr [CLI] bundle deploy
1315
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
1416
Error: resources.pipelines.my_pipelines has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for resources.pipelines.my_pipelines
@@ -20,6 +22,8 @@ Exit code (musterr): 1
2022
recreate pipelines.my_pipelines
2123
recreate schemas.my_schema
2224

25+
Plan: 2 to add, 0 to change, 2 to delete, 0 unchanged
26+
2327
>>> musterr [CLI] bundle deploy
2428
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
2529
Error: resources.pipelines.my_pipelines has lifecycle.prevent_destroy set, but the plan calls for this resource to be recreated or destroyed. To avoid this error, disable lifecycle.prevent_destroy for resources.pipelines.my_pipelines
@@ -32,6 +36,8 @@ Exit code (musterr): 1
3236
recreate pipelines.my_pipelines
3337
recreate schemas.my_schema
3438

39+
Plan: 2 to add, 0 to change, 2 to delete, 0 unchanged
40+
3541
>>> [CLI] bundle deploy --auto-approve
3642
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
3743

@@ -51,6 +57,8 @@ Deployment complete!
5157
delete pipelines.my_pipelines
5258
delete schemas.my_schema
5359

60+
Plan: 0 to add, 0 to change, 2 to delete, 0 unchanged
61+
5462
>>> [CLI] bundle deploy --auto-approve
5563
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
5664

acceptance/bundle/lifecycle/prevent-destroy/out.terraform.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ Exit code (musterr): 1
120120
recreate pipelines.my_pipelines
121121
recreate schemas.my_schema
122122

123+
Plan: 2 to add, 0 to change, 2 to delete, 0 unchanged
124+
123125
>>> [CLI] bundle deploy --auto-approve
124126
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
125127

@@ -139,6 +141,8 @@ Deployment complete!
139141
delete pipelines.my_pipelines
140142
delete schemas.my_schema
141143

144+
Plan: 0 to add, 0 to change, 2 to delete, 0 unchanged
145+
142146
>>> [CLI] bundle deploy --auto-approve
143147
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/prevent-destroy/default/files...
144148

0 commit comments

Comments
 (0)