Skip to content

Commit 700683b

Browse files
Fix pipeline globs (#2723)
## Changes Fix regression where combination of pipeline globs and relative paths didn't work. The regression has happened because we translated paths to paths relative to bundle root after we have expanded globs that have assumed that paths are already normalized against bundle root. Existing tests didn't cover scenario where pipeline is defined outside of bundle root path. Fixes #2721 ## Tests Add acceptance tests. <!-- 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. --> --------- Co-authored-by: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com>
1 parent 9bc236f commit 700683b

25 files changed

Lines changed: 204 additions & 76 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Release v0.248.0
44

55
### Notable Changes
6+
* Fixed a regression with pipeline library globs introduced in 0.247.0 ([#2723](https://github.com/databricks/cli/pull/2723)). The issue caused glob patterns to fail when using paths relative to a directory that is not the bundle root.
67

78
### Dependency updates
89
* Updated Go SDK to 0.63.0 ([#2716](https://github.com/databricks/cli/pull/2716))

acceptance/bundle/debug/out.stderr.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
10:07:59 Debug: Apply pid=12345 mutator=ResolveVariableReferences
4141
10:07:59 Debug: Apply pid=12345 mutator=ApplyTargetMode
4242
10:07:59 Debug: Apply pid=12345 mutator=ProcessStaticResources
43-
10:07:59 Debug: Apply pid=12345 mutator=NormalizePaths
43+
10:07:59 Debug: Apply pid=12345 mutator=ProcessStaticResources mutator=ResolveVariableReferences(resources)
44+
10:07:59 Debug: Apply pid=12345 mutator=ProcessStaticResources mutator=NormalizePaths
4445
10:07:59 Debug: Apply pid=12345 mutator=PythonMutator(load)
4546
10:07:59 Debug: Apply pid=12345 mutator=PythonMutator(init)
4647
10:07:59 Debug: Apply pid=12345 mutator=PythonMutator(load_resources)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
bundle:
2+
name: invalid_pipeline_glob_paths
3+
4+
resources:
5+
pipelines:
6+
nyc_taxi_pipeline:
7+
libraries:
8+
- notebook: { path: "${var.notebook_dir}/*.ipynb" }
9+
10+
variables:
11+
notebook_dir:
12+
description: Directory with DLT notebooks
13+
default: non-existent
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
>>> [CLI] bundle validate --output json
3+
Error: notebook non-existent/*.ipynb not found
4+
5+
6+
Exit code: 1
7+
{
8+
"resources": {
9+
"pipelines": {
10+
"nyc_taxi_pipeline": {
11+
"libraries": [
12+
{
13+
"notebook": {
14+
"path": "non-existent/*.ipynb"
15+
}
16+
}
17+
],
18+
"permissions": []
19+
}
20+
}
21+
}
22+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
errcode trace $CLI bundle validate --output json | jq 'pick(.resources)'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bundle:
2+
name: pipeline_expected_file_got_notebook
3+
4+
include:
5+
- resources/pipeline.yml
6+
7+
variables:
8+
notebook_dir:
9+
description: Directory with DLT notebooks
10+
default: notebooks

bundle/tests/pipeline_glob_paths/dlt/nyc_taxi_loader.py renamed to acceptance/bundle/paths/pipeline_expected_file_got_notebook/notebooks/nyc_taxi_loader.py

File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
>>> [CLI] bundle validate --output json
3+
Error: expected a file for "resources.pipelines.nyc_taxi_pipeline.libraries[0].file.path" but got a notebook: file at [TEST_TMP_DIR]/notebooks/nyc_taxi_loader.py is a notebook
4+
5+
6+
Exit code: 1
7+
{
8+
"resources": {
9+
"pipelines": {
10+
"nyc_taxi_pipeline": {
11+
"libraries": [
12+
{
13+
"file": {
14+
"path": "notebooks/nyc_taxi_loader.py"
15+
}
16+
}
17+
],
18+
"permissions": []
19+
}
20+
}
21+
}
22+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resources:
2+
pipelines:
3+
nyc_taxi_pipeline:
4+
libraries:
5+
# path points to a notebook, not a file, it should error out
6+
- file: { path: "../${var.notebook_dir}/*.py" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
errcode trace $CLI bundle validate --output json | jq 'pick(.resources)'

0 commit comments

Comments
 (0)