Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/config/mutator/translate_paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ func TestTranslatePathJobEnvironments(t *testing.T) {
"../dist/env2.whl",
"simplejson",
"/Workspace/Users/foo@bar.com/test.whl",
"--extra-index-url https://name:token@gitlab.com/api/v4/projects/9876/packages/pypi/simple bridgecraft",
Comment thread
andrewnester marked this conversation as resolved.
Outdated
"https://foo@bar.com/packages/pypi/simple",
},
},
},
Expand All @@ -719,6 +721,8 @@ func TestTranslatePathJobEnvironments(t *testing.T) {
assert.Equal(t, strings.Join([]string{".", "dist", "env2.whl"}, string(os.PathSeparator)), b.Config.Resources.Jobs["job"].JobSettings.Environments[0].Spec.Dependencies[1])
assert.Equal(t, "simplejson", b.Config.Resources.Jobs["job"].JobSettings.Environments[0].Spec.Dependencies[2])
assert.Equal(t, "/Workspace/Users/foo@bar.com/test.whl", b.Config.Resources.Jobs["job"].JobSettings.Environments[0].Spec.Dependencies[3])
assert.Equal(t, "--extra-index-url https://name:token@gitlab.com/api/v4/projects/9876/packages/pypi/simple bridgecraft", b.Config.Resources.Jobs["job"].JobSettings.Environments[0].Spec.Dependencies[4])
Comment thread
andrewnester marked this conversation as resolved.
Outdated
assert.Equal(t, "https://foo@bar.com/packages/pypi/simple", b.Config.Resources.Jobs["job"].JobSettings.Environments[0].Spec.Dependencies[5])
}

func TestTranslatePathWithComplexVariables(t *testing.T) {
Expand Down
6 changes: 6 additions & 0 deletions bundle/libraries/local_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func IsLibraryLocal(dep string) bool {
}
}

// If the dependency starts with --, it's a pip flag option which is a valid
// entry for environment dependencies but not a local path
if strings.HasPrefix(dep, "--") {
return false
}

// If the dependency is a requirements file, it's not a valid local path
if strings.HasPrefix(dep, "-r") {
return false
Expand Down