Skip to content

Commit d78f88f

Browse files
andrewnesterdeniklennartkats-db
authored
Added 'databricks bundle plan' command (#3530)
## Changes Made 'databricks bundle plan' command public (previously hidden) ## Why This command builds the bundle and displays the actions that will be performed on the deployed resources without making any changes. It is useful for previewing changes before running `bundle deploy`. The output of the command is high level list of actions and resources which are changed, for example ``` >>> databricks bundle plan 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, 3 unchanged ``` ## Tests Covered by existing tests --------- Co-authored-by: Denis Bilenko <[email protected]> Co-authored-by: Lennart Kats (databricks) <[email protected]>
1 parent 4291bcc commit d78f88f

File tree

15 files changed

+109
-46
lines changed

15 files changed

+109
-46
lines changed

NEXT_CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
## Release v0.270.0
44

55
### Notable Changes
6+
* Add 'databricks bundle plan' command. This command shows the deployment plan for the current bundle configuration without making any changes. ([#3530](https://github.com/databricks/cli/pull/3530)
67

78
### CLI
89

910
### Dependency updates
1011

1112
### Bundles
13+
* Add 'databricks bundle plan' command ([#3530](https://github.com/databricks/cli/pull/3530)
1214
* Add new Lakeflow Pipelines support for bundle generate ([#3568](https://github.com/databricks/cli/pull/3568))
1315
* Fix bundle deploy to not update permissions or grants for unbound resources ([#3642](https://github.com/databricks/cli/pull/3642))
1416
* Introduce new bundle variable: `${workspace.current_user.domain_friendly_name}` ([#3623](https://github.com/databricks/cli/pull/3623))

acceptance/bundle/debug/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Usage:
44
databricks bundle debug [command]
55

66
Available Commands:
7+
plan Show deployment plan in JSON format (experimental)
78
refschema Dump all relevant fields all bundle resources
89

910
Flags:

acceptance/bundle/help/bundle/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Available Commands:
2424
generate Generate bundle configuration
2525
init Initialize using a bundle template
2626
open Open a resource in the browser
27+
plan Show deployment plan
2728
run Run a job, pipeline update or app
2829
schema Generate JSON Schema for bundle configuration
2930
summary Summarize resources deployed by this bundle

acceptance/bundle/resources/jobs/update/output.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ create jobs.foo
44

55
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
66

7-
>>> [CLI] bundle plan -o json
7+
>>> [CLI] bundle debug plan
88
{
99
"plan": {
1010
"resources.jobs.foo": {
@@ -22,7 +22,7 @@ Deployment complete!
2222
>>> [CLI] bundle plan
2323
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
2424

25-
>>> [CLI] bundle plan -o json
25+
>>> [CLI] bundle debug plan
2626
{
2727
"plan": {}
2828
}
@@ -71,7 +71,7 @@ update jobs.foo
7171

7272
Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
7373

74-
>>> [CLI] bundle plan -o json
74+
>>> [CLI] bundle debug plan
7575
{
7676
"plan": {
7777
"resources.jobs.foo": {
@@ -89,7 +89,7 @@ Deployment complete!
8989
>>> [CLI] bundle plan
9090
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
9191

92-
>>> [CLI] bundle plan -o json
92+
>>> [CLI] bundle debug plan
9393
{
9494
"plan": {}
9595
}

acceptance/bundle/resources/jobs/update/script

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
echo "*" > .gitignore
22
trace $CLI bundle plan
3-
trace $CLI bundle plan -o json
3+
trace $CLI bundle debug plan
44
trace $CLI bundle deploy
55
trace $CLI bundle plan
6-
trace $CLI bundle plan -o json
6+
trace $CLI bundle debug plan
77

88
print_requests() {
99
jq --sort-keys 'select(.method != "GET" and (.path | contains("/jobs")))' < out.requests.txt
@@ -16,10 +16,10 @@ trace print_requests
1616
title "Update trigger.periodic.unit and re-deploy"
1717
trace update_file.py databricks.yml DAYS HOURS
1818
trace $CLI bundle plan
19-
trace $CLI bundle plan -o json
19+
trace $CLI bundle debug plan
2020
trace $CLI bundle deploy
2121
trace $CLI bundle plan
22-
trace $CLI bundle plan -o json
22+
trace $CLI bundle debug plan
2323
trace print_requests
2424

2525
title "Fetch job ID and verify remote state"

acceptance/bundle/resources/pipelines/recreate/_script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ trace cat databricks.yml
22
touch foo.py
33
touch bar.py
44
trace $CLI bundle plan # should show 'create'
5-
trace $CLI bundle plan -o json
5+
trace $CLI bundle debug plan
66
trace $CLI bundle deploy
77

88
ppid1=`read_id.py pipelines my`
@@ -17,7 +17,7 @@ trace print_requests
1717

1818
trace update_file.py databricks.yml $CONFIG_UPDATE
1919
trace $CLI bundle plan # should show 'recreate'
20-
trace $CLI bundle plan -o json
20+
trace $CLI bundle debug plan
2121
trace $CLI bundle deploy --auto-approve
2222
trace print_requests
2323

acceptance/bundle/resources/pipelines/recreate/change-catalog/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ create pipelines.my
1919

2020
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
2121

22-
>>> [CLI] bundle plan -o json
22+
>>> [CLI] bundle debug plan
2323
{
2424
"plan": {
2525
"resources.pipelines.my": {
@@ -64,7 +64,7 @@ recreate pipelines.my
6464

6565
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged
6666

67-
>>> [CLI] bundle plan -o json
67+
>>> [CLI] bundle debug plan
6868
{
6969
"plan": {
7070
"resources.pipelines.my": {

acceptance/bundle/resources/pipelines/recreate/change-ingestion-definition/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ create pipelines.my
1919

2020
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
2121

22-
>>> [CLI] bundle plan -o json
22+
>>> [CLI] bundle debug plan
2323
{
2424
"plan": {
2525
"resources.pipelines.my": {
@@ -69,7 +69,7 @@ recreate pipelines.my
6969

7070
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged
7171

72-
>>> [CLI] bundle plan -o json
72+
>>> [CLI] bundle debug plan
7373
{
7474
"plan": {
7575
"resources.pipelines.my": {

acceptance/bundle/resources/pipelines/recreate/change-storage/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ create pipelines.my
1919

2020
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
2121

22-
>>> [CLI] bundle plan -o json
22+
>>> [CLI] bundle debug plan
2323
{
2424
"plan": {
2525
"resources.pipelines.my": {
@@ -64,7 +64,7 @@ recreate pipelines.my
6464

6565
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged
6666

67-
>>> [CLI] bundle plan -o json
67+
>>> [CLI] bundle debug plan
6868
{
6969
"plan": {
7070
"resources.pipelines.my": {

acceptance/bundle/resources/volumes/change-name/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ update volumes.volume1
4141

4242
Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
4343

44-
>>> [CLI] bundle plan -o json
44+
>>> [CLI] bundle debug plan
4545

4646
>>> [CLI] bundle deploy
4747
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...

0 commit comments

Comments
 (0)