Repository navigation
Support selecting resources for deletion with bundle deploy --select - #7023
Open
andersrexdb wants to merge 1 commit into
Open
andersrexdb wants to merge 1 commit into
andersrexdb wants to merge 1 commit into
Conversation
andersrexdb
added a commit
that referenced
this pull request
Oct 12, 2026
Add the trailing PR link required by the changelog validation so the Changelog Preview workflow passes. Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
Integration test reportCommit: 30adca7
|
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>
andersrexdb
force-pushed
the
select-deletions
branch
from
October 15, 2026 09:46
aee21d0 to
30adca7
Compare
denik
reviewed
Oct 15, 2026
| @@ -0,0 +1 @@ | |||
| * `databricks bundle deploy --select` and `bundle plan --select` can now select resources removed from config, so a selective deploy applies their deletion. Deleting a selected resource also deletes its dependents that are also being removed, mirroring `bundle destroy`. Selecting a resource for deletion errors if a live resource still references it, preventing a broken bundle. An unqualified `--select <name>` is ambiguous when a resource of the same name exists in both config and state as different types. ([#7023](https://github.com/databricks/cli/pull/7023)) | |||
Contributor
There was a problem hiding this comment.
We typically use shorter messages here, e.g. PR title is good enough.
|
|
||
| # A resource removed from config is selectable by name, like any created or updated | ||
| # one. The plan is filtered to just its deletion. | ||
| trace $CLI bundle plan --select jobs.gone |
Contributor
There was a problem hiding this comment.
should we parametrize selector? $SELECTOR
in test.toml: EnvMatrix.SELECTOR = ["jobs.gone", "gone"]
| Resources: 3 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> [CLI] bundle plan --select jobs.producer | ||
| Error: cannot delete jobs.producer: jobs.consumer still references it; remove the reference or also remove jobs.consumer from the config |
Contributor
There was a problem hiding this comment.
Should not this configuration fail even without --select? There is a reference to a missing resource, the whole config is not valid.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Note: 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.
Tests
Added unit tests (
TestFilterToSelected_*) and acceptance tests underacceptance/bundle/select.This pull request and its description were written by Isaac.