Repository navigation
Leave compute_size out of app update mask when not declared #7461
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Stop sending `compute_size` in the app update mask when the bundle does not declare it, so a deploy no longer resets a manually resized app to the default size. ([#7461](https://github.com/databricks/cli/pull/7461)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
acceptance/bundle/resources/apps/update-compute-size/app/app.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print("Hello world!") |
10 changes: 10 additions & 0 deletions
10
acceptance/bundle/resources/apps/update-compute-size/databricks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| apps: | ||
| mykey: | ||
| name: myappname | ||
| description: my_app_description | ||
| compute_size: LARGE | ||
| source_code_path: ./app |
35 changes: 35 additions & 0 deletions
35
acceptance/bundle/resources/apps/update-compute-size/out.requests.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/apps", | ||
| "q": { | ||
| "no_compute": "true" | ||
| }, | ||
| "body": { | ||
| "compute_size": "LARGE", | ||
| "description": "my_app_description", | ||
| "name": "myappname" | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/apps/myappname/update", | ||
| "body": { | ||
| "app": { | ||
| "compute_size": "LARGE", | ||
| "description": "MY_APP_DESCRIPTION", | ||
| "name": "myappname" | ||
| }, | ||
| "update_mask": "description,budget_policy_id,usage_policy_id,resources,user_api_scopes,compute_size,compute_min_instances,compute_max_instances,git_repository,telemetry_export_destinations" | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/apps/myappname/update", | ||
| "body": { | ||
| "app": { | ||
| "description": "MY_APP_DESCRIPTION_2", | ||
| "name": "myappname" | ||
| }, | ||
| "update_mask": "description,budget_policy_id,usage_policy_id,resources,user_api_scopes,compute_min_instances,compute_max_instances,git_repository,telemetry_export_destinations" | ||
| } | ||
| } |
2 changes: 2 additions & 0 deletions
2
acceptance/bundle/resources/apps/update-compute-size/out.test.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = ["", "true"] |
36 changes: 36 additions & 0 deletions
36
acceptance/bundle/resources/apps/update-compute-size/output.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
|
|
||
| === Deploy with compute_size declared | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Created apps.mykey | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests | ||
|
|
||
| === Update description while compute_size is still declared | ||
| >>> update_file.py databricks.yml my_app_description MY_APP_DESCRIPTION | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Updated apps.mykey | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests | ||
|
|
||
| === Remove compute_size and update description | ||
| >>> update_file.py databricks.yml MY_APP_DESCRIPTION MY_APP_DESCRIPTION_2 | ||
|
|
||
| >>> [CLI] bundle plan | ||
| update apps.mykey | ||
|
|
||
| Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Updated apps.mykey | ||
| Files: 2 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests |
21 changes: 21 additions & 0 deletions
21
acceptance/bundle/resources/apps/update-compute-size/script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| print_requests() { | ||
| # url is output-only field that terraform adds but that is ignored by the backend | ||
| print_requests.py //apps '^//api/2.0/bundle' --del-body url | ||
| } | ||
|
|
||
| title "Deploy with compute_size declared" | ||
| trace $CLI bundle deploy | ||
| trace print_requests > out.requests.json | ||
|
|
||
| title "Update description while compute_size is still declared" | ||
| trace update_file.py databricks.yml my_app_description MY_APP_DESCRIPTION | ||
| trace $CLI bundle deploy | ||
| trace print_requests >> out.requests.json | ||
|
|
||
| title "Remove compute_size and update description" | ||
| grep -v compute_size databricks.yml > databricks.yml.new | ||
| mv databricks.yml.new databricks.yml | ||
| trace update_file.py databricks.yml MY_APP_DESCRIPTION MY_APP_DESCRIPTION_2 | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle deploy | ||
| trace print_requests >> out.requests.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could we derive the update mask entirely?
cc @denik
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.
Not fully: deriving the mask from the request body would stop clearing fields removed from config (all UpdateMaskFields are omitempty, so "in mask, absent from body" is what clears them today), and deriving it from the plan is what #4963 did before #5051 reverted it because the plan can name fields the Update API rejects, so the viable middle ground is the plan-driven mask filtered by the static allowlist, which I'd rather do as a follow-up on top of this and #6399 since it touches the same list.