diff --git a/acceptance/bundle/deployment/bind/dashboard/out.test.toml b/acceptance/bundle/deployment/bind/dashboard/out.test.toml index 96be4fdfe9d..bcadf671a38 100644 --- a/acceptance/bundle/deployment/bind/dashboard/out.test.toml +++ b/acceptance/bundle/deployment/bind/dashboard/out.test.toml @@ -2,3 +2,4 @@ Local = true Cloud = true RequiresWarehouse = true EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.READPLAN = ["", "1"] diff --git a/acceptance/bundle/deployment/bind/dashboard/output.txt b/acceptance/bundle/deployment/bind/dashboard/output.txt index 5d3f23d4a7e..d970d869df8 100644 --- a/acceptance/bundle/deployment/bind/dashboard/output.txt +++ b/acceptance/bundle/deployment/bind/dashboard/output.txt @@ -3,8 +3,6 @@ Updating deployment state... Successfully bound dashboard with an id '[DASHBOARD_ID]' Run 'bundle deploy' to deploy changes to your workspace - ->>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... diff --git a/acceptance/bundle/deployment/bind/dashboard/recreation/out.test.toml b/acceptance/bundle/deployment/bind/dashboard/recreation/out.test.toml index 96be4fdfe9d..bcadf671a38 100644 --- a/acceptance/bundle/deployment/bind/dashboard/recreation/out.test.toml +++ b/acceptance/bundle/deployment/bind/dashboard/recreation/out.test.toml @@ -2,3 +2,4 @@ Local = true Cloud = true RequiresWarehouse = true EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.READPLAN = ["", "1"] diff --git a/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt b/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt index 26de10b19c8..bbaff645113 100644 --- a/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt +++ b/acceptance/bundle/deployment/bind/dashboard/recreation/output.txt @@ -11,8 +11,6 @@ Run 'bundle deploy' to deploy changes to your workspace recreate dashboards.dashboard1 Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged - ->>> errcode [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... This action will result in the deletion or recreation of the following dashboards. @@ -27,8 +25,6 @@ Exit code: 1 >>> [CLI] bundle deployment unbind dashboard1 Updating deployment state... - ->>> [CLI] bundle deploy --auto-approve Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... diff --git a/acceptance/bundle/deployment/bind/dashboard/recreation/script b/acceptance/bundle/deployment/bind/dashboard/recreation/script index fbd7033f026..6ab9c0020d0 100644 --- a/acceptance/bundle/deployment/bind/dashboard/recreation/script +++ b/acceptance/bundle/deployment/bind/dashboard/recreation/script @@ -20,10 +20,13 @@ add_repl.py $ETAG ETAG json_in_json_normalize.py out.state_after_bind.$DATABRICKS_BUNDLE_ENGINE.json trace $CLI bundle plan -trace errcode $CLI bundle deploy +$CLI bundle plan -o json > tmp.plan.json +errcode $CLI bundle deploy $(readplanarg tmp.plan.json) trace $CLI bundle deployment unbind dashboard1 -trace $CLI bundle deploy --auto-approve +# Re-plan after unbind: the plan saved above no longer matches state. +$CLI bundle plan -o json > tmp.plan_after_unbind.json +$CLI bundle deploy --auto-approve $(readplanarg tmp.plan_after_unbind.json) trace $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name, lifecycle_state}' diff --git a/acceptance/bundle/deployment/bind/dashboard/script b/acceptance/bundle/deployment/bind/dashboard/script index ee59b588fda..3d4163a947f 100644 --- a/acceptance/bundle/deployment/bind/dashboard/script +++ b/acceptance/bundle/deployment/bind/dashboard/script @@ -13,7 +13,10 @@ trap cleanupRemoveDashboard EXIT trace $CLI bundle deployment bind dashboard1 "${DASHBOARD_ID}" --auto-approve -trace $CLI bundle deploy +# Bind writes state without going through DoCreate/DoUpdate, so a saved-plan deploy after +# a bind must still send the full serialized_dashboard; the lakeview get below reads it back. +$CLI bundle plan -o json > tmp.plan.json +$CLI bundle deploy $(readplanarg tmp.plan.json) trace $CLI lakeview get "${DASHBOARD_ID}" | jq --sort-keys '{display_name, lifecycle_state, path, parent_path, serialized_dashboard} | .serialized_dashboard |= fromjson' diff --git a/acceptance/bundle/deployment/bind/dashboard/test.toml b/acceptance/bundle/deployment/bind/dashboard/test.toml index b429aa38e28..4dbc9a3dd11 100644 --- a/acceptance/bundle/deployment/bind/dashboard/test.toml +++ b/acceptance/bundle/deployment/bind/dashboard/test.toml @@ -2,6 +2,13 @@ Local = true Cloud = true RequiresWarehouse = true +Ignore = ["tmp.plan.json", "tmp.plan_after_unbind.json"] + +# Bind writes state without going through DoCreate/DoUpdate, so a deploy from a saved +# plan after binding must still send the full serialized_dashboard. Inherited by +# recreation/, whose script also deploys from a saved plan. +EnvMatrix.READPLAN = ["", "1"] + [[Repls]] Old = "[0-9a-f]{32}" New = "[DASHBOARD_ID]" diff --git a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/out.test.toml b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/out.test.toml index 96be4fdfe9d..bcadf671a38 100644 --- a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/out.test.toml +++ b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/out.test.toml @@ -2,3 +2,4 @@ Local = true Cloud = true RequiresWarehouse = true EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.READPLAN = ["", "1"] diff --git a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/output.txt b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/output.txt index 8528f405189..80bbfe68b2f 100644 --- a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/output.txt +++ b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/output.txt @@ -3,8 +3,6 @@ create dashboards.my_dashboard Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged - ->>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/change-serialized-dashboard-[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... @@ -26,8 +24,6 @@ Deployment complete! update dashboards.my_dashboard Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged - ->>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/change-serialized-dashboard-[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... diff --git a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/script b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/script index 0fdda86de25..bcbecd86613 100755 --- a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/script +++ b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/script @@ -9,7 +9,8 @@ deploy_dashboard() { envsubst < databricks.yml.tmpl > databricks.yml envsubst < dashboard.tmpl > dash.lvdash.json trace $CLI bundle plan - trace $CLI bundle deploy + $CLI bundle plan -o json > tmp.plan.$PAGE_NAME.json + $CLI bundle deploy $(readplanarg tmp.plan.$PAGE_NAME.json) dashboard_id=$($CLI bundle summary --output json | jq -r '.resources.dashboards.my_dashboard.id') # Wait out eventual consistency: retry until the current page is visible (the read diff --git a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/test.toml b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/test.toml index 1fe7c58f6ac..cec2f37d67e 100644 --- a/acceptance/bundle/resources/dashboards/change-serialized-dashboard/test.toml +++ b/acceptance/bundle/resources/dashboards/change-serialized-dashboard/test.toml @@ -1,8 +1,14 @@ Ignore = [ "databricks.yml", "dash.lvdash.json", + "tmp.plan.name1.json", + "tmp.plan.name2.json", ] +# Deploying a saved plan must send the same full serialized_dashboard as an +# in-memory plan; both variants share the request goldens below. +EnvMatrix.READPLAN = ["", "1"] + [Env] # MSYS2 automatically converts absolute paths like /Users/$username/$UNIQUE_NAME to # C:/Program Files/Git/Users/$username/UNIQUE_NAME before passing it to the CLI diff --git a/acceptance/bundle/resources/dashboards/nested-folders/out.test.toml b/acceptance/bundle/resources/dashboards/nested-folders/out.test.toml index 7edd52865f7..1976bc173ca 100644 --- a/acceptance/bundle/resources/dashboards/nested-folders/out.test.toml +++ b/acceptance/bundle/resources/dashboards/nested-folders/out.test.toml @@ -3,3 +3,4 @@ Cloud = true RequiresWarehouse = true RunsOnDbr = true EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.READPLAN = ["", "1"] diff --git a/acceptance/bundle/resources/dashboards/nested-folders/output.txt b/acceptance/bundle/resources/dashboards/nested-folders/output.txt index 4e828ac2d2c..a9fa8b918fe 100644 --- a/acceptance/bundle/resources/dashboards/nested-folders/output.txt +++ b/acceptance/bundle/resources/dashboards/nested-folders/output.txt @@ -1,5 +1,3 @@ - ->>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-dashboard-nested-folders-[UNIQUE_NAME]/default/files... Deploying resources... Updating deployment state... diff --git a/acceptance/bundle/resources/dashboards/nested-folders/script b/acceptance/bundle/resources/dashboards/nested-folders/script index 1d3de4c6fa7..19ec3b03188 100644 --- a/acceptance/bundle/resources/dashboards/nested-folders/script +++ b/acceptance/bundle/resources/dashboards/nested-folders/script @@ -12,7 +12,8 @@ cleanup() { } trap cleanup EXIT -trace $CLI bundle deploy +$CLI bundle plan -o json > tmp.plan.json +$CLI bundle deploy $(readplanarg tmp.plan.json) DASHBOARD_ID=$($CLI bundle summary --output json | jq -r '.resources.dashboards.dashboard1.id') # Capture the dashboard ID as a replacement. diff --git a/acceptance/bundle/resources/dashboards/nested-folders/test.toml b/acceptance/bundle/resources/dashboards/nested-folders/test.toml index 3ca6ec1011a..97b5fd99e7b 100644 --- a/acceptance/bundle/resources/dashboards/nested-folders/test.toml +++ b/acceptance/bundle/resources/dashboards/nested-folders/test.toml @@ -8,8 +8,13 @@ RunsOnDbr = true Ignore = [ "databricks.yml", "resources/dashboards.yml", + "tmp.plan.json", ] +# Deploying a saved plan must send the same full serialized_dashboard, which the +# lakeview get in the script reads back. +EnvMatrix.READPLAN = ["", "1"] + [[Repls]] # Windows: diff --git a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.direct.txt b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.direct.txt index 705bd09cb32..c1e4c6fd7fd 100644 --- a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.direct.txt +++ b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.direct.txt @@ -1,5 +1,3 @@ - ->>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/publish-failure-cleans-up-dashboard/default/files... Deploying resources... Error: cannot create resources.dashboards.dashboard1: Warehouse doesnotexist does not exist (400 RESOURCE_DOES_NOT_EXIST) diff --git a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.terraform.txt b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.terraform.txt index 874b077b1e3..7450e39b092 100644 --- a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.terraform.txt +++ b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.terraform.txt @@ -1,5 +1,3 @@ - ->>> [CLI] bundle deploy Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/publish-failure-cleans-up-dashboard/default/files... Deploying resources... Error: terraform apply: exit status 1 diff --git a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.test.toml b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.test.toml index 8f6c4a03c57..b5ce19512e3 100644 --- a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.test.toml +++ b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.test.toml @@ -2,3 +2,4 @@ Local = true Cloud = false RequiresWarehouse = true EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.READPLAN = ["", "1"] diff --git a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/script b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/script index 693a4320211..f6c01d0f654 100755 --- a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/script +++ b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/script @@ -2,7 +2,8 @@ export DASHBOARD_DISPLAY_NAME="test bundle-deploy-dashboard $UNIQUE_NAME)" envsubst < databricks.yml.tmpl > databricks.yml # Deploy the dashboard. The dashboard will be created but publish will fail because the warehouse does not exist. -errcode trace $CLI bundle deploy &> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt +$CLI bundle plan -o json > tmp.plan.json +errcode $CLI bundle deploy $(readplanarg tmp.plan.json) &> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt trace $CLI bundle summary diff --git a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/test.toml b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/test.toml index a8ede7b099c..53abe56cb1f 100644 --- a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/test.toml +++ b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/test.toml @@ -2,6 +2,12 @@ Cloud = false Local = true RecordRequests = true +Ignore = ["tmp.plan.json"] + +# Applying a saved plan must reach the same publish failure and the same cleanup +# DELETE as an in-memory plan; both variants share out.dashboardrequests.txt. +EnvMatrix.READPLAN = ["", "1"] + [[Server]] Pattern = "POST /api/2.0/lakeview/dashboards/{dashboard_id}/published" Response.StatusCode = 400