Skip to content

Commit 6d2367f

Browse files
authored
Added new Lakeflow Pipelines support for bundle generate (#3568)
## Changes Added new Lakeflow Pipelines support for `bundle generate` ## Why Now if the pipeline refers to `root_path` we download the whole content of it and rewrite any related `libraries.glob` paths pointing to the same remote paths to the local ones ## Tests Added an acceptance test Confirmed that they can be deployed here: #3578 <!-- 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 afc308e commit 6d2367f

File tree

12 files changed

+117
-3
lines changed

12 files changed

+117
-3
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
### Dependency updates
1010

1111
### Bundles
12+
* Add new Lakeflow Pipelines support for bundle generate ([#3568](https://github.com/databricks/cli/pull/3568))
1213

1314
### API Changes

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

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resources:
2+
pipelines:
3+
out:
4+
name: lakeflow-pipeline
5+
libraries:
6+
- glob:
7+
include: ../pipeline/transformations/**
8+
- glob:
9+
include: /Workspace/Users/[email protected]/another/**
10+
root_path: ../pipeline
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello, World!")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello, World!")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello, World!")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Pipeline configuration successfully saved to out/config/out.pipeline.yml
2+
File successfully saved to out/pipeline/explorations/1.py
3+
File successfully saved to out/pipeline/transformations/1.py
4+
File successfully saved to out/pipeline/transformations/2.py
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "lakeflow-pipeline",
3+
"libraries": [
4+
{
5+
"glob": {
6+
"include": "/Workspace/Users/[email protected]/lakeflow_pipeline/transformations/**"
7+
}
8+
},
9+
{
10+
"glob": {
11+
"include": "/Workspace/Users/[email protected]/another/**"
12+
}
13+
}
14+
],
15+
"root_path": "/Workspace/Users/[email protected]/lakeflow_pipeline"
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export PIPELINE_ID=$($CLI pipelines create --json @pipeline.json | jq -r .pipeline_id)
2+
3+
$CLI bundle generate pipeline --existing-pipeline-id ${PIPELINE_ID} --config-dir out/config --key out --source-dir out/pipeline > out.stdout 2> out.stderr
4+
5+
# Combine stdout and stderr, then sort only the "File successfully saved" lines
6+
cat out.stdout out.stderr > out.txt
7+
grep -v "^File successfully saved" out.txt
8+
grep "^File successfully saved" out.txt | sort
9+
rm out.txt out.stdout out.stderr
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[[Server]]
2+
Pattern = "GET /api/2.0/workspace/export"
3+
Response.Body = '''
4+
print("Hello, World!")
5+
'''
6+
7+
[[Repls]]
8+
Old = '\\'
9+
New = '/'
10+
11+
[[Server]]
12+
Pattern = "GET /api/2.0/workspace/list"
13+
Response.Body = '''
14+
{
15+
"objects": [
16+
{
17+
"path": "/Workspace/Users/[email protected]/lakeflow_pipeline/transformations/1.py",
18+
"object_type": "FILE"
19+
},
20+
{
21+
"path": "/Workspace/Users/[email protected]/lakeflow_pipeline/transformations/2.py",
22+
"object_type": "FILE"
23+
},
24+
{
25+
"path": "/Workspace/Users/[email protected]/lakeflow_pipeline/explorations/1.py",
26+
"object_type": "FILE"
27+
}
28+
]
29+
}
30+
'''
31+
32+
[[Server]]
33+
Pattern = "GET /api/2.0/workspace/get-status"
34+
Response.Body = '''
35+
{
36+
}
37+
'''

0 commit comments

Comments
 (0)