2024-10-29 12:06:38 +00:00
|
|
|
package paths
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/bundle/config"
|
|
|
|
"github.com/databricks/cli/bundle/libraries"
|
|
|
|
)
|
|
|
|
|
|
|
|
func CollectUniqueWorkspacePathPrefixes(workspace config.Workspace) []string {
|
|
|
|
rootPath := workspace.RootPath
|
|
|
|
paths := []string{}
|
2024-10-30 17:34:11 +00:00
|
|
|
if !libraries.IsVolumesPath(rootPath) {
|
2024-10-29 12:06:38 +00:00
|
|
|
paths = append(paths, rootPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !strings.HasSuffix(rootPath, "/") {
|
|
|
|
rootPath += "/"
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, p := range []string{
|
|
|
|
workspace.ArtifactPath,
|
|
|
|
workspace.FilePath,
|
|
|
|
workspace.StatePath,
|
|
|
|
workspace.ResourcePath,
|
|
|
|
} {
|
2024-10-30 17:34:11 +00:00
|
|
|
if libraries.IsVolumesPath(p) {
|
2024-10-29 12:06:38 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if strings.HasPrefix(p, rootPath) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
paths = append(paths, p)
|
|
|
|
}
|
|
|
|
|
|
|
|
return paths
|
|
|
|
}
|