Repository navigation
Use source_code_path and git_source on create/update
#6399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6a09092
4f489ac
00f46ed
1cd0896
51d383b
160bdfd
521bf30
f9fa887
6e2f740
c6b5e56
105179d
4f5f49c
c88a0a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Send `source_code_path` on the app Create request and `git_source` on the app Create and Update requests, so the app records its configured source before its first deployment. ([#6399](https://github.com/databricks/cli/pull/6399)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("v1") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("v2") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| bundle: | ||
| name: app-source-code-path-update | ||
|
|
||
| resources: | ||
| apps: | ||
| myapp: | ||
| name: test-app-source-code-path-update | ||
| description: my_app_description | ||
| source_code_path: ./app |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
|
|
||
| === Deploy: source_code_path is sent on Create | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-source-code-path-update/default/files... | ||
| Created apps.myapp | ||
| Files: 3 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //apps | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/apps", | ||
| "q": { | ||
| "no_compute": "true" | ||
| }, | ||
| "body": { | ||
| "description": "my_app_description", | ||
| "name": "test-app-source-code-path-update", | ||
| "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/app-source-code-path-update/default/files/app" | ||
| } | ||
| } | ||
|
|
||
| === Change source_code_path: plan detects an update | ||
|
|
||
| >>> update_file.py databricks.yml source_code_path: ./app source_code_path: ./app2 | ||
|
|
||
| >>> [CLI] bundle plan | ||
| update apps.myapp | ||
|
|
||
| Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged | ||
|
|
||
| === Redeploy: UpdateApp rejects source_code_path, so no app request is sent; the next Deploy applies it | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-source-code-path-update/default/files... | ||
| Updated apps.myapp | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //apps | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is empty because the update doesn't fire a request, but still stores the updated value in the state?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. UpdateApp rejects |
||
|
|
||
| === Change description: App Update omits source_code_path from the body and the update mask | ||
|
|
||
| >>> update_file.py databricks.yml my_app_description MY_APP_DESCRIPTION | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/app-source-code-path-update/default/files... | ||
| Updated apps.myapp | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //apps | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/apps/test-app-source-code-path-update/update", | ||
| "body": { | ||
| "app": { | ||
| "description": "MY_APP_DESCRIPTION", | ||
| "name": "test-app-source-code-path-update" | ||
| }, | ||
| "update_mask": "description,budget_policy_id,usage_policy_id,resources,user_api_scopes,compute_min_instances,compute_max_instances,git_repository,git_source,telemetry_export_destinations" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| title "Deploy: source_code_path is sent on Create" | ||
| trace $CLI bundle deploy | ||
| trace print_requests.py //apps | ||
|
|
||
| title "Change source_code_path: plan detects an update" | ||
| trace update_file.py databricks.yml "source_code_path: ./app" "source_code_path: ./app2" | ||
| trace $CLI bundle plan | ||
|
|
||
| title "Redeploy: UpdateApp rejects source_code_path, so no app request is sent; the next Deploy applies it" | ||
| trace $CLI bundle deploy | ||
| trace print_requests.py //apps | ||
|
|
||
| title "Change description: App Update omits source_code_path from the body and the update mask" | ||
| trace update_file.py databricks.yml my_app_description MY_APP_DESCRIPTION | ||
| trace $CLI bundle deploy | ||
| trace print_requests.py //apps |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Cloud = false | ||
|
|
||
| Ignore = [".databricks"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("v1") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("v2") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| bundle: | ||
| name: update-source-code-path-cloud-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| apps: | ||
| myapp: | ||
| name: $UNIQUE_NAME | ||
| description: my_app_description | ||
| source_code_path: ./app |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = true | ||
| EnvMatrix.DMS = ["", "true"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
|
|
||
| === Deploy: create the app with source_code_path | ||
|
|
||
| >>> errcode [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-source-code-path-cloud-[UNIQUE_NAME]/default/files... | ||
| Created apps.myapp | ||
| Files: 4 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //apps | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/apps", | ||
| "q": { | ||
| "no_compute": "true" | ||
| }, | ||
| "body": { | ||
| "description": "my_app_description", | ||
| "name": "[UNIQUE_NAME]", | ||
| "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/update-source-code-path-cloud-[UNIQUE_NAME]/default/files/app" | ||
| } | ||
| } | ||
|
|
||
| === Change source_code_path on an existing app: no UpdateApp request is sent | ||
|
|
||
| >>> update_file.py databricks.yml source_code_path: ./app source_code_path: ./app2 | ||
|
|
||
| >>> errcode [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/update-source-code-path-cloud-[UNIQUE_NAME]/default/files... | ||
| Updated apps.myapp | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //apps | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.apps.myapp | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/update-source-code-path-cloud-[UNIQUE_NAME]/default | ||
|
|
||
| Destroy: 1 deleted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this different from "source-code-path-update"?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same rule, but this one runs against a real workspace ( |
||
|
|
||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| title "Deploy: create the app with source_code_path" | ||
| trace errcode $CLI bundle deploy | ||
| trace print_requests.py //apps | ||
| rm -f out.requests.txt | ||
|
|
||
| title "Change source_code_path on an existing app: no UpdateApp request is sent" | ||
| trace update_file.py databricks.yml "source_code_path: ./app" "source_code_path: ./app2" | ||
| trace errcode $CLI bundle deploy | ||
| trace print_requests.py //apps | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Runs against a real workspace: production rejects source_code_path in the UpdateApp mask | ||
| # (400 INVALID_PARAMETER_VALUE), so changing it on an existing app must not call UpdateApp. | ||
| # Locally the fake server enforces the same rule; see libs/testserver/apps.go. | ||
| Cloud = true | ||
| RecordRequests = true | ||
|
|
||
| Ignore = [".databricks", "databricks.yml"] | ||
|
|
||
| # App deployment progress messages are non-deterministic on cloud (different status messages | ||
| # per poll), so filter them out entirely. | ||
| [[Repls]] | ||
| Old = '(?m)^✓ [^\n]*\n' | ||
| New = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very detailed; maybe something like "enable drift detection for
source_code_pathandgit_sourcefor apps"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, shortened to "Enable drift detection for
source_code_pathandgit_sourceon apps." in #7761.