bundle/direct: record resource operations with DMS#5387
Draft
shreyas-goenka wants to merge 1 commit into
Draft
Conversation
Collaborator
|
Commit: 2f36b2d |
When a bundle is opted into managed state, each successfully applied resource operation is reported to the deployment metadata service (DMS) via the CreateOperation API, instead of being tracked only in the local state file. - opRecorder interface + sdkRecorder: record(action, id, state) maps a deployplan action to its SDK operation type and posts it under the deployment version. The serialized config is carried in Operation.State so DMS can serve it as resource state; it is omitted for deletes. - deployActionToSDK rejects non-mutating actions (Skip/Undefined) rather than coercing them, so an unmapped action surfaces as an error. - DeploymentBundle.OpRec is nil unless managed state is enabled; the apply loop records after each create/update/recreate/resize/update_id/delete. - A failed recording fails the deploy, matching how local state writes (SaveState) are treated: a state-backend write must not be silently lost. The deployment ID and version that identify the DMS version are sourced from the CreateVersion flow, which lands separately; until then they are placeholders (managed state is opt-in and off by default). Co-authored-by: Shreyas Goenka <shreyas.goenka@databricks.com>
2fb2f59 to
2f36b2d
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.
Summary
Stacks on #5365 (managed-state flag). When a bundle is opted into managed state, each successfully applied resource operation is reported to the deployment metadata service (DMS) via
CreateOperation, rather than being tracked only in the local state file.What changed
bundle/direct/oprecorder.go—opRecorderinterface +sdkRecorder:deployplanaction to its SDKOperationActionType. Non-mutating actions (Skip/Undefined) are rejected with an error rather than silently coerced.Operation.Stateso DMS can serve it as resource state; it is omitted for deletes (per the SDK contract).deployments/{deployment_id}/versions/{version}.bundle/direct/pkg.go—DeploymentBundle.OpRec opRecorder, nil unless managed state is enabled.bundle/direct/bundle_apply.go— records after each successfulcreate/update/recreate/resize/update_id/delete. Delete reads the resource ID beforeDestroyremoves it from state. Migration mode (mirroring existing state) records nothing.bundle/phases/deploy.go— constructs the recorder indeployCorewhenbundle.IsManagedState(ctx, b).Design notes
CreateOperationfails the deploy, matching how localSaveStatefailures are treated — a state-backend write must not be silently lost.CreateVersionflow, which lands separately. Until then they are placeholders; managed state is opt-in and off by default, so no existing deploys are affected.Test plan
go test ./bundle/direct/... ./bundle/phases/...greengo vet+./task lint-qclean