Skip to content

Commit a5c9f95

Browse files
authored
direct: apps: mark compute_size as backend_default (#4971)
## Changes For apps, mark compute_size as backend_default. ## Why Backend sets it to "MEDIUM", causing drift. ## Tests Update testserver to set compute_size default to "MEDIUM", same as cloud, this makes invariant test apps.yml fail locally same as on cloud. This PR then fixes both local and cloud.
1 parent 4b43aee commit a5c9f95

7 files changed

Lines changed: 15 additions & 3 deletions

File tree

acceptance/bundle/generate/app_not_yet_deployed/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"message":"Application is running.",
66
"state":"RUNNING"
77
},
8+
"compute_size":"MEDIUM",
89
"compute_status": {
910
"message":"App compute is active.",
1011
"state":"ACTIVE"

acceptance/bundle/invariant/continue_293/test.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ EnvMatrixExclude.no_grant_ref = ["INPUT_CONFIG=schema_grant_ref.yml.tmpl"]
55

66
# Model permissions did not work until 0.297.0 https://github.com/databricks/cli/pull/4941
77
EnvMatrixExclude.no_model_with_permissions = ["INPUT_CONFIG=model_with_permissions.yml.tmpl"]
8-
9-
# LOG.deploy: Error: cannot update resources.apps.foo: updating id=app-dnppf7fm4zalnocu4yav774xpy: Invalid update mask. Only description, budget_policy_id, usage_policy_id, resources, user_api_scopes, compute_size, compute_min_instances, compute_max_instances, git_repository, telemetry_export_destinations are allowed. Supplied update mask: * (400 INVALID_PARAMETER_VALUE)
10-
EnvMatrixExclude.no_app = ["INPUT_CONFIG=app.yml"]

acceptance/bundle/resources/apps/config-drift/out.plan.direct.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
"state": "RUNNING"
3636
}
3737
},
38+
"compute_size": {
39+
"action": "skip",
40+
"reason": "backend_default",
41+
"remote": "MEDIUM"
42+
},
3843
"compute_status": {
3944
"action": "skip",
4045
"reason": "spec:output_only",

acceptance/bundle/resources/apps/create_already_exists/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"message":"Application is running.",
66
"state":"RUNNING"
77
},
8+
"compute_size":"MEDIUM",
89
"compute_status": {
910
"message":"App compute is active.",
1011
"state":"ACTIVE"

acceptance/cmd/workspace/apps/output.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"message":"Application is running.",
77
"state":"RUNNING"
88
},
9+
"compute_size":"MEDIUM",
910
"compute_status": {
1011
"message":"App compute is active.",
1112
"state":"ACTIVE"
@@ -37,6 +38,7 @@
3738
"message":"Application is running.",
3839
"state":"RUNNING"
3940
},
41+
"compute_size":"MEDIUM",
4042
"compute_status": {
4143
"message":"App compute is active.",
4244
"state":"ACTIVE"

bundle/direct/dresources/resources.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ resources:
376376
- field: name
377377
reason: immutable
378378
backend_defaults:
379+
# Backend sets it "MEDIUM" when not specified in the config
380+
- field: compute_size
379381
# lifecycle.started is derived from remote compute status in RemapState, so the
380382
# remote side always has a value. When the user omits lifecycle from config,
381383
# both old and new are nil and backend_defaults correctly skips the remote value.

libs/testserver/apps.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ func (s *FakeWorkspace) AppsUpsert(req Request, name string) Response {
226226
app.Url = name + "-123.cloud.databricksapps.com"
227227
app.Id = strconv.Itoa(len(s.Apps) + 1000)
228228

229+
if app.ComputeSize == "" {
230+
app.ComputeSize = "MEDIUM"
231+
}
232+
229233
// Assign a service principal to the app, mimicking the real platform.
230234
if app.ServicePrincipalClientId == "" {
231235
app.ServicePrincipalClientId = nextUUID()

0 commit comments

Comments
 (0)