Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nextchanges/bundles/7036.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix bundle plan reporting an Update on every deploy for schemas and catalogs with properties the config never declared. ([#7036](https://github.com/databricks/cli/pull/7036))
32 changes: 32 additions & 0 deletions bundle/direct/bundle_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,38 @@ func TestShouldSkipBackendDefault_ManagedPropertiesOnly(t *testing.T) {
}
}

func TestSchemaCatalogRemoteOnlyPropertiesSkipped(t *testing.T) {
for _, resource := range []string{"schemas", "catalogs"} {
t.Run(resource, func(t *testing.T) {
cfg := dresources.GetResourceConfig(resource)
path, err := structpath.ParsePath("properties")
require.NoError(t, err)
_, ok := shouldSkipBackendDefault(cfg, path, &deployplan.ChangeDesc{
Old: nil,
New: nil,
Remote: map[string]string{"owner": "root"},
})
assert.True(t, ok)

_, ok = shouldSkipBackendDefault(cfg, path, &deployplan.ChangeDesc{
Old: map[string]string{"owner": "root"},
New: map[string]string{"owner": "root"},
Remote: map[string]string{"owner": "other"},
})
assert.False(t, ok)

child, err := structpath.ParsePath("properties['owner']")
require.NoError(t, err)
_, ok = shouldSkipBackendDefault(cfg, child, &deployplan.ChangeDesc{
Old: "root",
New: "root",
Remote: "other",
})
assert.False(t, ok)
})
}
}

// A field present in StateType but absent from RemoteType (input-only, e.g. external
// locations' skip_validation) reads back nil, so a coincidental new == remote must NOT
// trip RemoteAlreadySet — that would skip a real local change. A field present in RemoteType
Expand Down
7 changes: 5 additions & 2 deletions bundle/direct/dresources/configs/catalogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ updatable_id_fields:
- field: name
reason: id_changes
backend_defaults:
# UC auto-populates unity.catalog.managed.<format>.defaults.* keys after create.
- field: properties['unity.catalog.managed.*.defaults.*']
# Skip properties present only on the remote when the config declares none,
# including unity.catalog.managed.*.defaults.* keys UC sets after create.
# The SDK cannot send an empty map to clear them. Declared properties
# still take part in drift detection.
- field: properties
Comment thread
yuri-rod marked this conversation as resolved.
9 changes: 5 additions & 4 deletions bundle/direct/dresources/configs/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ normalize_slash:
- field: storage_root
reason: uc_strips_trailing_slash
backend_defaults:
# UC auto-populates unity.catalog.managed.<format>.defaults.* keys after create.
# Without this, every subsequent plan produces an Update whose payload is empty,
# and UC rejects it with "UpdateSchema Nothing to update".
- field: properties['unity.catalog.managed.*.defaults.*']
# Skip properties present only on the remote when the config declares none,
# including unity.catalog.managed.*.defaults.* keys UC sets after create.
# The SDK cannot send an empty map to clear them. Declared properties
# still take part in drift detection.
- field: properties
Comment thread
yuri-rod marked this conversation as resolved.