Skip to content

Commit 49ac5b2

Browse files
authored
Fix bundle generate producing wrong output for pipelines with no root_path (#5451)
## Changes Fix bundle generate producing wrong output for pipelines with no root_path ## Why The pipeline libraries' paths were incorrectly split by each character because root_path was empty leading to the wrong paths generated ## 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 9138455 commit 49ac5b2

7 files changed

Lines changed: 32 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bundle:
2+
name: generate-pipeline
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resources:
2+
pipelines:
3+
out:
4+
name: generate-pipeline
5+
libraries:
6+
- glob:
7+
include: /Workspace/Users/[USERNAME]/src/*.py

acceptance/bundle/generate/pipeline_with_glob/out.test.toml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pipeline configuration successfully saved to out.pipeline.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$CLI bundle generate pipeline --existing-pipeline-id 1234 --config-dir . --key out --force --source-dir .
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[[Server]]
2+
Pattern = "GET /api/2.0/pipelines/1234"
3+
Response.Body = '''
4+
{
5+
"pipeline_id": 1234,
6+
"spec": {
7+
"name": "generate-pipeline",
8+
"libraries": [
9+
{
10+
"glob": {
11+
"include": "/Workspace/Users/tester@databricks.com/src/*.py"
12+
}
13+
}
14+
]
15+
}
16+
}
17+
'''

bundle/generate/pipeline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func ConvertPipelineToValue(pipeline *pipelines.PipelineSpec, rootPath, remoteRo
1515
pipeline.RootPath = rootPath
1616
}
1717

18-
if pipeline.Libraries != nil {
18+
if pipeline.Libraries != nil && remoteRootPath != "" {
1919
for i := range pipeline.Libraries {
2020
lib := &pipeline.Libraries[i]
2121
if lib.Glob != nil {

0 commit comments

Comments
 (0)