diff --git a/.nextchanges/bundles/accurate-resource-summary-counts.md b/.nextchanges/bundles/accurate-resource-summary-counts.md new file mode 100644 index 00000000000..734c7e0b0b8 --- /dev/null +++ b/.nextchanges/bundles/accurate-resource-summary-counts.md @@ -0,0 +1 @@ +* Fix bundle `deploy` and `destroy` summaries to report partial successes and resource failures, including completed deletions when replacement creation fails. ([#7006](https://github.com/databricks/cli/pull/7006)) diff --git a/acceptance/bundle/deploy/empty-resource-id/create/output.txt b/acceptance/bundle/deploy/empty-resource-id/create/output.txt index 8b76e7e9da5..cea312982cf 100644 --- a/acceptance/bundle/deploy/empty-resource-id/create/output.txt +++ b/acceptance/bundle/deploy/empty-resource-id/create/output.txt @@ -6,6 +6,7 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/defaul Error: cannot create resources.volumes.volume1: create returned an empty resource id Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed === The failed create does not save resource state diff --git a/acceptance/bundle/deploy/empty-resource-id/update/output.txt b/acceptance/bundle/deploy/empty-resource-id/update/output.txt index ada20dd341a..22fdda74847 100644 --- a/acceptance/bundle/deploy/empty-resource-id/update/output.txt +++ b/acceptance/bundle/deploy/empty-resource-id/update/output.txt @@ -14,6 +14,7 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/defaul Error: cannot update_id resources.volumes.volume1: update returned an empty resource id Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed === The failed rename preserves the original ID and state diff --git a/acceptance/bundle/deploy/summary-on-error/databricks.yml b/acceptance/bundle/deploy/summary-on-error/databricks.yml new file mode 100644 index 00000000000..e82903c6722 --- /dev/null +++ b/acceptance/bundle/deploy/summary-on-error/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: test-deploy-summary-on-error + +resources: + jobs: + # Chained job_01 <- job_02 <- job_03 via id references, so deploy creates them in a + # fixed order (job_01, job_02, job_03). Independent jobs would create in parallel, + # making both the faulted create and the error output vary per run. + job_01: + name: job-01 + job_02: + name: job-02 + description: needs ${resources.jobs.job_01.id} + job_03: + name: job-03 + description: needs ${resources.jobs.job_02.id} diff --git a/acceptance/bundle/deploy/summary-on-error/out.test.toml b/acceptance/bundle/deploy/summary-on-error/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/deploy/summary-on-error/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/deploy/summary-on-error/output.txt b/acceptance/bundle/deploy/summary-on-error/output.txt new file mode 100644 index 00000000000..da8dd2ecb44 --- /dev/null +++ b/acceptance/bundle/deploy/summary-on-error/output.txt @@ -0,0 +1,19 @@ + +=== Deploy three chained jobs; the second create fails + +>>> fault.py POST /api/2.2/jobs/create 400 1 1 INVALID_PARAMETER_VALUE + +>>> musterr [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-deploy-summary-on-error/default/files... +Created jobs.job_01 +Error: cannot create resources.jobs.job_02: Fault injected by test. (400 INVALID_PARAMETER_VALUE) + +Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/create +HTTP Status: 400 Bad Request +API error_code: INVALID_PARAMETER_VALUE +API message: Fault injected by test. + +Error: cannot create resources.jobs.job_03: dependency failed: resources.jobs.job_02 + +Files: 1 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 2 failed diff --git a/acceptance/bundle/deploy/summary-on-error/script b/acceptance/bundle/deploy/summary-on-error/script new file mode 100644 index 00000000000..6ce82e64857 --- /dev/null +++ b/acceptance/bundle/deploy/summary-on-error/script @@ -0,0 +1,6 @@ +title "Deploy three chained jobs; the second create fails" +# Creates run in chain order (job_01, job_02, job_03); faulting the second create makes +# job_01 succeed, job_02 fail, and job_03 skip because its dependency failed. The summary +# reports the accurate counts (1 created, 2 failed) rather than the planned 3 created. +trace fault.py "POST /api/2.2/jobs/create" 400 1 1 INVALID_PARAMETER_VALUE +trace musterr $CLI bundle deploy diff --git a/acceptance/bundle/deploy/summary-on-error/test.toml b/acceptance/bundle/deploy/summary-on-error/test.toml new file mode 100644 index 00000000000..2b0b3a6ccb0 --- /dev/null +++ b/acceptance/bundle/deploy/summary-on-error/test.toml @@ -0,0 +1,4 @@ +# fault.py registers its rule on the fake server, which a real workspace does not have. +Cloud = false + +Ignore = [".databricks"] diff --git a/acceptance/bundle/deployment/bind/postgres_data_api/output.txt b/acceptance/bundle/deployment/bind/postgres_data_api/output.txt index 1b9249be911..a935a8e15ee 100644 --- a/acceptance/bundle/deployment/bind/postgres_data_api/output.txt +++ b/acceptance/bundle/deployment/bind/postgres_data_api/output.txt @@ -13,6 +13,7 @@ API error_code: ALREADY_EXISTS API message: Data API is already enabled for this database Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed === Bind adopts the existing Data API diff --git a/acceptance/bundle/destroy/summary-on-error/databricks.yml b/acceptance/bundle/destroy/summary-on-error/databricks.yml new file mode 100644 index 00000000000..f64d5b07d3c --- /dev/null +++ b/acceptance/bundle/destroy/summary-on-error/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: test-destroy-summary-on-error + +resources: + jobs: + # Chained job_01 <- job_02 <- job_03 via id references, so destroy deletes them in a + # fixed order (children first: job_03, job_02, job_01). Independent jobs would delete + # in parallel, making both the faulted delete and the error output vary per run. + job_01: + name: job-01 + job_02: + name: job-02 + description: needs ${resources.jobs.job_01.id} + job_03: + name: job-03 + description: needs ${resources.jobs.job_02.id} diff --git a/acceptance/bundle/destroy/summary-on-error/out.test.toml b/acceptance/bundle/destroy/summary-on-error/out.test.toml new file mode 100644 index 00000000000..88e6fbd847c --- /dev/null +++ b/acceptance/bundle/destroy/summary-on-error/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["true"] diff --git a/acceptance/bundle/destroy/summary-on-error/output.txt b/acceptance/bundle/destroy/summary-on-error/output.txt new file mode 100644 index 00000000000..8ca81255cf6 --- /dev/null +++ b/acceptance/bundle/destroy/summary-on-error/output.txt @@ -0,0 +1,31 @@ + +=== Deploy three chained jobs + +>>> [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-destroy-summary-on-error/default/files... +Created jobs.job_01 +Created jobs.job_02 +Created jobs.job_03 +Files: 1 uploaded, 0 deleted +Resources: 3 created, 0 changed, 0 deleted, 0 unchanged + +=== Destroy: report two successful deletions and one failure + +>>> fault.py POST /api/2.2/jobs/delete 400 2 1 INVALID_PARAMETER_VALUE + +>>> musterr [CLI] bundle destroy --auto-approve +The following resources will be deleted: + delete resources.jobs.job_01 + delete resources.jobs.job_02 + delete resources.jobs.job_03 + +All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-destroy-summary-on-error/default + +Error: cannot delete resources.jobs.job_01: deleting id=[JOB_01_ID]: Fault injected by test. (400 INVALID_PARAMETER_VALUE) + +Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/delete +HTTP Status: 400 Bad Request +API error_code: INVALID_PARAMETER_VALUE +API message: Fault injected by test. + +Destroy: 2 deleted, 1 failed diff --git a/acceptance/bundle/destroy/summary-on-error/script b/acceptance/bundle/destroy/summary-on-error/script new file mode 100644 index 00000000000..d60c2335474 --- /dev/null +++ b/acceptance/bundle/destroy/summary-on-error/script @@ -0,0 +1,11 @@ +title "Deploy three chained jobs" +trace $CLI bundle deploy +# Mask the job IDs (the destroy error below prints job_01's) so the golden is stable. +replace_ids.py + +title "Destroy: report two successful deletions and one failure" +# Deletes run children-first (job_03, job_02, job_01); faulting the third makes only +# job_01 fail while job_03 and job_02 are really deleted. The deferred summary must +# report those completed deletions even though destroy returns an error. +trace fault.py "POST /api/2.2/jobs/delete" 400 2 1 INVALID_PARAMETER_VALUE +trace musterr $CLI bundle destroy --auto-approve diff --git a/acceptance/bundle/destroy/summary-on-error/test.toml b/acceptance/bundle/destroy/summary-on-error/test.toml new file mode 100644 index 00000000000..dba94a9b922 --- /dev/null +++ b/acceptance/bundle/destroy/summary-on-error/test.toml @@ -0,0 +1,8 @@ +# fault.py registers its rule on the fake server, which a real workspace does not have. +Cloud = false + +# A failed resource delete only surfaces as a destroy error with deployment +# history enabled, so pin that variant to exercise the error path deterministically. +EnvMatrix.DMS = ["true"] + +Ignore = [".databricks"] diff --git a/acceptance/bundle/dms/failed-delete/output.txt b/acceptance/bundle/dms/failed-delete/output.txt index 0e61b6c1ee1..9f36af8c274 100644 --- a/acceptance/bundle/dms/failed-delete/output.txt +++ b/acceptance/bundle/dms/failed-delete/output.txt @@ -137,6 +137,7 @@ HTTP Status: 400 Bad Request API error_code: INVALID_PARAMETER_VALUE API message: Fault injected by test. +Destroy: 0 deleted, 1 failed >>> print_requests.py --dms //api/2.0/bundle { diff --git a/acceptance/bundle/dms/failed-recreate/output.txt b/acceptance/bundle/dms/failed-recreate/output.txt index 88890f0e2a9..c0f0413fd6b 100644 --- a/acceptance/bundle/dms/failed-recreate/output.txt +++ b/acceptance/bundle/dms/failed-recreate/output.txt @@ -129,6 +129,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Fault injected by test. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 1 deleted, 0 unchanged, 1 failed >>> print_requests.py --dms //api/2.0/bundle { diff --git a/acceptance/bundle/dms/failed-update-permissions/output.txt b/acceptance/bundle/dms/failed-update-permissions/output.txt index 0f89039c104..1392d036161 100644 --- a/acceptance/bundle/dms/failed-update-permissions/output.txt +++ b/acceptance/bundle/dms/failed-update-permissions/output.txt @@ -111,6 +111,7 @@ API error_code: PERMISSION_DENIED API message: Fault injected by test. Files: 1 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed === The service lists the job with the failure diff --git a/acceptance/bundle/dms/record-failure/output.txt b/acceptance/bundle/dms/record-failure/output.txt index 23129df751d..0a4faeb19fb 100644 --- a/acceptance/bundle/dms/record-failure/output.txt +++ b/acceptance/bundle/dms/record-failure/output.txt @@ -11,6 +11,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Node type nonexistent-node-type is not supported. Supported node types: [NODE_TYPES] Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> [CLI] bundle plan -o json { diff --git a/acceptance/bundle/migrate/auto/apply-failure/output.txt b/acceptance/bundle/migrate/auto/apply-failure/output.txt index 5e9de1e49f7..1e82c2fff68 100644 --- a/acceptance/bundle/migrate/auto/apply-failure/output.txt +++ b/acceptance/bundle/migrate/auto/apply-failure/output.txt @@ -19,6 +19,7 @@ API error_code: INJECTED API message: Fault injected by test. Files: 1 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resource_deps/create_error/out.deploy.txt b/acceptance/bundle/resource_deps/create_error/out.deploy.txt index 6dedb23b1e7..d921a408d9c 100644 --- a/acceptance/bundle/resource_deps/create_error/out.deploy.txt +++ b/acceptance/bundle/resource_deps/create_error/out.deploy.txt @@ -11,3 +11,4 @@ Error: cannot create resources.jobs.bar: dependency failed: resources.jobs.foo Error: cannot create resources.jobs.baz: dependency failed: resources.jobs.foo Files: 0 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 3 failed diff --git a/acceptance/bundle/resource_deps/create_error/output.txt b/acceptance/bundle/resource_deps/create_error/output.txt index 3174a6eef98..ffbf0c007bf 100644 --- a/acceptance/bundle/resource_deps/create_error/output.txt +++ b/acceptance/bundle/resource_deps/create_error/output.txt @@ -75,7 +75,14 @@ create jobs.foo Plan: 3 to add, 0 to change, 0 to delete, 1 unchanged -=== Expecting no difference in the output between first and second deploy +=== Second deploy: only the summary differs, independent is now unchanged +--- out.deploy.txt ++++ out.deploy2.txt +@@ -12,3 +12,3 @@ + + Files: 0 uploaded, 0 deleted +-Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 3 failed ++Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 3 failed >>> print_requests.py --nostamp //jobs { diff --git a/acceptance/bundle/resource_deps/create_error/script b/acceptance/bundle/resource_deps/create_error/script index 99db55f4494..1fa355e9f7b 100644 --- a/acceptance/bundle/resource_deps/create_error/script +++ b/acceptance/bundle/resource_deps/create_error/script @@ -13,7 +13,9 @@ trace $CLI bundle plan rm "$OUT_REQUESTS" musterr $CLI bundle deploy -q &> out.deploy2.txt -title "Expecting no difference in the output between first and second deploy" +# The only difference is the summary: the first deploy created the independent job (1 +# created), the second finds it unchanged. foo still fails and bar/baz still skip on both. +title "Second deploy: only the summary differs, independent is now unchanged" diff.py out.deploy.txt out.deploy2.txt rm out.deploy2.txt trace print_requests.py --nostamp //jobs diff --git a/acceptance/bundle/resource_deps/missing_ingestion_definition/out.deploy.txt b/acceptance/bundle/resource_deps/missing_ingestion_definition/out.deploy.txt index 6fec7af0183..8f32d6baf91 100644 --- a/acceptance/bundle/resource_deps/missing_ingestion_definition/out.deploy.txt +++ b/acceptance/bundle/resource_deps/missing_ingestion_definition/out.deploy.txt @@ -3,5 +3,6 @@ Created pipelines.foo Error: cannot create resources.pipelines.bar: cannot resolve "${resources.pipelines.foo.ingestion_definition.connection_name}": ingestion_definition: cannot access nil value Files: 4 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resource_deps/missing_map_key/out.deploy.txt b/acceptance/bundle/resource_deps/missing_map_key/out.deploy.txt index e0627d0797e..09fc5b6e5e8 100644 --- a/acceptance/bundle/resource_deps/missing_map_key/out.deploy.txt +++ b/acceptance/bundle/resource_deps/missing_map_key/out.deploy.txt @@ -3,3 +3,4 @@ Created jobs.test Error: cannot create resources.jobs.bar: cannot resolve "${resources.jobs.test.tasks[0].new_cluster.custom_tags.missing_tag}": tasks[0].new_cluster.custom_tags.missing_tag: key "missing_tag" not found in map Files: 4 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/apps/create_already_exists/output.txt b/acceptance/bundle/resources/apps/create_already_exists/output.txt index b8440469192..bac4fcb4426 100644 --- a/acceptance/bundle/resources/apps/create_already_exists/output.txt +++ b/acceptance/bundle/resources/apps/create_already_exists/output.txt @@ -38,6 +38,7 @@ API error_code: RESOURCE_ALREADY_EXISTS API message: An app with the same name already exists: test-app-already-exists Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> [CLI] apps delete test-app-already-exists { diff --git a/acceptance/bundle/resources/catalogs/empty-name/output.txt b/acceptance/bundle/resources/catalogs/empty-name/output.txt index 0dc766af3db..2c1d53875a5 100644 --- a/acceptance/bundle/resources/catalogs/empty-name/output.txt +++ b/acceptance/bundle/resources/catalogs/empty-name/output.txt @@ -9,3 +9,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: Invalid input: RPC CreateCatalog Field managedcatalog.CatalogInfo.name: name "" is not a valid name. Valid names cannot contain spaces, periods, forward slashes, or control characters. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/cluster_policies/definition_and_family_conflict/output.txt b/acceptance/bundle/resources/cluster_policies/definition_and_family_conflict/output.txt index 8190a2eb970..2b1a78e82b7 100644 --- a/acceptance/bundle/resources/cluster_policies/definition_and_family_conflict/output.txt +++ b/acceptance/bundle/resources/cluster_policies/definition_and_family_conflict/output.txt @@ -9,3 +9,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: policy_family_id and definition cannot be used together Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.txt b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.txt index 5ed7521eb52..7d629219d65 100644 --- a/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.txt +++ b/acceptance/bundle/resources/dashboards/publish-failure-cleans-up-dashboard/out.deploy.txt @@ -7,5 +7,6 @@ API error_code: RESOURCE_DOES_NOT_EXIST API message: Warehouse doesnotexist does not exist Files: 5 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/dashboards/publish-failure-stale-content/output.txt b/acceptance/bundle/resources/dashboards/publish-failure-stale-content/output.txt index f57df03fe5e..fbeffef5d8f 100644 --- a/acceptance/bundle/resources/dashboards/publish-failure-stale-content/output.txt +++ b/acceptance/bundle/resources/dashboards/publish-failure-stale-content/output.txt @@ -33,6 +33,7 @@ API error_code: INJECTED API message: Fault injected by test. Files: 1 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/job_runs/destroy_unfinished_run/output.txt b/acceptance/bundle/resources/job_runs/destroy_unfinished_run/output.txt index 7903902a6cc..fc933cec4b7 100644 --- a/acceptance/bundle/resources/job_runs/destroy_unfinished_run/output.txt +++ b/acceptance/bundle/resources/job_runs/destroy_unfinished_run/output.txt @@ -12,6 +12,7 @@ API error_code: INJECTED API message: Fault injected by test. Files: 1 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/job_runs/failed_run/output.txt b/acceptance/bundle/resources/job_runs/failed_run/output.txt index 9f2dd59d0cf..c3993369b9a 100644 --- a/acceptance/bundle/resources/job_runs/failed_run/output.txt +++ b/acceptance/bundle/resources/job_runs/failed_run/output.txt @@ -12,6 +12,7 @@ run page: [RUN_URL] Error: cannot create resources.jobs.downstream_job: dependency failed: resources.job_runs.my_run Files: 3 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 2 failed === the failed run is recorded, and not having succeeded is drift @@ -27,6 +28,7 @@ Files: 3 uploaded, 0 deleted } ], "action": "recreate", + "state_only": true, "new_state": { "value": { "job_id": [MY_JOB_ID], @@ -68,6 +70,7 @@ run page: [RUN_URL] Error: cannot create resources.jobs.downstream_job: dependency failed: resources.job_runs.my_run Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 2 failed === run-now was issued once per deploy, and the recreate left the failed run alone diff --git a/acceptance/bundle/resources/job_runs/interrupted_run/output.txt b/acceptance/bundle/resources/job_runs/interrupted_run/output.txt index 45488a28b57..34e00f17df6 100644 --- a/acceptance/bundle/resources/job_runs/interrupted_run/output.txt +++ b/acceptance/bundle/resources/job_runs/interrupted_run/output.txt @@ -12,6 +12,7 @@ API error_code: INJECTED API message: Fault injected by test. Files: 1 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/job_runs/on_bundle_deploy/output.txt b/acceptance/bundle/resources/job_runs/on_bundle_deploy/output.txt index 2b79d541870..bee162d816c 100644 --- a/acceptance/bundle/resources/job_runs/on_bundle_deploy/output.txt +++ b/acceptance/bundle/resources/job_runs/on_bundle_deploy/output.txt @@ -28,7 +28,7 @@ Resources: 2 created, 0 changed, 0 deleted, 0 unchanged >>> [CLI] bundle plan recreate job_runs.my_run -Plan: 1 to add, 0 to change, 1 to delete, 1 unchanged +Plan: 1 to add, 0 to change, 0 to delete, 1 unchanged >>> jq .plan["resources.job_runs.my_run"].changes tmp.plan.json { @@ -52,7 +52,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_2]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_2]: SUCCESS Recreated job_runs.my_run Files: 1 uploaded, 0 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> [CLI] bundle summary Name: job-runs-on-bundle-deploy diff --git a/acceptance/bundle/resources/job_runs/on_file_change/output.txt b/acceptance/bundle/resources/job_runs/on_file_change/output.txt index 987d638339d..1603c45801f 100644 --- a/acceptance/bundle/resources/job_runs/on_file_change/output.txt +++ b/acceptance/bundle/resources/job_runs/on_file_change/output.txt @@ -52,6 +52,7 @@ Resources: 0 created, 0 changed, 0 deleted, 2 unchanged } ], "action": "recreate", + "state_only": true, "new_state": { "value": { "job_id": [MY_JOB_ID], @@ -99,7 +100,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_2]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_2]: SUCCESS Recreated job_runs.my_run Files: 2 uploaded, 0 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> print_requests.py --keep //jobs/runs/delete @@ -132,6 +133,7 @@ Warning: lifecycle.triggers.on_file_change: no synced files match "seed.txt" } ], "action": "recreate", + "state_only": true, "new_state": { "value": { "job_id": [MY_JOB_ID], @@ -180,7 +182,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_3]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_3]: SUCCESS Recreated job_runs.my_run Files: 2 uploaded, 1 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> print_requests.py //jobs/run-now { @@ -206,7 +208,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_4]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_4]: SUCCESS Recreated job_runs.my_run Files: 2 uploaded, 1 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> print_requests.py //jobs/run-now { diff --git a/acceptance/bundle/resources/job_runs/on_file_change_build/output.txt b/acceptance/bundle/resources/job_runs/on_file_change_build/output.txt index 334bd0ad9c9..8c56d0940fa 100644 --- a/acceptance/bundle/resources/job_runs/on_file_change_build/output.txt +++ b/acceptance/bundle/resources/job_runs/on_file_change_build/output.txt @@ -33,7 +33,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_2]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_2]: SUCCESS Recreated job_runs.my_run Files: 2 uploaded, 0 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> print_requests.py //jobs/run-now { diff --git a/acceptance/bundle/resources/job_runs/on_file_change_glob/output.txt b/acceptance/bundle/resources/job_runs/on_file_change_glob/output.txt index 8740172f2f7..eb6cb27028c 100644 --- a/acceptance/bundle/resources/job_runs/on_file_change_glob/output.txt +++ b/acceptance/bundle/resources/job_runs/on_file_change_glob/output.txt @@ -47,7 +47,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_2]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_2]: SUCCESS Recreated job_runs.my_run Files: 2 uploaded, 0 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> print_requests.py --keep //jobs/runs/delete diff --git a/acceptance/bundle/resources/job_runs/on_file_change_predeploy/output.txt b/acceptance/bundle/resources/job_runs/on_file_change_predeploy/output.txt index 48efc78706b..78cbdec856c 100644 --- a/acceptance/bundle/resources/job_runs/on_file_change_predeploy/output.txt +++ b/acceptance/bundle/resources/job_runs/on_file_change_predeploy/output.txt @@ -33,7 +33,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_2]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_2]: SUCCESS Recreated job_runs.my_run Files: 2 uploaded, 0 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> print_requests.py //jobs/run-now { diff --git a/acceptance/bundle/resources/job_runs/redeploy/output.txt b/acceptance/bundle/resources/job_runs/redeploy/output.txt index 55c3a02f7cc..dabe734a2a6 100644 --- a/acceptance/bundle/resources/job_runs/redeploy/output.txt +++ b/acceptance/bundle/resources/job_runs/redeploy/output.txt @@ -55,6 +55,7 @@ Resources: } ], "action": "recreate", + "state_only": true, "new_state": { "value": { "job_id": [MY_JOB_ID], @@ -102,7 +103,7 @@ Output from job_runs.my_run: id=[MY_RUN_ID_2]: Run URL: [DATABRICKS_URL]/jobs/[M Output from job_runs.my_run: id=[MY_RUN_ID_2]: SUCCESS Recreated job_runs.my_run Files: 1 uploaded, 0 deleted -Resources: 1 created, 0 changed, 1 deleted, 1 unchanged +Resources: 1 created, 0 changed, 0 deleted, 1 unchanged >>> [CLI] bundle summary Name: job-runs-redeploy diff --git a/acceptance/bundle/resources/jobs/cluster_policy/config_conflicts_policy/output.txt b/acceptance/bundle/resources/jobs/cluster_policy/config_conflicts_policy/output.txt index b28170e7362..4d1364dc794 100644 --- a/acceptance/bundle/resources/jobs/cluster_policy/config_conflicts_policy/output.txt +++ b/acceptance/bundle/resources/jobs/cluster_policy/config_conflicts_policy/output.txt @@ -12,6 +12,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Cluster validation error: Validation failed for custom_tags, CostCenter must be from-policy (is "not-what-the-policy-says") Files: 3 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> [CLI] bundle destroy --auto-approve The following resources will be deleted: diff --git a/acceptance/bundle/resources/jobs/create-error/output.txt b/acceptance/bundle/resources/jobs/create-error/output.txt index 1b4964953a5..6f5219d5a96 100644 --- a/acceptance/bundle/resources/jobs/create-error/output.txt +++ b/acceptance/bundle/resources/jobs/create-error/output.txt @@ -9,6 +9,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Shared job cluster feature is only supported in multi-task jobs. Files: 1 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> musterr [CLI] bundle deploy --force-lock -q Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... @@ -20,6 +21,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Shared job cluster feature is only supported in multi-task jobs. Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> musterr [CLI] bundle deploy --force-lock -qq Error: cannot create resources.jobs.foo: Shared job cluster feature is only supported in multi-task jobs. (400 INVALID_PARAMETER_VALUE) diff --git a/acceptance/bundle/resources/jobs/no-git-provider/out.deploy.txt b/acceptance/bundle/resources/jobs/no-git-provider/out.deploy.txt index 19ff909c96e..422c47581f4 100644 --- a/acceptance/bundle/resources/jobs/no-git-provider/out.deploy.txt +++ b/acceptance/bundle/resources/jobs/no-git-provider/out.deploy.txt @@ -13,5 +13,6 @@ API error_code: INVALID_PARAMETER_VALUE API message: git_source.git_provider must be one of: github,gitlab,bitbucketcloud,gitlabenterpriseedition,bitbucketserver,azuredevopsservices,githubenterprise,awscodecommit Files: 3 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/materialization_sets/batch/output.txt b/acceptance/bundle/resources/materialization_sets/batch/output.txt index c97c2926da3..ec5849859a3 100644 --- a/acceptance/bundle/resources/materialization_sets/batch/output.txt +++ b/acceptance/bundle/resources/materialization_sets/batch/output.txt @@ -49,6 +49,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Updating materialization set '[SET1_ID]' with no materialized features is not supported. Delete the set instead. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed === Writing no value instead of an empty list is the same declaration, and has to reach the same @@ -73,6 +74,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Updating materialization set '[SET1_ID]' with no materialized features is not supported. Delete the set instead. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed >>> [CLI] bundle plan -o json diff --git a/acceptance/bundle/resources/materialization_sets/membership/output.txt b/acceptance/bundle/resources/materialization_sets/membership/output.txt index 4a9183fd100..a6552027760 100644 --- a/acceptance/bundle/resources/materialization_sets/membership/output.txt +++ b/acceptance/bundle/resources/materialization_sets/membership/output.txt @@ -31,6 +31,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Materialized features '[UUID][1]' of feature 'main.matset_[UNIQUE_NAME].feata_[UNIQUE_NAME]' are deleted only by deleting materialized features '[UUID][2]', which the request does not supply. Remove those as well. Files: 1 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 2 unchanged, 1 failed === And removing feata's offline member alone is refused for the same reason, from the other @@ -46,6 +47,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Deleting materialized features '[UUID][2]' of feature 'main.matset_[UNIQUE_NAME].feata_[UNIQUE_NAME]' also deletes materialized features '[UUID][1]', which the request does not delete. Delete the unrequested materialized features as well. Files: 1 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 2 unchanged, 1 failed === Removing a whole feature's pair plans as update, not recreate, and the other feature's diff --git a/acceptance/bundle/resources/materialization_sets/mixed_triggers/output.txt b/acceptance/bundle/resources/materialization_sets/mixed_triggers/output.txt index be1fce0fd17..76ca550cce0 100644 --- a/acceptance/bundle/resources/materialization_sets/mixed_triggers/output.txt +++ b/acceptance/bundle/resources/materialization_sets/mixed_triggers/output.txt @@ -19,3 +19,4 @@ Created features.streamfeat Error: cannot create resources.materialization_sets.set1: materialization set [UUID]: operation failed: [INVALID_PARAMETER_VALUE] Batch and streaming features cannot be mixed in a single materialize_features call because they require different trigger types. Issue two separate calls: one for batch features and one for streaming features. Batch features: main.myschema.batch_[UNIQUE_NAME]. Streaming features: main.myschema.batchstream_[UNIQUE_NAME] Files: 2 uploaded, 0 deleted +Resources: 2 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/materialization_sets/sawtooth/output.txt b/acceptance/bundle/resources/materialization_sets/sawtooth/output.txt index 61a48e81f79..d71a2fa7198 100644 --- a/acceptance/bundle/resources/materialization_sets/sawtooth/output.txt +++ b/acceptance/bundle/resources/materialization_sets/sawtooth/output.txt @@ -13,6 +13,7 @@ Created features.sawfeat Error: cannot create resources.materialization_sets.set1: materialization set [UUID][0]: operation failed: [BAD_REQUEST] Feature 'main.myschema.saw_[UNIQUE_NAME]' uses a sawtooth window, which requires an offline batch materialization, an online batch materialization and an online streaming materialization. Declare one materialize feature request for each. Files: 7 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed === Declaring all three creates the set @@ -62,6 +63,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Deleting materialized features '[UUID][2]' of feature 'main.myschema.saw_[UNIQUE_NAME]' also deletes materialized features '[UUID][3]', '[UUID][4]', which the request does not delete. Delete the unrequested materialized features as well. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed === removing the online batch member names no member a delete can be applied to, @@ -80,6 +82,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Materialized features '[UUID][3]' of feature 'main.myschema.saw_[UNIQUE_NAME]' are deleted only by deleting materialized features '[UUID][2]', '[UUID][4]', which the request does not supply. Remove those as well. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed === and removing the batch pair still leaves the streaming member behind @@ -98,6 +101,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Deleting materialized features '[UUID][2]', '[UUID][3]' of feature 'main.myschema.saw_[UNIQUE_NAME]' also deletes materialized features '[UUID][4]', which the request does not delete. Delete the unrequested materialized features as well. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed === Removing all three satisfies the cascade but empties the set, which the update endpoint @@ -120,6 +124,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Updating materialization set '[UUID][1]' with no materialized features is not supported. Delete the set instead. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged, 1 failed >>> [CLI] bundle plan -o json diff --git a/acceptance/bundle/resources/materialization_sets/settled_failure/output.txt b/acceptance/bundle/resources/materialization_sets/settled_failure/output.txt index 226455d7831..96e016564df 100644 --- a/acceptance/bundle/resources/materialization_sets/settled_failure/output.txt +++ b/acceptance/bundle/resources/materialization_sets/settled_failure/output.txt @@ -23,6 +23,7 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-matset-settle Error: cannot update resources.materialization_sets.set1: updating id=[UUID][0]: materialization set [UUID][0]: operation failed: [INTERNAL_ERROR] Changed 0 of 2 materialized features in materialization set '[UUID][0]'. The operation's progress lists which update succeeded, which failed and why.; members left unchanged: [UUID][1] (INTERNAL_ERROR): Failed to delete materialized feature '[UUID][1]'. If the issue persists, please retry or contact support.; [UUID][2] (INTERNAL_ERROR): Failed to delete materialized feature '[UUID][2]'. If the issue persists, please retry or contact support. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 2 unchanged, 1 failed === Nothing was written, so the removal is still pending diff --git a/acceptance/bundle/resources/models/empty-name/out.deploy.txt b/acceptance/bundle/resources/models/empty-name/out.deploy.txt index c0048635a5c..8f0fc04c5eb 100644 --- a/acceptance/bundle/resources/models/empty-name/out.deploy.txt +++ b/acceptance/bundle/resources/models/empty-name/out.deploy.txt @@ -9,3 +9,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: Got an invalid name ''. Registered Model names cannot be empty strings. Files: 3 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/postgres_branches/without_branch_id/out.deploy.txt b/acceptance/bundle/resources/postgres_branches/without_branch_id/out.deploy.txt index 3118fd0daea..80ba8fe8cdb 100644 --- a/acceptance/bundle/resources/postgres_branches/without_branch_id/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_branches/without_branch_id/out.deploy.txt @@ -12,3 +12,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field 'branch_id' is required, expected non-default value (not "")! Files: 0 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/postgres_databases/live_errors/bad_database_id/output.txt b/acceptance/bundle/resources/postgres_databases/live_errors/bad_database_id/output.txt index 7034fd62db6..fc481eaa442 100644 --- a/acceptance/bundle/resources/postgres_databases/live_errors/bad_database_id/output.txt +++ b/acceptance/bundle/resources/postgres_databases/live_errors/bad_database_id/output.txt @@ -10,6 +10,7 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field database_id must match pattern ^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$, got 'Invalid_DB_ID'. Files: 0 uploaded, 0 deleted +Resources: 3 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> [CLI] bundle destroy --auto-approve The following resources will be deleted: diff --git a/acceptance/bundle/resources/postgres_databases/live_errors/bad_role_ref/output.txt b/acceptance/bundle/resources/postgres_databases/live_errors/bad_role_ref/output.txt index dc91895fe19..482ac0f5064 100644 --- a/acceptance/bundle/resources/postgres_databases/live_errors/bad_role_ref/output.txt +++ b/acceptance/bundle/resources/postgres_databases/live_errors/bad_role_ref/output.txt @@ -9,6 +9,7 @@ API error_code: NOT_FOUND API message: [API_MESSAGE] Files: 0 uploaded, 0 deleted +Resources: 2 created, 0 changed, 0 deleted, 0 unchanged, 1 failed >>> [CLI] bundle destroy --auto-approve The following resources will be deleted: diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt index 062615af571..09430e8115b 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt @@ -7,5 +7,6 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field 'spec.suspension' is in update_mask but not provided in request Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 2 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/postgres_endpoints/without_endpoint_id/out.deploy.txt b/acceptance/bundle/resources/postgres_endpoints/without_endpoint_id/out.deploy.txt index 6aebf11934d..8a9865619eb 100644 --- a/acceptance/bundle/resources/postgres_endpoints/without_endpoint_id/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_endpoints/without_endpoint_id/out.deploy.txt @@ -13,3 +13,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field 'endpoint_id' is required, expected non-default value (not "")! Files: 0 uploaded, 0 deleted +Resources: 2 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt index e9fa2b4da16..cf9274827b3 100644 --- a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt @@ -7,5 +7,6 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field 'spec.default_endpoint_settings.suspension' is in update_mask but not provided in request Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt index 43f53f98801..5c835857fbb 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt @@ -7,5 +7,6 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field 'spec.history_retention_duration' is in update_mask but not provided in request Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/postgres_projects/without_project_id/out.deploy.txt b/acceptance/bundle/resources/postgres_projects/without_project_id/out.deploy.txt index 53dd9bc68f4..54a93b70591 100644 --- a/acceptance/bundle/resources/postgres_projects/without_project_id/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_projects/without_project_id/out.deploy.txt @@ -11,3 +11,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: Field 'project_id' is required, expected non-default value (not "")! Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/acceptance/bundle/resources/postgres_roles/inherited-role-conflict/output.txt b/acceptance/bundle/resources/postgres_roles/inherited-role-conflict/output.txt index a306ddf23e3..434d23a9e0d 100644 --- a/acceptance/bundle/resources/postgres_roles/inherited-role-conflict/output.txt +++ b/acceptance/bundle/resources/postgres_roles/inherited-role-conflict/output.txt @@ -32,6 +32,7 @@ API error_code: BAD_REQUEST API message: role with that name already exists Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 2 unchanged, 1 failed >>> [CLI] bundle destroy --auto-approve The following resources will be deleted: diff --git a/acceptance/bundle/resources/postgres_synced_tables/recreate_capped/output.txt b/acceptance/bundle/resources/postgres_synced_tables/recreate_capped/output.txt index e870338d02e..d00dcd63e47 100644 --- a/acceptance/bundle/resources/postgres_synced_tables/recreate_capped/output.txt +++ b/acceptance/bundle/resources/postgres_synced_tables/recreate_capped/output.txt @@ -15,6 +15,7 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-capped-po Error: cannot recreate resources.postgres_synced_tables.my_table: waiting after deleting id=synced_tables/lakebase_test_[UNIQUE_NAME].public.trips_synced: timed out: synced table still exists, waiting for deletion to complete Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 3 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/registered_models/aliases_converge/output.txt b/acceptance/bundle/resources/registered_models/aliases_converge/output.txt index 8b030f89a60..90ed95e33cd 100644 --- a/acceptance/bundle/resources/registered_models/aliases_converge/output.txt +++ b/acceptance/bundle/resources/registered_models/aliases_converge/output.txt @@ -13,6 +13,7 @@ API error_code: RESOURCE_DOES_NOT_EXIST API message: Model version 1 of registered model main.default.my-registered-model-aliases-[UNIQUE_NAME] does not exist. Files: 2 uploaded, 0 deleted +Resources: 0 created, 0 changed, 0 deleted, 0 unchanged, 1 failed === The model is tracked: the next plan retries the alias as an update instead of creating the model again diff --git a/acceptance/bundle/resources/vector_search_endpoints/recreate/create-fails/output.txt b/acceptance/bundle/resources/vector_search_endpoints/recreate/create-fails/output.txt index 906b8045fb6..f1d821e080a 100644 --- a/acceptance/bundle/resources/vector_search_endpoints/recreate/create-fails/output.txt +++ b/acceptance/bundle/resources/vector_search_endpoints/recreate/create-fails/output.txt @@ -26,6 +26,7 @@ API error_code: RESOURCE_ALREADY_EXISTS API message: Vector search endpoint with name vs-endpoint-b-[UNIQUE_NAME] already exists Files: 0 uploaded, 0 deleted +Resources: 0 created, 0 changed, 1 deleted, 1 unchanged, 1 failed Exit code: 1 diff --git a/acceptance/bundle/resources/volumes/set-storage-location/out.deploy.txt b/acceptance/bundle/resources/volumes/set-storage-location/out.deploy.txt index d92adb87392..70140187f19 100644 --- a/acceptance/bundle/resources/volumes/set-storage-location/out.deploy.txt +++ b/acceptance/bundle/resources/volumes/set-storage-location/out.deploy.txt @@ -10,3 +10,4 @@ API error_code: INVALID_PARAMETER_VALUE API message: CreateVolume storage_location can not be provided. Files: 3 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 1 failed diff --git a/bundle/deployplan/action.go b/bundle/deployplan/action.go index e53ef0d84bd..830511ac383 100644 --- a/bundle/deployplan/action.go +++ b/bundle/deployplan/action.go @@ -12,9 +12,13 @@ type Action struct { // Gone mirrors PlanEntry.Gone: the delete is a state-only cleanup because the // resource no longer exists remotely. Gone bool - // StateOnly mirrors PlanEntry.StateOnly: the delete is a state-only cleanup - // because the resource implements no DoDelete (deleting it has no backend effect). + // StateOnly mirrors PlanEntry.StateOnly: the delete step has no backend effect + // because the resource implements no DoDelete, including during a recreate. StateOnly bool + // Attempted and Applied mirror the same PlanEntry fields: Attempted means Apply + // reached this resource, Applied means its operation completed. + Attempted bool + Applied bool } func (a Action) String() string { @@ -27,7 +31,7 @@ func (a Action) String() string { // from the resource counts, and need no destructive-action approval. See the same // method on PlanEntry. func (a Action) IsStateOnlyDelete() bool { - return a.Gone || a.StateOnly + return a.ActionType == Delete && (a.Gone || a.StateOnly) } func (a Action) IsChildResource() bool { diff --git a/bundle/deployplan/plan.go b/bundle/deployplan/plan.go index 8446b200b12..56cdd174bc3 100644 --- a/bundle/deployplan/plan.go +++ b/bundle/deployplan/plan.go @@ -43,7 +43,7 @@ type Plan struct { } // ActionCounts summarizes a plan's actions by category. A recreate counts as -// both a create and a delete, matching how plan and deploy report changes. +// a create and, if the resource has a backend delete operation, a delete. type ActionCounts struct { Create int Change int @@ -71,8 +71,9 @@ func (p *Plan) CountActions() ActionCounts { } c.Delete++ case Recreate: - // A recreate counts as both a delete and a create. - c.Delete++ + if !entry.StateOnly { + c.Delete++ + } c.Create++ case Skip, Undefined: c.Unchanged++ @@ -81,6 +82,61 @@ func (p *Plan) CountActions() ActionCounts { return c } +// AppliedCounts reports completed operations and failed attempts. +type AppliedCounts struct { + ActionCounts + Failed int +} + +// CountApplied tallies the plan by outcome rather than by plan: a create/change/delete +// is counted in its category only if its entry was applied successfully, an eligible +// operation that was attempted but not applied (it errored, or a failed dependency +// skipped it) is counted as Failed, and one Apply never reached is counted as neither. +// Skips are unchanged regardless, since they run no backend operation; state-only deletes +// are excluded entirely, matching CountActions. A failed recreate can still count a +// completed deletion. +func (p *Plan) CountApplied() AppliedCounts { + var c AppliedCounts + for _, entry := range p.Plan { + switch entry.Action { + case Create: + if entry.Applied { + c.Create++ + } else if entry.Attempted { + c.Failed++ + } + case Update, UpdateWithID, Resize: + if entry.Applied { + c.Change++ + } else if entry.Attempted { + c.Failed++ + } + case Delete: + if entry.IsStateOnlyDelete() { + continue + } + if entry.Applied { + c.Delete++ + } else if entry.Attempted { + c.Failed++ + } + case Recreate: + // The old resource can be gone even if creating its replacement failed. + if entry.RecreateDeleted { + c.Delete++ + } + if entry.Applied { + c.Create++ + } else if entry.Attempted { + c.Failed++ + } + case Skip, Undefined: + c.Unchanged++ + } + } + return c +} + // NewPlanDirect creates a new Plan for direct engine with plan_version set. func NewPlanDirect() *Plan { return &Plan{ @@ -126,16 +182,28 @@ type PlanEntry struct { // exists remotely. Applying such an entry only removes it from the state, without // calling the delete API, and approval prompts do not list it as a deletion. Gone bool `json:"gone,omitempty"` - // StateOnly is set on Delete entries for resources that implement no DoDelete: - // deleting them has no backend effect. Like Gone, applying such an entry only - // removes it from the state and it is excluded from destructive-action prompts, - // textual plan output and the deleted count — but unlike Gone it is a property of - // the resource type, not of the current remote state, so planning skips the - // remote read that Gone detection needs. + // StateOnly is set on Delete and Recreate entries for resources with no DoDelete: + // their delete step has no backend effect. A Delete only removes state and is + // excluded from destructive-action prompts, textual plan output and counts. + // A Recreate still creates a resource and remains visible, but counts no deletion. + // Unlike Gone, this is a property of the resource type, not remote state, so + // planning a Delete skips the remote read that Gone detection needs. StateOnly bool `json:"state_only,omitempty"` NewState *structvar.StructVarJSON `json:"new_state,omitempty"` RemoteState any `json:"remote_state,omitempty"` Changes Changes `json:"changes,omitempty"` + + // Attempted is set when Apply starts processing this entry (the apply graph ran and + // reached this node); Applied is set when its operation completes. Both + // are runtime-only (never serialized). Together they let the deploy/destroy summaries + // report what actually happened - applied, or attempted-but-failed - rather than the + // planned count. An entry Apply never reached (e.g. a config error bailed out before + // the graph ran) has neither set and is reported as neither applied nor failed. + Attempted bool `json:"-"` + Applied bool `json:"-"` + // RecreateDeleted records completion of a recreate's backend delete step, even if + // creating the replacement subsequently fails. + RecreateDeleted bool `json:"-"` } // IsStateOnlyDelete reports whether applying this delete only drops the state entry @@ -143,7 +211,7 @@ type PlanEntry struct { // delete operation (StateOnly). Such deletes are omitted from human output, excluded // from the resource counts, and need no destructive-action approval. func (e *PlanEntry) IsStateOnlyDelete() bool { - return e.Gone || e.StateOnly + return e.Action == Delete && (e.Gone || e.StateOnly) } type DependsOnEntry struct { @@ -239,6 +307,8 @@ func (p *Plan) GetActions() []Action { ActionType: entry.Action, Gone: entry.Gone, StateOnly: entry.StateOnly, + Attempted: entry.Attempted, + Applied: entry.Applied, }) } diff --git a/bundle/deployplan/plan_test.go b/bundle/deployplan/plan_test.go index cee00f42c44..063a42365d7 100644 --- a/bundle/deployplan/plan_test.go +++ b/bundle/deployplan/plan_test.go @@ -65,3 +65,88 @@ func TestHasChange(t *testing.T) { }) } } + +func TestCountActionsRecreateWithoutDelete(t *testing.T) { + entry := &deployplan.PlanEntry{Action: deployplan.Recreate, StateOnly: true} + plan := &deployplan.Plan{Plan: map[string]*deployplan.PlanEntry{"resources.job_runs.a": entry}} + assert.Equal(t, deployplan.ActionCounts{Create: 1}, plan.CountActions()) + // A recreate still creates a resource, so it must remain visible in plan output + // and approval prompts even though its delete step only cleans up state. + assert.False(t, entry.IsStateOnlyDelete()) + assert.False(t, plan.GetActions()[0].IsStateOnlyDelete()) +} + +func TestCountApplied(t *testing.T) { + tests := []struct { + name string + entry deployplan.PlanEntry + want deployplan.AppliedCounts + }{ + { + name: "create applied", + entry: deployplan.PlanEntry{Action: deployplan.Create, Attempted: true, Applied: true}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Create: 1}}, + }, + { + name: "create attempted but failed", + entry: deployplan.PlanEntry{Action: deployplan.Create, Attempted: true}, + want: deployplan.AppliedCounts{Failed: 1}, + }, + { + name: "create never reached is neither applied nor failed", + entry: deployplan.PlanEntry{Action: deployplan.Create}, + want: deployplan.AppliedCounts{}, + }, + { + name: "update applied counts as changed", + entry: deployplan.PlanEntry{Action: deployplan.Update, Attempted: true, Applied: true}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Change: 1}}, + }, + { + name: "delete applied", + entry: deployplan.PlanEntry{Action: deployplan.Delete, Attempted: true, Applied: true}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Delete: 1}}, + }, + { + name: "delete attempted but failed", + entry: deployplan.PlanEntry{Action: deployplan.Delete, Attempted: true}, + want: deployplan.AppliedCounts{Failed: 1}, + }, + { + name: "state-only delete is excluded", + entry: deployplan.PlanEntry{Action: deployplan.Delete, StateOnly: true, Attempted: true}, + want: deployplan.AppliedCounts{}, + }, + { + name: "recreate applied counts as both create and delete", + entry: deployplan.PlanEntry{Action: deployplan.Recreate, Attempted: true, Applied: true, RecreateDeleted: true}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Create: 1, Delete: 1}}, + }, + { + name: "recreate parent-managed resource without deleting it", + entry: deployplan.PlanEntry{Action: deployplan.Recreate, Attempted: true, Applied: true}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Create: 1}}, + }, + { + name: "recreate delete failed", + entry: deployplan.PlanEntry{Action: deployplan.Recreate, Attempted: true}, + want: deployplan.AppliedCounts{Failed: 1}, + }, + { + name: "recreate create failed after deleting old resource", + entry: deployplan.PlanEntry{Action: deployplan.Recreate, Attempted: true, RecreateDeleted: true}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Delete: 1}, Failed: 1}, + }, + { + name: "skip is unchanged regardless of attempt", + entry: deployplan.PlanEntry{Action: deployplan.Skip}, + want: deployplan.AppliedCounts{ActionCounts: deployplan.ActionCounts{Unchanged: 1}}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + p := &deployplan.Plan{Plan: map[string]*deployplan.PlanEntry{"resources.jobs.a": &tt.entry}} + assert.Equal(t, tt.want, p.CountApplied()) + }) + } +} diff --git a/bundle/direct/apply.go b/bundle/direct/apply.go index dc0751f03b3..39384d9a79e 100644 --- a/bundle/direct/apply.go +++ b/bundle/direct/apply.go @@ -47,7 +47,7 @@ func (d *DeploymentUnit) Deploy(ctx context.Context, db *dstate.DeploymentState, switch actionType { case deployplan.Recreate: - return d.Recreate(ctx, db, oldID, newState) + return d.Recreate(ctx, db, oldID, newState, planEntry) case deployplan.Update: return d.Update(ctx, db, oldID, newState, planEntry) case deployplan.UpdateWithID: @@ -111,7 +111,7 @@ func (d *DeploymentUnit) Create(ctx context.Context, db *dstate.DeploymentState, return nil } -func (d *DeploymentUnit) Recreate(ctx context.Context, db *dstate.DeploymentState, oldID string, newState any) error { +func (d *DeploymentUnit) Recreate(ctx context.Context, db *dstate.DeploymentState, oldID string, newState any, entry *deployplan.PlanEntry) error { oldState, err := d.loadPersistedState(db) if err != nil { return err @@ -124,7 +124,8 @@ func (d *DeploymentUnit) Recreate(ctx context.Context, db *dstate.DeploymentStat _, err = retry.With(ctx, retry.IsTransient, func() (struct{}, error) { return struct{}{}, d.Adapter.DoDelete(ctx, oldID, oldState) }) - if err != nil && !apierr.IsMissing(err) && !isManagedByParent(err) { + managedByParent := isManagedByParent(err) + if err != nil && !apierr.IsMissing(err) && !managedByParent { if !d.deleteConfirmedGone(ctx, oldID) { return fmt.Errorf("deleting old id=%s: %w", oldID, err) } @@ -152,6 +153,9 @@ func (d *DeploymentUnit) Recreate(ctx context.Context, db *dstate.DeploymentStat if err != nil && !apierr.IsMissing(err) { return fmt.Errorf("waiting after deleting id=%s: %w", oldID, err) } + // Older saved plans omit StateOnly on recreates, so use the adapter's capability + // when recording the actual outcome. + entry.RecreateDeleted = d.Adapter.HasDoDelete() && !managedByParent return d.Create(ctx, db, newState) } diff --git a/bundle/direct/bundle_apply.go b/bundle/direct/bundle_apply.go index add38bf99f6..5bebd99ecd1 100644 --- a/bundle/direct/bundle_apply.go +++ b/bundle/direct/bundle_apply.go @@ -66,6 +66,11 @@ func (b *DeploymentBundle) Apply(ctx context.Context, client *databricks.Workspa defer plan.WriteUnlockEntry(resourceKey) + // Mark the entry attempted: the graph ran and reached this node. Together with + // Applied (set on success below) this lets the summary distinguish a resource that + // was attempted and failed from one Apply never reached. + entry.Attempted = true + action := entry.Action errorPrefix := fmt.Sprintf("cannot %s %s", action, resourceKey) @@ -128,11 +133,11 @@ func (b *DeploymentBundle) Apply(ctx context.Context, client *databricks.Workspa return false } // A state-only delete performs no backend operation, so don't report it, - // consistent with the summary (CountActions excludes it) and the terraform - // path in logDeploySummary. + // consistent with the plan and apply summaries. if reportApplied && !entry.IsStateOnlyDelete() { cmdio.LogString(ctx, deployplan.AppliedLine(resourceKey, action)) } + entry.Applied = true return true } @@ -171,8 +176,10 @@ func (b *DeploymentBundle) Apply(ctx context.Context, client *databricks.Workspa } b.DeployDurations.Store(resourceKey, time.Since(start)) - // Reported before the remote-state refresh below: the resource is already - // deployed at this point, so the line is accurate even if the refresh fails. + // Marked (and reported) before the remote-state refresh below: the resource is + // already deployed at this point, so the summary count and the line are accurate + // even if the refresh fails. + entry.Applied = true if reportApplied { cmdio.LogString(ctx, deployplan.AppliedLine(resourceKey, action)) } diff --git a/bundle/direct/bundle_plan.go b/bundle/direct/bundle_plan.go index 237fcc75521..e9547055d81 100644 --- a/bundle/direct/bundle_plan.go +++ b/bundle/direct/bundle_plan.go @@ -389,6 +389,7 @@ func (b *DeploymentBundle) CalculatePlan(ctx context.Context, client *databricks } entry.Action = action + entry.StateOnly = action == deployplan.Recreate && !adapter.HasDoDelete() return true }) diff --git a/bundle/phases/deploy.go b/bundle/phases/deploy.go index 9c4d4b178cb..a3e73d6e292 100644 --- a/bundle/phases/deploy.go +++ b/bundle/phases/deploy.go @@ -122,8 +122,9 @@ func logFileSummary(ctx context.Context, b *bundle.Bundle) { cmdio.LogString(ctx, fmt.Sprintf("Files: %d uploaded, %d deleted", b.FileCounts.Uploaded, b.FileCounts.Deleted)) } -// logDeploySummary prints the resource summary line. -qq drops it too. The direct engine -// prints each per-resource applied line itself as it goes, so there are none to report here. +// logDeploySummary prints the resource summary line. -qq drops it too. The counts reflect +// what Apply actually did (CountApplied), so the line is accurate on a partial failure too; +// per-resource applied lines are printed by the engine as it goes, not here. func logDeploySummary(ctx context.Context, b *bundle.Bundle, plan *deployplan.Plan) { if b.Quiet >= bundle.QuietAll { return @@ -131,8 +132,11 @@ func logDeploySummary(ctx context.Context, b *bundle.Bundle, plan *deployplan.Pl logFileSummary(ctx, b) - counts := plan.CountActions() + counts := plan.CountApplied() summary := fmt.Sprintf("Resources: %d created, %d changed, %d deleted, %d unchanged", counts.Create, counts.Change, counts.Delete, counts.Unchanged) + if counts.Failed > 0 { + summary += fmt.Sprintf(", %d failed", counts.Failed) + } // Gate on the plan's own NotSelected (not b.Select) so the suffix survives a // deploy from a --plan file, where --select was applied at plan time and // b.Select is empty here. NotSelected is only ever set by FilterToSelected. @@ -338,20 +342,21 @@ func Deploy(ctx context.Context, b *bundle.Bundle, outputHandler sync.OutputHand deployCore(ctx, b, plan) + // Report what was deployed, mirroring "bundle plan". Printed before the postdeploy + // script so the deploy's own report is not interleaved with post-deploy output. The + // counts come from CountApplied, so they describe what Apply actually did: on a + // partial resource failure this still reports what succeeded and what failed. A + // failure with no failed resources (e.g. a later state-push error) reports files + // only, as before - see acceptance bundle/deploy/partial-summary-on-push-fail. + if !logdiag.HasError(ctx) || plan.CountApplied().Failed > 0 { + filesReported = true + logDeploySummary(ctx, b, plan) + } + if logdiag.HasError(ctx) { return } - // Report what was deployed, mirroring "bundle plan". Printed before the - // postdeploy script so the deploy's own report is not interleaved with - // post-deploy output: the script's lines and the migration's below both follow - // it, and neither reads as belonging to the deploy. The resources were applied - // above, so the counts are accurate however the script turns out, and its error - // still propagates. Earlier failures report the files only, since the plan - // counts would then describe what was intended rather than what was applied. - filesReported = true - logDeploySummary(ctx, b, plan) - bundle.ApplyContext(ctx, b, scripts.Execute(config.ScriptPostDeploy)) } diff --git a/bundle/phases/destroy.go b/bundle/phases/destroy.go index 07fed65ba80..8ca6fe9c54b 100644 --- a/bundle/phases/destroy.go +++ b/bundle/phases/destroy.go @@ -138,7 +138,38 @@ func approvalForDestroy(ctx context.Context, b *bundle.Bundle, plan *deployplan. return cmdio.AskYesOrNo(ctx, "Would you like to proceed?") } +// logDestroySummary reports completed deletions and failed attempts. +// Called even on error, since partial deletions may have succeeded. +func logDestroySummary(ctx context.Context, b *bundle.Bundle, plan *deployplan.Plan) { + if b.Quiet < bundle.QuietAll { + // Count top-level resources only, matching the approval list above (which + // skips children). Gone resources are excluded to match that list: they were + // already deleted remotely, so applying their Delete only cleans up stale + // state and is not a destruction to report. Attempted operations that did not + // complete count as failed. + deleted, failed := 0, 0 + for _, a := range plan.GetActions() { + if a.ActionType != deployplan.Delete || a.IsChildResource() || a.IsStateOnlyDelete() { + continue + } + if a.Applied { + deleted++ + } else if a.Attempted { + failed++ + } + } + summary := fmt.Sprintf("Destroy: %d deleted", deleted) + if failed > 0 { + summary += fmt.Sprintf(", %d failed", failed) + } + cmdio.LogString(ctx, summary) + } +} + func destroyCore(ctx context.Context, b *bundle.Bundle, plan *deployplan.Plan) { + // Ensure the destroy summary is printed even on error, since partial deletions + // may have succeeded. + defer logDestroySummary(ctx, b, plan) // Not reported per resource: destroy names them up front for consent and then // reports only a count, so there is no per-resource output to report into. b.DeploymentBundle.Apply(ctx, b.WorkspaceClient(ctx), plan, false) @@ -183,23 +214,6 @@ func destroyCore(ctx context.Context, b *bundle.Bundle, plan *deployplan.Plan) { bundle.ApplyContext(ctx, b, files.Delete()) - // Print the summary even on error: resources that were deleted are still worth - // reporting (an accurate partial count is a follow-up). - if b.Quiet < bundle.QuietAll { - // Count top-level resources only, matching the approval list above (which - // skips children); this also keeps the count stable across engines. Gone - // resources are excluded to match that list: they were already deleted - // remotely, so applying their Delete only cleans up stale state and is not - // a destruction to report. - deleted := 0 - for _, a := range plan.GetActions() { - if a.ActionType == deployplan.Delete && !a.IsChildResource() && !a.IsStateOnlyDelete() { - deleted++ - } - } - cmdio.LogString(ctx, fmt.Sprintf("Destroy: %d deleted", deleted)) - } - if logdiag.HasError(ctx) { return } @@ -213,7 +227,7 @@ func destroyCore(ctx context.Context, b *bundle.Bundle, plan *deployplan.Plan) { // live terraform.tfstate with no direct state that the next deploy would pick up. Leaving any // local state behind would also let a later fresh deploy (e.g. from another machine with no local // state) mint a mismatched lineage. Log a removal failure but keep going; the destroy already - // succeeded and its summary is printed above. + // succeeded and its summary will be printed by the defer above. _, localTerraformPath := b.StateFilenameTerraform(ctx) _, localDirectPath := b.StateFilenameDirect(ctx) for _, path := range []string{localTerraformPath, localTerraformPath + ".backup", localDirectPath} {