Skip to content

Support wildcard resource names in --select - #7977

Open
stevenayers wants to merge 6 commits into
databricks:mainfrom
stevenayers:feature/select-by-resource-type
Open

stevenayers wants to merge 6 commits into
databricks:mainfrom
stevenayers:feature/select-by-resource-type

Conversation

@stevenayers

Copy link
Copy Markdown

Changes

bundle deploy --select and bundle plan --select now accept <type>.*, which selects every resource of that type:

databricks bundle deploy --select 'jobs.*'
databricks bundle plan --select 'pipelines.*,schemas.*'
databricks bundle deploy --select 'jobs.*' --select my_schema

ResolveSelectors expands the selector to the plan keys of that type. Filtering and early validation are unchanged, so a type selection behaves as if each resource had been named:

  • Dependencies of the selected resources are included, along with their grants and permissions.
  • Resources of the type that exist only in state are selected for deletion.

Behaviour decisions:

  • No match is an error - an unknown type, or a type with no resources in config or state, fails with no resources match <selector> in the same early validation as an unknown name. Strict can be relaxed later without breaking anyone.
  • Only <type>.* is a wildcard - job*, *.foo and * keep the existing literal lookup.
  • * is no longer accepted as a resource key - it would make --select 'jobs.*' ambiguous, so a resource keyed * now fails validation with resource key "*" is reserved for --select '<type>.*'; rename this resource. Keys that only contain * are unaffected. The check runs after target overrides are merged and Python-defined resources are loaded.

Rejecting * is a breaking change for a bundle that has such a key: bundle commands, destroy included, fail until the key is renamed, and renaming a deployed resource recreates it. I expect it to be rare, because ${resources.jobs.*.id} does not parse, so nothing could reference such a resource.

Why

--select takes resource names, so deploying only the jobs of a bundle means listing every one and keeping that list in sync with the config.

I extended --select instead of adding a flag such as --resource-type because a type selection is the same kind of value the flag already takes: a resource key path. That follows the direction in #5852 ("we could support --select jobs.foo,jobs.foo.permissions") and avoids two flags that filter the same plan. A bare --select jobs was not an option, since a selector without a dot is already a resource name.

Nobody has weighed in on this spelling yet, so I'm glad to change it if you prefer another.

Tests

  • Unit tests TestResolveSelectors_TypeWildcard* cover expansion and ordering, the no-match errors, the * shapes that stay literal, and a * key left in state by an earlier deploy.
  • New acceptance test acceptance/bundle/select/resource_type plans and deploys with one type, two types, and a type combined with a name. It then removes a job from config and checks that the type selector deletes it. It is local-only, like select/grants_permissions, which has the same job-permission and schema-grant fixtures.
  • acceptance/bundle/select/missing gains the two no-match cases.
  • New acceptance test acceptance/bundle/validate/reserved_resource_key checks that bundle validate rejects a * key at the root and under a target, and accepts a key that only contains *.

@stevenayers
stevenayers requested review from a team as code owners November 25, 2026 13:51
@github-actions github-actions Bot added the DABs DABs related issues label Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution! This pull request was opened from a fork.

If you're a member of the Databricks organization, please request access to the cli-contrib team and open your pull request from a branch in this repository instead of a fork — fork PRs don't run integration tests automatically and have reduced CI access.

If you're an external contributor, no action is needed; a maintainer will review your pull request.

@stevenayers

Copy link
Copy Markdown
Author

@andrewnester thanks for the tags 👍 I've emailed dabs-feedback@databricks.com for a CLA agreement, will let you know when signed.

@github-actions

Copy link
Copy Markdown
Contributor

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

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 7977
  • Commit SHA: e70ea568ea65ed245c2e7561e009eac2a1912304

Checks will be approved automatically on success.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants