bundle: record and read deployment state via DMS with server-generated IDs#6052
Draft
shreyas-goenka wants to merge 1 commit into
Draft
bundle: record and read deployment state via DMS with server-generated IDs#6052shreyas-goenka wants to merge 1 commit into
shreyas-goenka wants to merge 1 commit into
Conversation
…d IDs Wire the direct engine into the Deployment Metadata Service (DMS) so that a `record_deployment_history`-enabled bundle records each deploy/destroy as a version and can read its resource state back from DMS. The deployment ID is now assigned by the server: the first deploy calls CreateDeployment with an empty ID, reads the assigned ID back from the response, and persists it in the direct-engine state header (Header.DeploymentID). Later deploys pass the stored ID back, so a bundle maps one-to-one to a DMS deployment even after the local cache is deleted (the ID rides along in the workspace-synced state file). - libs/dms: Recorder creates the deployment (server-assigned ID) + version, heartbeats the lease, completes it, and deletes the deployment on destroy. - bundle/direct: operationRecorder reports each applied resource operation; the wire resource_key drops the CLI-internal "resources." prefix. - bundle/direct/dstate: Open takes a DMS client and overlays DMS resource state when DMS holds a successful version; deployment ID persisted in the header. - bundle/phases: create the version after plan approval, complete it under the lock, record operations during apply. - libs/testserver: stateful fake DMS (deployments/versions/operations/resources) with server-generated IDs; acceptance test covers deploy, cache-loss redeploy, and destroy. Co-authored-by: Isaac
Collaborator
Integration test reportCommit: 5590258
11 interesting tests: 4 SKIP, 3 FAIL, 3 RECOVERED, 1 KNOWN
Top 2 slowest tests (at least 2 minutes):
|
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.
What
Wires the direct deployment engine into the Deployment Metadata Service (DMS) so that a bundle with
experimental.record_deployment_historyenabled:deploy/destroyas a DMS version (with heartbeat + completion).The key design point: server-generated deployment IDs
The DMS API assigns the deployment ID server-side. Earlier prototypes used the local state lineage (a client-minted UUID) as the deployment ID; that no longer holds. The flow is now:
CreateDeploymentwith an empty ID → the server mints one and returns it indeployment.Name→ we parse it out and persist it in the direct-engine state header (Header.DeploymentID).GetDeploymentto compute the next version number.Because the ID lives in the state file (which is synced to the workspace), it survives deleting the local
.databrickscache — the redeploy recovers the same deployment and just increments the version. No newCreateDeployment.Wiring
libs/dms—Recorder: create deployment (server-assigned ID) + version, heartbeat the lease, complete it, delete the deployment on destroy.bundle/direct/oprecorder.go—operationRecorder: reports each applied operation. The wireresource_keydrops the CLI-internalresources.prefix (resources.jobs.foo→jobs.foo); the read path re-adds it.bundle/direct/dstate—Opentakes a DMS client and overlays DMS resource state when DMS holds a successful version;DeploymentIDpersisted in the state header.bundle/phases— create the version after plan approval, complete it under the lock (deferred beforelock.Release), record operations during apply.libs/testserver— a stateful fake DMS (deployments / versions / operations / resources) with server-generated IDs.Testing
acceptance/bundle/dms/recordcovers the full arc: deploy → server assigns ID → redeploy afterrm -rf .databricks(ID recovered, version increments, no new CreateDeployment) → destroy (delete op + deployment deletion).Gated entirely behind
experimental.record_deployment_history+ the direct engine; terraform and non-opted bundles are untouched.This pull request and its description were written by Isaac.