-
Notifications
You must be signed in to change notification settings - Fork 126
direct: Add support for secret scopes #3886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Commit: 7e1c917
17 interesting tests: 11 flaky, 4 RECOVERED, 2 SKIP
Top 22 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newly added tests give more than enough coverage for this. (see basic test)
| Local = true | ||
| Cloud = false | ||
| RecordRequests = true | ||
| Local = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only run it on cloud because there's ordering issues in the permissions returned by GET that are not worth dealing with (because of the different user names, there is no stable sort).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ordering issues can be addressed by recording requests in env-specific file:
> out.requests.$DATABRICKS_BUNDLE_ENGINE.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need to split them into local vs. cloud. The ordering issue here is the permissions being in a different order even after sorting.
It's doable but I'd rather skip it since the cloud coverage is the more important bit to ensure.
| } | ||
|
|
||
| // Sort ACLs by principal for deterministic ordering | ||
| slices.SortFunc(acls, func(a, b workspace.AclItem) int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // setACLs reconciles the desired ACLs with the current state | ||
| func (r *ResourceSecretScopeAcls) setACLs(ctx context.Context, scopeName string, desiredAcls []workspace.AclItem) (string, error) { | ||
| // Get current ACLs | ||
| currentAcls, err := r.client.Secrets.ListAclsAll(ctx, workspace.ListAclsRequest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not need to read ACLs from the backend, we've already done it. This is encoded in PlanEntry which we now pass to DoUpdate()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see planentry in DoUpdate. Please clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundle/direct/dresources/adapter.go: DoUpdate(ctx context.Context, id string, newState any, changes *deployplan.Changes) (remoteState any, e error)
we pass entry.Changes here, but we can also pass entry:
bundle/direct/bundle_apply.go: err = d.Deploy(ctx, &b.StateDB, entry.NewState.Value, at, entry.Changes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. This can be a followup. Let's not block this PR on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, could be a follow up. a comment TODO would be nice to have here.
| // setACLs reconciles the desired ACLs with the current state | ||
| func (r *ResourceSecretScopeAcls) setACLs(ctx context.Context, scopeName string, desiredAcls []workspace.AclItem) (string, error) { | ||
| // Get current ACLs | ||
| currentAcls, err := r.client.Secrets.ListAclsAll(ctx, workspace.ListAclsRequest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, could be a follow up. a comment TODO would be nice to have here.
|
Commit: a4ab082
16 interesting tests: 8 flaky, 7 RECOVERED, 1 SKIP
Top 50 slowest tests (at least 2 minutes):
|
Changes
Adds direct deployment support for secret scopes.
Mock Server Fix
Fixed
libs/testserver/secret_scopes.goto automatically grant MANAGE permission to the creator when a scope is created, matching real Databricks behavior.Tests
New local and cloud acceptance tests.