Skip to content

bundle: extract DeploymentLock interface + workspace filesystem impl#5314

Draft
shreyas-goenka wants to merge 1 commit into
mainfrom
shreyas-goenka/bundle-lock-abstraction
Draft

bundle: extract DeploymentLock interface + workspace filesystem impl#5314
shreyas-goenka wants to merge 1 commit into
mainfrom
shreyas-goenka/bundle-lock-abstraction

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

Summary

Pure code-movement refactor. Wraps the existing workspace-filesystem lock behind a DeploymentLock interface so a follow-up PR can ship a metadata-service-backed implementation without touching deploy / destroy / bind callers again. The interface and filesystem behavior split mirrors what landed in the kitchen-sink PR #4856 (shreyas-goenka/deployment-metadata-service) but ships only the refactor here. No env var, no DMS code, no tmpdms or statemgmt.IsDmsActive references.

What changed

  • New bundle/deploy/lock/lock.goDeploymentLock interface, Goal enum (moved from release.go), DeploymentStatus enum, and a NewDeploymentLock factory that unconditionally returns the workspace filesystem implementation.
  • New bundle/deploy/lock/workspace_filesystem.goworkspaceFilesystemLock implements DeploymentLock. Preserves the historical behavior of the deleted mutators: lock-disabled short-circuit, locker.CreateLocker initialization, the permissions.ReportPossiblePermissionDenied branch on fs.ErrPermission / fs.ErrNotExist, and the destroy-mode locker.AllowLockFileNotExist unlock quirk.
  • Deleted bundle/deploy/lock/acquire.go and bundle/deploy/lock/release.go.
  • Updated bundle/phases/{deploy,destroy,bind}.go to construct the lock once via NewDeploymentLock and call Acquire / Release directly instead of via bundle.ApplyContext. The deferred Release now passes DeploymentSuccess / DeploymentFailure based on logdiag.HasError(ctx) so a future DMS-backed implementation can record the outcome.

Diff shape

-bundle/deploy/lock/acquire.go
-bundle/deploy/lock/release.go
+bundle/deploy/lock/lock.go
+bundle/deploy/lock/workspace_filesystem.go
~bundle/phases/{deploy,destroy,bind}.go

No new package dependencies.

Test plan

  • go build ./... clean
  • go vet ./bundle/deploy/lock/... ./bundle/phases/... clean
  • go test ./bundle/... ./cmd/... green
  • Lock-related acceptance goldens pass without -update: pipelines/{deploy,destroy}/force-lock, bundle/help/bundle-{deploy,deployment,deployment-migrate,destroy}
  • ./task lint clean (0 issues x3)
  • CI on databricks/cli

Pre-existing acceptance failures on origin/main (bundle/deployment/bind/job/..., bundle/templates/pydabs/check-consistency, bundle/resources/jobs/update*, etc.) reproduce identically on this branch and are unrelated to this refactor.

Pure code-movement refactor. Wraps the existing workspace-filesystem lock
behavior behind a DeploymentLock interface so a follow-up PR can introduce
an alternative metadata-service-backed lock implementation without
touching deploy/destroy/bind callers again.

What changed:
- New bundle/deploy/lock/lock.go: DeploymentLock interface, Goal enum
  (moved from release.go), DeploymentStatus enum, and a
  NewDeploymentLock factory that unconditionally returns the workspace
  filesystem implementation.
- New bundle/deploy/lock/workspace_filesystem.go: workspaceFilesystemLock
  struct that implements DeploymentLock. Preserves the historical
  behavior of the deleted acquire.go / release.go mutators: lock-disabled
  short-circuit, locker.CreateLocker initialization, the
  permissions.ReportPossiblePermissionDenied branch on fs.ErrPermission
  / fs.ErrNotExist, and the destroy-mode locker.AllowLockFileNotExist
  unlock quirk.
- Deleted bundle/deploy/lock/acquire.go and bundle/deploy/lock/release.go.
- Updated bundle/phases/{deploy,destroy,bind}.go to construct the lock
  once via NewDeploymentLock and call Acquire / Release directly instead
  of through bundle.ApplyContext. The deferred Release now reports
  DeploymentSuccess / DeploymentFailure based on logdiag.HasError so a
  future DMS-backed implementation can record the outcome.

Behavior is preserved end-to-end: lock-related acceptance goldens
(pipelines/{deploy,destroy}/force-lock, bundle/help/bundle-{deploy,
destroy}) all pass unchanged.
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: 09f9090

Run: 26285934089

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