Repository navigation
Support selecting resources for deletion with bundle deploy --select - #7023
Conversation
Add the trailing PR link required by the changelog validation so the Changelog Preview workflow passes. Co-authored-by: Isaac <no-reply@databricks.com>
Integration test reportCommit: 4251876
Top 6 slowest tests (at least 2 minutes):
|
aee21d0 to
30adca7
Compare
|
Commit: Regression test reportSelected 6 changed tests (limit=20, 0 not selected) 12 tests: regression=6 unreleased=0 coverage=6 failing=0
TestAccept/bundle/select/deletion/DMS=: branch ✅ | main (1ea9041) ❌ | latest (v1.22.1) ❌main (1ea9041): latest (v1.22.1): same output as main (1ea9041) TestAccept/bundle/select/deletion/DMS=true: branch ✅ | main (1ea9041) ❌ | latest (v1.22.1) ❌main (1ea9041): latest (v1.22.1): same output as main (1ea9041) TestAccept/bundle/select/deletion_dependents/DMS=: branch ✅ | main (1ea9041) ❌ | latest (v1.22.1) ❌main (1ea9041): latest (v1.22.1): same output as main (1ea9041) TestAccept/bundle/select/deletion_dependents/DMS=true: branch ✅ | main (1ea9041) ❌ | latest (v1.22.1) ❌main (1ea9041): latest (v1.22.1): TestAccept/bundle/select/deletion_saved_plan/DMS=: branch ✅ | main (1ea9041) ❌ | latest (v1.22.1) ❌main (1ea9041): latest (v1.22.1): same output as main (1ea9041) TestAccept/bundle/select/deletion_saved_plan/DMS=true: branch ✅ | main (1ea9041) ❌ | latest (v1.22.1) ❌main (1ea9041): latest (v1.22.1): same output as main (1ea9041) |
3f151b0 to
1c8d42e
Compare
Resolve --select selectors against the computed plan (Plan.FilterToSelected) instead of the config, so resources removed from config and planned for deletion can be selected like any other. The old ResolveSelect mutator is reduced to recording the select_used telemetry flag (renamed MarkSelectUsed). When a selected resource is being deleted, the plan's closure follows reverse dependency edges: its dependents are deleted too so none are left dangling, while its own dependencies are left untouched — mirroring bundle destroy. A deployed selection still follows forward edges to pull in its dependencies. Grants and permissions sub-nodes move with their parent in both directions. Deleting a resource whose dependent is still live (still in config, not itself being deleted) is an error before any API delete requests are sent. An invalid --select (a name in neither config nor state) is rejected before the predeploy script runs or any files are uploaded. When --plan is used alongside a --select that doesn't match the selectors the plan was built with, a warning is emitted. The plan serializes was_filtered and selectors so a pre-filtered plan file can be passed to bundle deploy --plan without re-specifying --select. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Remove the WasFiltered and Selectors plan fields and the --plan + --select warning they supported, per review: --plan keeps ignoring --select as before, and encoding the selection in the plan is left for a follow-up. Stop sorting the delete requests in the deletion_dependents acceptance test. --sort orders by raw job ID, which is random on a real workspace and made the test flaky in cloud runs; dependents are deleted first, so the order is stable. Co-authored-by: Isaac <no-reply@databricks.com>
1c8d42e to
4251876
Compare
| // e.g. "jobs.my_job") plus their transitive dependencies as recorded in each | ||
| // entry's DependsOn field. Nodes not reachable from the selected set are removed. | ||
| func (p *Plan) FilterToSelected(selected []string) { | ||
| // ResolveSelectors maps each --select selector to its plan key ("resources.type.name") |
There was a problem hiding this comment.
There seems to be minor overlap with ResolveKey https://github.com/databricks/cli/pull/7128/changes
maybe we should rewrite ResolveKey users to use this function (not required, just an idea).
There was a problem hiding this comment.
That true, but ResolveKey returns the config object and can't see state-only deletions, so I'd keep them separate here and maybe address in follow-up.
Integration test reportCommit: 3909f85
12 interesting tests: 12 flaky
Top 50 slowest tests (at least 2 minutes):
|
Resolve
--selectselectors against the computed plan (Plan.FilterToSelected) instead of the config, so resources removed from config and planned for deletion can be selected like any other. The oldResolveSelectmutator is reduced to recording theselect_usedtelemetry flag (renamedMarkSelectUsed).When a selected resource is being deleted, the plan's closure follows reverse dependency edges: its dependents are deleted too so none are left dangling, while its own dependencies are left untouched — mirroring
bundle destroy. A deployed selection still follows forward edges to pull in its dependencies. Grants and permissions sub-nodes move with their parent in both directions.Deleting a resource whose dependent is still live (still in config, not itself being deleted) is an error before any API delete requests are sent. An invalid
--select(a name in neither config nor state) is rejected before the predeploy script runs or any files are uploaded.Tests
Added unit tests (
TestFilterToSelected_*) and acceptance tests underacceptance/bundle/select.This pull request and its description were written by Isaac.