diff --git a/acceptance/apps/import/app-yml/out.test.toml b/acceptance/apps/import/app-yml/out.test.toml new file mode 100644 index 00000000000..18b1a88417e --- /dev/null +++ b/acceptance/apps/import/app-yml/out.test.toml @@ -0,0 +1 @@ +Cloud = false diff --git a/acceptance/apps/import/app-yml/output.txt b/acceptance/apps/import/app-yml/output.txt new file mode 100644 index 00000000000..b600b58c013 --- /dev/null +++ b/acceptance/apps/import/app-yml/output.txt @@ -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 diff --git a/acceptance/apps/import/app-yml/script b/acceptance/apps/import/app-yml/script new file mode 100644 index 00000000000..c7446d0ff09 --- /dev/null +++ b/acceptance/apps/import/app-yml/script @@ -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 diff --git a/acceptance/apps/import/app-yml/src/app.yml b/acceptance/apps/import/app-yml/src/app.yml new file mode 100644 index 00000000000..91084cc1155 --- /dev/null +++ b/acceptance/apps/import/app-yml/src/app.yml @@ -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 diff --git a/acceptance/apps/import/app-yml/test.toml b/acceptance/apps/import/app-yml/test.toml new file mode 100644 index 00000000000..0491f2c2d40 --- /dev/null +++ b/acceptance/apps/import/app-yml/test.toml @@ -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'