Skip to content

Integrate deployment metadata service for locking and state#4856

Draft
shreyas-goenka wants to merge 1 commit intomainfrom
shreyas-goenka/deployment-metadata-service
Draft

Integrate deployment metadata service for locking and state#4856
shreyas-goenka wants to merge 1 commit intomainfrom
shreyas-goenka/deployment-metadata-service

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

Summary

  • Add client integration with the deployment metadata service API (/api/2.0/bundle/) for server-side deployment locking and resource state tracking
  • Replace file-based workspace locks with CreateVersion (lock acquire) / CompleteVersion (lock release) when the feature is enabled
  • Report resource operations to the metadata service after each deploy (using INITIAL_REGISTER for first-time tracking)
  • Background heartbeat goroutine keeps the lock alive during long-running deployments

Gated behind DATABRICKS_BUNDLE_DEPLOYMENT_SERVICE=true environment variable. Zero behavior change when the flag is off.

New files

  • bundle/env/deployment_metadata.go — env var definition
  • bundle/deploy/metadata/service/types.go — Go structs matching the proto API
  • bundle/deploy/metadata/service/client.go — HTTP client for all deployment metadata endpoints
  • bundle/deploy/metadata/service/heartbeat.go — background lock renewal
  • bundle/phases/deploy_metadata.go — new deploy flow with metadata service
  • bundle/phases/destroy_metadata.go — new destroy flow with metadata service

Modified files

  • bundle/deploy/state_update.go — export LoadState() function
  • bundle/phases/deploy.go — feature flag check
  • bundle/phases/destroy.go — feature flag check

Test plan

  • Unit tests for metadata service client
  • Acceptance tests with [[Server]] stubs for deploy/destroy flows
  • E2E test against dev workspace with service deployed
  • Verify zero behavior change with flag OFF (existing acceptance tests pass)

This pull request was AI-assisted by Isaac.

@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented Mar 26, 2026

Commit: 342fef8

Run: 23764962616

Env ✅​pass 🙈​skip Time
✅​ aws linux 73 14 0:46
✅​ aws windows 73 14 0:32
✅​ aws-ucws linux 76 11 0:41
✅​ aws-ucws windows 76 11 0:30
✅​ azure linux 72 14 0:49
✅​ azure windows 72 14 0:39
✅​ azure-ucws linux 75 11 0:43
✅​ azure-ucws windows 75 11 0:36
✅​ gcp linux 73 14 0:42
✅​ gcp windows 73 14 0:31


// Report skip actions to the metadata service. On initial registration,
// these are recorded as INITIAL_REGISTER operations.
if action == deployplan.Skip && b.OperationReporter != nil {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the initial registration up

@@ -0,0 +1,6 @@
Local = true
Cloud = false
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The service needs to roll out to prod before we enable this on cloud.

Add server-side deployment locking and state management via the
Deployment Metadata Service (DMS), gated behind DATABRICKS_BUNDLE_MANAGED_STATE=true.

Key changes:
- DeploymentLock interface with factory (DMS or filesystem based on env)
- DMS lock: version-based locking with heartbeat, operation reporting
- State read/write via ListResources/CreateOperation with per-resource state
- withDeploymentLock helper extracts lock boilerplate from deploy/destroy
- Temporary DMS client (libs/tmpdms) mirroring future SDK-generated code
- Mock DMS server for acceptance tests
- 6 acceptance tests covering deploy, destroy, plan, summary, sequential
  deploys, and adding resources with remote state

Co-authored-by: Isaac
@shreyas-goenka shreyas-goenka force-pushed the shreyas-goenka/deployment-metadata-service branch from 38076ea to 32ae5ff Compare April 14, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants