Skip to content
Merged
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
8 changes: 7 additions & 1 deletion bundle/config/mutator/expand_pipeline_glob_paths_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,6 +80,11 @@ func TestExpandGlobPathsInPipelines(t *testing.T) {
Path: "dbfs:/me@company.com/test.ipynb",
},
},
{
Notebook: &pipelines.NotebookLibrary{
Path: "/Repos/somerepo/test.ipynb",
},
},
},
},
},
Expand All@@ -93,7 +98,7 @@ func TestExpandGlobPathsInPipelines(t *testing.T) {
require.NoError(t, err)

libraries := b.Config.Resources.Pipelines["pipeline"].Libraries
require.Len(t, libraries, 9)
require.Len(t, libraries, 10)

// Making sure glob patterns are expanded correctly
require.True(t, containsNotebook(libraries, filepath.Join("test", "test2.ipynb")))
Expand All@@ -107,6 +112,7 @@ func TestExpandGlobPathsInPipelines(t *testing.T) {
// Making sure absolute pass to remote FS file references work as well
require.True(t, containsNotebook(libraries, "/Workspace/Users/me@company.com/test.ipynb"))
require.True(t, containsNotebook(libraries, "dbfs:/me@company.com/test.ipynb"))
require.True(t, containsNotebook(libraries, "/Repos/somerepo/test.ipynb"))

// Making sure other libraries are not replaced
require.True(t, containsJar(libraries, "./*.jar"))
Expand Down
8 changes: 7 additions & 1 deletion bundle/libraries/libraries.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/url"
"path"
"path/filepath"
"strings"

Expand DownExpand Up@@ -173,7 +174,7 @@ func IsLocalPath(path string) bool {
return false
}

return !isWorkspacePath(path)
return !isAbsoluteRemotePath(path)
}

func isExplicitFileScheme(path string) bool {
Expand All@@ -200,3 +201,8 @@ func isWorkspacePath(path string) bool {
strings.HasPrefix(path, "/Users/") ||
strings.HasPrefix(path, "/Shared/")
}

func isAbsoluteRemotePath(p string) bool {
// If path for library starts with /, it's a remote absolute path
return path.IsAbs(p)
}
2 changes: 1 addition & 1 deletion bundle/libraries/libraries_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ import (

var testCases map[string]bool = map[string]bool{
"./some/local/path": true,
"/some/full/path": true,
"/some/full/path": false,
"/Workspace/path/to/package": false,
"/Users/path/to/package": false,
"file://path/to/package": true,
Expand Down