File tree Expand file tree Collapse file tree
acceptance/bundle/generate/pipeline_and_deploy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ bundle :
2+ name : pipeline_and_deploy
Original file line number Diff line number Diff line change 1+ # Databricks notebook source
2+ print ('Hello world!' )
Original file line number Diff line number Diff line change 1+
2+ === Upload files to workspace
3+ >>> [CLI] workspace import /Workspace/Users/[USERNAME]/notebook.py --file notebook.py --format AUTO --overwrite
4+
5+ >>> [CLI] workspace import /Workspace/Users/[USERNAME]/test.py --file test.py --format AUTO --overwrite
6+
7+ === Create a pipeline that references the filesCreated pipeline
8+
9+ === Generate bundle config from the pipelineFile successfully saved to src/notebook.py
10+ File successfully saved to src/test.py
11+ Pipeline configuration successfully saved to resources/out.pipeline.yml
12+
13+ === Verify generated yaml has expected fields
14+ === Deploy the generated bundle
15+ >>> [CLI] bundle deploy
16+ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/pipeline_and_deploy/default/files...
17+ Deploying resources...
18+ Deployment complete!
19+
20+ === Destroy the deployed bundle
21+ >>> [CLI] bundle destroy --auto-approve
22+ All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/pipeline_and_deploy/default
23+
24+ Deleting files...
25+ Destroy complete!
26+
27+ === Cleanup: delete the original pipeline and files
28+ >>> errcode [CLI] pipelines delete [PIPELINE_ID]
29+
30+ >>> errcode [CLI] workspace delete /Workspace/Users/[USERNAME]/notebook
31+
32+ >>> errcode [CLI] workspace delete /Workspace/Users/[USERNAME]/test.py
Original file line number Diff line number Diff line change 1+ title "Upload files to workspace"
2+ trace $CLI workspace import "/Workspace/Users/${CURRENT_USER_NAME}/notebook.py" --file notebook.py --format AUTO --overwrite
3+ trace $CLI workspace import "/Workspace/Users/${CURRENT_USER_NAME}/test.py" --file test.py --format AUTO --overwrite
4+
5+ title "Create a pipeline that references the files"
6+ PIPELINE_ID=$($CLI pipelines create --json '{
7+ "name": "test-pipeline",
8+ "libraries": [
9+ {
10+ "notebook": {
11+ "path": "/Workspace/Users/'${CURRENT_USER_NAME}'/notebook"
12+ }
13+ },
14+ {
15+ "file": {
16+ "path": "/Workspace/Users/'${CURRENT_USER_NAME}'/test.py"
17+ }
18+ }
19+ ]
20+ }' | jq -r '.pipeline_id')
21+ echo "Created pipeline"
22+ add_repl.py "$PIPELINE_ID" PIPELINE_ID
23+
24+ cleanup() {
25+ title "Cleanup: delete the original pipeline and files"
26+ trace errcode $CLI pipelines delete "$PIPELINE_ID"
27+ trace errcode $CLI workspace delete "/Workspace/Users/${CURRENT_USER_NAME}/notebook"
28+ trace errcode $CLI workspace delete "/Workspace/Users/${CURRENT_USER_NAME}/test.py"
29+ }
30+ trap cleanup EXIT
31+
32+ title "Generate bundle config from the pipeline"
33+ $CLI bundle generate pipeline --existing-pipeline-id "$PIPELINE_ID" --key out --config-dir resources --source-dir src --force 2>&1 | sort
34+
35+ title "Verify generated yaml has expected fields"
36+ cat resources/out.pipeline.yml | contains.py "libraries:" "- notebook:" "path: ../src/notebook.py" "- file:" "path: ../src/test.py" > /dev/null
37+
38+ title "Deploy the generated bundle"
39+ trace $CLI bundle deploy
40+
41+ title "Destroy the deployed bundle"
42+ trace $CLI bundle destroy --auto-approve
Original file line number Diff line number Diff line change 1+ print ('Hello!' )
Original file line number Diff line number Diff line change 1+ Local = true
2+ Cloud = true
3+
4+ Ignore = [
5+ " databricks.yml" ,
6+ " resources/*" ,
7+ " src/*" ,
8+ " .databricks" ,
9+ ]
10+
11+ [Env ]
12+ # MSYS2 automatically converts absolute paths on Windows; disable for the workspace path.
13+ MSYS_NO_PATHCONV = " 1"
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments