diff --git a/bundle/deploy/lock/deployment_metadata_service.go b/bundle/deploy/lock/deployment_metadata_service.go index d306b41efd7..dfd9f53aae3 100644 --- a/bundle/deploy/lock/deployment_metadata_service.go +++ b/bundle/deploy/lock/deployment_metadata_service.go @@ -379,6 +379,10 @@ func workspaceInfo(b *bundle.Bundle) *tmpdms.WorkspaceInfo { // folder; it stays empty for local deploys. if b.WorktreeRoot != nil && strings.HasPrefix(b.WorktreeRoot.Native(), "/Workspace/") { info.GitFolderPath = b.WorktreeRoot.Native() + // BundleRootPath defaults to "." (filepath.Rel returns "." when the + // bundle root equals the worktree root), so it is only meaningful for + // workspace Git-folder deploys and is recorded alongside git_folder_path. + info.BundleRootPath = b.Config.Bundle.Git.BundleRootPath } return info } diff --git a/bundle/deploy/lock/deployment_metadata_service_test.go b/bundle/deploy/lock/deployment_metadata_service_test.go index b6eac083963..b81b5a15ddb 100644 --- a/bundle/deploy/lock/deployment_metadata_service_test.go +++ b/bundle/deploy/lock/deployment_metadata_service_test.go @@ -90,6 +90,7 @@ func TestWorkspaceInfo(t *testing.T) { assert.Equal(t, "/Workspace/Users/me@databricks.com/.bundle/my-bundle/prod/files", info.FilePath) assert.False(t, info.SourceLinked) assert.Empty(t, info.GitFolderPath) + assert.Empty(t, info.BundleRootPath) } func TestWorkspaceInfoSourceLinked(t *testing.T) { @@ -122,10 +123,11 @@ func TestWorkspaceInfoGitFolderPath(t *testing.T) { } gitFolderPath := "/Workspace/Users/me@databricks.com/git_folder" b := &bundle.Bundle{ - Config: config.Root{}, WorktreeRoot: vfs.MustNew(gitFolderPath), } + b.Config.Bundle.Git.BundleRootPath = "subdir/bundle" info := workspaceInfo(b) assert.Equal(t, gitFolderPath, info.GitFolderPath) + assert.Equal(t, "subdir/bundle", info.BundleRootPath) } diff --git a/libs/tmpdms/types.go b/libs/tmpdms/types.go index ebf1bc27e3a..2011cd8a8a9 100644 --- a/libs/tmpdms/types.go +++ b/libs/tmpdms/types.go @@ -145,10 +145,11 @@ type GitInfo struct { // version. It mirrors the WorkspaceInfo proto message in the deployment // metadata service and carries the same values the CLI writes to metadata.json. type WorkspaceInfo struct { - RootPath string `json:"root_path,omitempty"` - FilePath string `json:"file_path,omitempty"` - SourceLinked bool `json:"source_linked,omitempty"` - GitFolderPath string `json:"git_folder_path,omitempty"` + RootPath string `json:"root_path,omitempty"` + FilePath string `json:"file_path,omitempty"` + SourceLinked bool `json:"source_linked,omitempty"` + GitFolderPath string `json:"git_folder_path,omitempty"` + BundleRootPath string `json:"bundle_root_path,omitempty"` } type Operation struct {