Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions acceptance/apps/import/app-yml/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
59 changes: 59 additions & 0 deletions acceptance/apps/import/app-yml/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

>>> [CLI] apps import --name myapp --output-dir out
Loading app 'myapp' configuration
Creating bundle configuration
File successfully saved to app.yml
Bundle configuration created at databricks.yml
Binding bundle to existing app
Successfully bound to app 'myapp'
Deploying bundle
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/myapp/default/files...
Files: 2 uploaded, 0 deleted
Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
Bundle deployed successfully
Starting app
✓ Getting the status of the app myapp
✓ App is in RUNNING state
✓ App compute is in ACTIVE state
✓ Deployment succeeded
You can access the app at myapp-123.cloud.databricksapps.com
App started successfully

✔ App 'myapp' imported to [TEST_TMP_DIR]/out

You can now deploy changes with: databricks bundle deploy

>>> ls out
app.yml
databricks.yml

>>> cat out/databricks.yml
bundle:
name: myapp

workspace:
host: [DATABRICKS_URL]

resources:
apps:
app:
name: myapp
description: ""
source_code_path: .

>>> cat out/app.yml
command:
- python
- app.py
env:
- name: GREETING
value: hello
- name: WAREHOUSE_ID
valueFrom: sql-warehouse
- name: PYTHON_VERSION
value: 3.10

=== App config the bundle deploys (app.yml, if kept, is uploaded with the source)

>>> [CLI] bundle validate -o json
null
22 changes: 22 additions & 0 deletions acceptance/apps/import/app-yml/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# apps import of an app whose source has an app.yml with a plain env value, a
# valueFrom reference and an unquoted value that YAML reads as a number.
# MSYS_NO_PATHCONV keeps Git Bash on Windows from rewriting the /Workspace path.
APP_PATH="/Workspace/Users/$CURRENT_USER_NAME/myapp"
MSYS_NO_PATHCONV=1 $CLI workspace import-dir src "$APP_PATH" >> LOG.setup 2>&1
$CLI apps create myapp >> LOG.setup 2>&1
MSYS_NO_PATHCONV=1 $CLI apps deploy myapp --source-code-path "$APP_PATH" >> LOG.setup 2>&1

trace $CLI apps import --name myapp --output-dir out

trace ls out

trace cat out/databricks.yml

if [ -f out/app.yml ]; then
trace cat out/app.yml
fi

title "App config the bundle deploys (app.yml, if kept, is uploaded with the source)"
withdir out trace $CLI bundle validate -o json | jq '.resources.apps.app.config'

rm -rf out
10 changes: 10 additions & 0 deletions acceptance/apps/import/app-yml/src/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
command:
- python
- app.py
env:
- name: GREETING
value: hello
- name: WAREHOUSE_ID
valueFrom: sql-warehouse
- name: PYTHON_VERSION
value: 3.10
6 changes: 6 additions & 0 deletions acceptance/apps/import/app-yml/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Badness = "app.yml is meant to be inlined into databricks.yml as the app's config and removed (inlineAppConfigFile in cmd/apps/import.go), but the check runs before the source files are downloaded, so it never finds app.yml: databricks.yml gets no config and app.yml stays."

# Fix path with reverse slashes in the output for Windows.
[[Repls]]
Old = 'TEST_TMP_DIR]\\out'
New = 'TEST_TMP_DIR]/out'
Loading