Repository navigation
Support wildcard resource names in --select - #7977
Open
stevenayers wants to merge 6 commits into
Open
stevenayers wants to merge 6 commits into
stevenayers wants to merge 6 commits into
Conversation
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 If you're an external contributor, no action is needed; a maintainer will review your pull request. |
Author
|
@andrewnester thanks for the tags 👍 I've emailed dabs-feedback@databricks.com for a CLA agreement, will let you know when signed. |
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
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.
Changes
bundle deploy --selectandbundle plan --selectnow accept<type>.*, which selects every resource of that type:ResolveSelectorsexpands 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:Behaviour decisions:
no resources match <selector>in the same early validation as an unknown name. Strict can be relaxed later without breaking anyone.<type>.*is a wildcard -job*,*.fooand*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 withresource 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,destroyincluded, 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
--selecttakes 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
--selectinstead of adding a flag such as--resource-typebecause 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 jobswas 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
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.acceptance/bundle/select/resource_typeplans 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, likeselect/grants_permissions, which has the same job-permission and schema-grant fixtures.acceptance/bundle/select/missinggains the two no-match cases.acceptance/bundle/validate/reserved_resource_keychecks thatbundle validaterejects a*key at the root and under a target, and accepts a key that only contains*.