Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bundle/deploy/lock/deployment_metadata_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 3 additions & 1 deletion bundle/deploy/lock/deployment_metadata_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}
9 changes: 5 additions & 4 deletions libs/tmpdms/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading