Skip to content

bundle/deploy/lock: write deployment_version.json on every CreateVersion#5385

Closed
shreyas-goenka wants to merge 1 commit into
shreyas-goenka/bundle-lock-abstractionfrom
shreyas-goenka/dms-version
Closed

bundle/deploy/lock: write deployment_version.json on every CreateVersion#5385
shreyas-goenka wants to merge 1 commit into
shreyas-goenka/bundle-lock-abstractionfrom
shreyas-goenka/dms-version

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

Summary

Stacks on #5314.

Replaces the placeholder version=0 with a real monotonic counter stored at {state_path}/deployment_version.json alongside the lock file.

What changed:

  • After acquiring the lock, CreateVersion reads deployment_version.json, increments the counter, writes it back under the same lock, and returns the new version number (first deployment = 1).
  • newStateFiler callback on workspaceFilesystemLock defaults to filer.NewWorkspaceFilesClient; overridable in tests.
  • Unit tests use an in-memory filer via export_test.go — no workspace API needed.

File format (state_path/deployment_version.json):

{"version": 3}

Test plan

  • go test ./bundle/deploy/lock/... ./bundle/phases/... green
  • ./task lint-q clean
  • CI

Replaces the placeholder version=0 with a real monotonic counter. After
acquiring the lock, CreateVersion reads deployment_version.json (if it
exists), increments the counter, writes it back under the same lock, and
returns the new version number. The first deployment creates version 1.

The write goes through a newStateFiler callback so tests can inject an
in-memory filer without hitting the workspace API.

Co-authored-by: Shreyas Goenka <shreyas.goenka@databricks.com>
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.

1 participant