Skip to content

Conversation

@varundeepsaini
Copy link
Contributor

@varundeepsaini varundeepsaini commented Dec 6, 2025

Fixes: #4089

Changes

When deleting resources with dependencies, the direct deployment engine now deletes dependents before their dependencies. Previously, resources were deleted in deployment order, which could cause errors when a dependency was deleted before resources that depend on it.

Edge direction in the dependency graph is now determined per-node based on action type:

  • Delete actions: reverse edge (dependent → dependency)
  • Other actions: normal edge (dependency → dependent)

@varundeepsaini varundeepsaini force-pushed the fix/dependency-ordered-deletion branch from d6ebbc5 to 2042b3a Compare December 9, 2025 17:45
@varundeepsaini
Copy link
Contributor Author

@andrewnester @denik
could you please review this, and queue the tests

@denik
Copy link
Contributor

denik commented Dec 10, 2025

Thanks @varundeepsaini this looks on the right track.

You need to update output of all acceptance tests (make test-update) and deduplicate the entries:

=== FAIL: acceptance TestAccept/bundle/migrate/basic/DATABRICKS_BUNDLE_ENGINE=direct (re-run 1) (5.35s)
    acceptance_test.go:1401: No effective updates from BundleConfig.default_name
    acceptance_test.go:819: Diff:
        --- bundle/migrate/basic/out.new_state.json
        +++ /tmp/TestAcceptbundlemigratebasicDATABRICKS_BUNDLE_ENGINE=direct2716390764/001/out.new_state.json
        @@ -51,7 +51,15 @@
              "volume_catalog_name": "mycat",
              "volume_storage_location": "s3://deco-uc-prod-isolated-aws-us-east-1/metastore/[UUID]/volumes/[UUID]"
             }
        -   }
        +   },
        +   "depends_on": [
        +    "resources.jobs.test_job",
        +    "resources.jobs.test_job",
        +    "resources.jobs.test_job",
        +    "resources.volumes.test_volume",
        +    "resources.volumes.test_volume",
        +    "resources.volumes.test_volume"
        +   ]
           },
           "resources.volumes.test_volume": {
            "__id__": "mycat.myschema.myvol",

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Dec 10, 2025

Commit: 7a2ff5e

Run: 20229246583

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 1 380 646 20:08
🟨​ aws windows 7 1 382 644 18:08
🟨​ aws-ucws linux 3 4 1 523 531 27:37
🟨​ aws-ucws windows 3 4 1 525 529 24:01
💚​ azure linux 1 3 381 644 18:49
💚​ azure windows 1 3 383 642 18:01
💚​ azure-ucws linux 1 3 520 529 25:44
💚​ azure-ucws windows 1 3 522 527 24:48
💚​ gcp linux 1 3 370 650 18:25
💚​ gcp windows 1 3 372 648 17:40
8 interesting tests: 7 KNOWN, 1 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 🟨​K 🟨​K 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 🟨​K 🟨​K
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
Top 25 slowest tests (at least 2 minutes):
duration env testname
7:19 aws-ucws linux TestAccept/bundle/resources/synced_database_tables/basic
6:24 aws-ucws windows TestAccept/bundle/resources/synced_database_tables/basic
6:02 aws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
5:49 aws-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
5:39 aws-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:37 gcp windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:37 aws-ucws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
5:36 aws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
5:32 aws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:26 gcp windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
5:25 gcp linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:25 aws-ucws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
4:57 gcp linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
4:25 azure-ucws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
4:19 azure-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
4:15 azure-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
3:57 azure-ucws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
3:55 azure linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
3:35 azure linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
2:49 azure-ucws windows TestAccept/bundle/resources/synced_database_tables/basic
2:45 azure-ucws linux TestAccept/bundle/resources/synced_database_tables/basic
2:29 azure-ucws linux TestAccept
2:23 aws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
2:14 gcp linux TestAccept
2:12 azure linux TestAccept

@varundeepsaini
Copy link
Contributor Author

@denik
Could you please review this, and queue the tests

Copy link
Contributor

@denik denik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, minor comments remaining. Please also rebase.

Added bundle/direct/graph_test.go

I don't see this file.

@varundeepsaini
Copy link
Contributor Author

varundeepsaini commented Dec 12, 2025

@denik can you review once again, and queue the tests (the integration tests as well)

@denik
Copy link
Contributor

denik commented Dec 12, 2025

Looks great! Please also update NEXT_CHANGELOG.md

@varundeepsaini
Copy link
Contributor Author

updated the changelog

@github-actions
Copy link

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 4105
  • Commit SHA: 7a2ff5e923241891b768f2c9a278245d8ba16014

Checks will be approved automatically on success.

Copy link
Contributor

@denik denik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks!

@denik denik added this pull request to the merge queue Dec 15, 2025
Merged via the queue into databricks:main with commit 700366b Dec 15, 2025
19 checks passed
@eng-dev-ecosystem-bot
Copy link
Collaborator

Commit: 700366b

Run: 20231484559

Env 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 1 416 632 46:37
🟨​ aws windows 7 1 418 630 46:24
🟨​ aws-ucws linux 3 4 1 577 511 70:27
🟨​ aws-ucws windows 3 4 1 579 509 59:23
💚​ azure linux 1 3 417 630 50:23
💚​ azure windows 1 3 419 628 48:01
💚​ azure-ucws linux 1 3 574 509 66:26
🔄​ azure-ucws windows 3 3 574 507 70:19
💚​ gcp linux 1 3 397 639 47:33
💚​ gcp windows 1 3 399 637 52:08
10 interesting tests: 7 KNOWN, 2 flaky, 1 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 🟨​K 🟨​K 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R
🔄​ TestAccept/bundle/resources/clusters/run/spark_python_task ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p
🔄​ TestAccept/bundle/resources/clusters/run/spark_python_task/DATABRICKS_BUNDLE_ENGINE=direct ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 🟨​K 🟨​K 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 🟨​K 🟨​K
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
Top 50 slowest tests (at least 2 minutes):
duration env testname
20:10 azure-ucws windows TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=terraform
19:46 azure-ucws windows TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=direct
15:51 azure-ucws linux TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=terraform
14:57 gcp windows TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
14:53 azure-ucws linux TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=direct
14:02 aws-ucws linux TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=terraform
13:04 gcp linux TestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=terraform
12:38 gcp windows TestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=terraform
11:13 aws-ucws windows TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=terraform
10:54 aws-ucws windows TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=direct
10:53 gcp windows TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
10:30 aws-ucws linux TestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=direct
10:18 gcp linux TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
10:14 azure-ucws linux TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=SINGLE_USER
9:20 gcp windows TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
9:05 azure windows TestAccept/bundle/resources/permissions/factcheck/DATABRICKS_BUNDLE_ENGINE=terraform
9:03 gcp linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
8:48 azure linux TestAccept/bundle/resources/permissions/factcheck/DATABRICKS_BUNDLE_ENGINE=terraform
8:46 azure-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
8:45 azure-ucws linux TestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=terraform
8:42 aws windows TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
8:39 azure-ucws windows TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_15.4_LTS
8:27 aws linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
8:26 gcp linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
8:22 aws linux TestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_15.4_LTS
8:15 aws-ucws linux TestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=terraform
8:14 aws-ucws linux TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_15.4_LTS
8:10 azure-ucws windows TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
8:09 aws linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
8:08 gcp linux TestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_14.3_LTS
8:07 gcp windows TestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_15.4_LTS
8:06 azure-ucws linux TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
8:05 aws-ucws linux TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
8:02 azure linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
8:02 aws linux TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=USER_ISOLATION
8:01 aws-ucws linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
8:00 azure-ucws linux TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_14.3_LTS
8:00 azure-ucws linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
7:59 gcp windows TestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_14.3_LTS
7:56 azure-ucws windows TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
7:55 aws windows TestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=terraform
7:54 gcp windows TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=SINGLE_USER
7:52 gcp linux TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
7:50 aws windows TestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=direct
7:46 azure linux TestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
7:44 aws-ucws windows TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_15.4_LTS
7:44 gcp windows TestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=USER_ISOLATION
7:42 azure-ucws linux TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_15.4_LTS
7:42 azure-ucws linux TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_13.3_LTS
7:39 aws-ucws linux TestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_13.3_LTS

@varundeepsaini varundeepsaini deleted the fix/dependency-ordered-deletion branch December 15, 2025 14:10
deco-sdk-tagging bot added a commit that referenced this pull request Dec 18, 2025
## Release v0.281.0

### CLI
* Fix lakeview publish to default `embed_credentials` to false ([#4066](#4066))

### Bundles
* Add support for configurable catalog/schema for dashboards ([#4130](#4130))
* Pass SYSTEM\_ACCESSTOKEN from env to the Terraform provider ([#4135](#4135))
* `bundle deployment migrate`: when running `bundle plan` propagate `-var` arguments.
* engine/direct: New option --plan to `bundle deploy` to deploy previously saved plan (saved plan with `bundle plan -o json`) ([#4134](#4134))
* engine/direct: Fix dependency-ordered deletion by persisting depends\_on in state ([#4105](#4105))

### Dependency updates
* Upgrade Go SDK to 0.94.0 ([#4148](#4148))
* Upgrade Terraform provider to 1.100.0 ([#4150](#4150))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting resources should respect the dependencies between resources

3 participants