Skip to content

Commit 5900401

Browse files
authored
Fix PIP flag processing in pipeline environment dependencies (#3734)
## Changes Fix PIP flag processing in pipeline environment dependencies ## Why Follow up for #3708 ## Tests Added an acceptance test <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 3a9ab07 commit 5900401

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
### Bundles
1212
* Fix processing short pip flags in environment dependencies ([#3708](https://github.com/databricks/cli/pull/3708))
1313
* Add support for referencing local files in -e pip flag for environment dependencies ([#3708](https://github.com/databricks/cli/pull/3708))
14+
* Fix PIP flag processing in pipeline environment dependencies ([#3734](https://github.com/databricks/cli/pull/3734))
1415

1516
### API Changes

acceptance/bundle/environments/dependencies/databricks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ resources:
3838
name: "Test Pipeline"
3939
environment:
4040
dependencies:
41+
- "-r ./requirements.txt"
42+
- "-e ./file.py"
43+
- "-i http://myindexurl.com"
44+
- "--index-url http://myindexurl.com"
4145
- "dist/*.whl"
4246
- "/Workspace/Users/[email protected]/test-package.whl"
4347
- "test_package"

acceptance/bundle/environments/dependencies/output.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Deployment complete!
6161
"edition": "ADVANCED",
6262
"environment": {
6363
"dependencies": [
64+
"-r /Workspace/Users/[USERNAME]/.bundle/dependencies/default/files/requirements.txt",
65+
"-e /Workspace/Users/[USERNAME]/.bundle/dependencies/default/files/file.py",
66+
"-i http://myindexurl.com",
67+
"--index-url http://myindexurl.com",
6468
"/Workspace/Users/[USERNAME]/.bundle/dependencies/default/artifacts/.internal/test.whl",
6569
"/Workspace/Users/[email protected]/test-package.whl",
6670
"test_package",
@@ -110,6 +114,10 @@ Deployment complete!
110114
>>> [CLI] bundle validate -o json
111115
{
112116
"dependencies": [
117+
"-r /Workspace/Users/[USERNAME]/.bundle/dependencies/default/files/requirements.txt",
118+
"-e /Workspace/Users/[USERNAME]/.bundle/dependencies/default/files/file.py",
119+
"-i http://myindexurl.com",
120+
"--index-url http://myindexurl.com",
113121
"./dist/*.whl",
114122
"/Workspace/Users/[email protected]/test-package.whl",
115123
"test_package",

bundle/config/mutator/paths/pipeline_paths_visitor.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ func pipelineRewritePatterns() []pipelineRewritePattern {
3939
},
4040
}
4141

42+
pipelineEnvironmentsPatternsWithPipFlags := []pipelineRewritePattern{
43+
{
44+
dyn.NewPattern(
45+
dyn.Key("resources"),
46+
dyn.Key("pipelines"),
47+
dyn.AnyKey(),
48+
dyn.Key("environment"),
49+
dyn.Key("dependencies"),
50+
dyn.AnyIndex(),
51+
),
52+
TranslateModeEnvironmentPipFlag,
53+
func(s string) bool {
54+
_, _, ok := libraries.IsLocalPathInPipFlag(s)
55+
return !ok
56+
},
57+
},
58+
}
59+
4260
// Compile list of configuration paths to rewrite.
4361
allPatterns := []pipelineRewritePattern{
4462
{
@@ -64,6 +82,7 @@ func pipelineRewritePatterns() []pipelineRewritePattern {
6482
}
6583

6684
allPatterns = append(allPatterns, pipelineEnvironmentsPatterns...)
85+
allPatterns = append(allPatterns, pipelineEnvironmentsPatternsWithPipFlags...)
6786
return allPatterns
6887
}
6988

0 commit comments

Comments
 (0)