Add --select flag to bundle config-remote-sync#5579
Open
ilyakuz-db wants to merge 1 commit into
Open
Conversation
Contributor
Approval status: pending
|
7e6375b to
3701a7d
Compare
Collaborator
Integration test reportCommit: b6d6f85
24 interesting tests: 15 SKIP, 7 KNOWN, 2 flaky
Top 23 slowest tests (at least 2 minutes):
|
3701a7d to
4ad25ef
Compare
4ad25ef to
d17552e
Compare
d17552e to
49b2c08
Compare
49b2c08 to
bfe0a58
Compare
Add an opt-in --select flag to the experimental `bundle config-remote-sync`
command that restricts detected and saved changes to specific resources. Each
selector is "<type>:<id>" (e.g. jobs:123456789), using the resource type and
its deployed resource ID — the pair the workspace UI knows from a resource's
page, which has the ID but not the bundle "type.name" key. The type is required
because a resource ID is only unique within a type, so an ID that collides
across types would otherwise select the wrong resource. Selection is therefore
independent from `bundle deploy --select`, which matches keys.
Selectors are resolved to plan keys against the deployment state after planning,
so ${resources.*} references still resolve; only the emitted change set is
restricted. A selector that matches no deployed resource is an error. Default
behavior without the flag is unchanged.
This limits the blast radius of a sync run: syncing one resource can no longer
rewrite an unrelated drifted resource's configuration.
bfe0a58 to
b6d6f85
Compare
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
Add an opt-in
--selectflag to the experimentalbundle config-remote-synccommand (hidden; used by DABs in the Workspace). The flag restricts detected and saved changes to specific resources. Each selector is<type>:<id>(e.g.jobs:123456789) — the resource type plus its deployed resource ID. It is repeatable and/or comma-separated.Default behavior without the flag is unchanged.
Implementation notes:
type.namekey. Selection is therefore by<type>:<id>and is intentionally independent frombundle deploy --select(which matches keys); no logic is shared with deploy.resources.<type>.<name>), so a selector can only ever match its own type.DetectChangesstill plans the full resource set so${resources.*}references resolve; only the emitted change set is then restricted. A selector that matches no deployed resource is an error..path boundary, so syncing a resource never silently skips its permissions.Why
A full sync diffs every resource in a bundle, so a drifted-but-unrelated resource (for example a dashboard whose etag changed remotely because someone opened the draft) can have unwanted changes written into its YAML while the user is syncing a different resource. Passing the edited resource's
<type>:<id>via--selectlimits the blast radius of one sync run to that resource.Tests
bundle/configsync.acceptance/bundle/config-remote-sync/, both run on the direct and terraform engines:select_basic: two drifted jobs, select one byjobs:<id>— only that job's YAML changes, the other is left byte-identical (verified via backup +diff.py); re-selecting is idempotent; an unfiltered run still detects the other job's drift (no lost updates); a selector with an unknown ID, a selector with no type, and an ID under the wrong type are each rejected.select_multiple: comma-separated selectors select two of three resources, a repeated selector dedupes, repeated--selectflags combine, and the unselected resource is untouched.config-remote-syncacceptance tree and thebundle/select(deploy) tree pass unchanged on both engines — the flag is opt-in, no existing goldens changed, and the deploy selector code is untouched.