Skip to content

Commit 2114d03

Browse files
Address review feedback round 2: permissions, lint, direct-only, tests
- Scope govet lint directive to a specific linter (Jannik) - Remove fabricated InitializeURL; spaces have no stable UI URL yet (Jannik) - Opt out of terraform via ValidateDirectOnlyResources (Jannik) - Replace panic in merge_app_spaces with user-facing diagnostic (Denik) - Add permissions support for app_spaces using the generic /api/2.0/permissions/app-spaces/{name} endpoint - Use print_requests.py helper in acceptance scripts (Denik) - Add invariant, drift (via invariant no_drift), and bind/unbind acceptance tests (Jannik) - Exclude app_space from migrate invariant test since the resource is direct-only (same pattern as catalog, external_location) - Regenerate annotations, jsonschema, enum_fields, required_fields - Fix TestConvertLifecycleForAllResources and state_load tests to account for the new resource - Add NEXT_CHANGELOG.md entry Note: resources.generated.yml needs make generate-direct to populate output-only fields (create_time, service_principal_*, status, etc.) from the OpenAPI spec. Until then, invariant no_drift for app_space will fail locally; CI pipelines with VPN access will keep it in sync. Co-authored-by: Isaac
1 parent 2aca067 commit 2114d03

36 files changed

Lines changed: 356 additions & 61 deletions

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
* Support `replace_existing: true` on `postgres_branches` and `postgres_endpoints` so bundles can manage the implicitly-created production branch and primary read-write endpoint of a Lakebase project.
2020
* Add `postgres_catalogs` resource to bind a Unity Catalog catalog to a Postgres database on a Lakebase Autoscaling branch ([#5265](https://github.com/databricks/cli/pull/5265)).
2121
* engine/direct: Changes to state file now persisted to .wal file right away instead of being saved in the end ([#5149](https://github.com/databricks/cli/pull/5149))
22+
* engine/direct: Added support for Databricks App Spaces (`app_spaces` resource type) ([#4982](https://github.com/databricks/cli/pull/4982))
2223

2324
### Dependency updates
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bundle:
2+
name: test-bundle-$UNIQUE_NAME
3+
4+
resources:
5+
app_spaces:
6+
foo:
7+
name: test-space-$UNIQUE_NAME
8+
description: This is a test app space

acceptance/bundle/deployment/bind/app_space/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
>>> [CLI] apps create-space test-space-[UNIQUE_NAME] --description Pre-existing space
3+
{
4+
"name": "test-space-[UNIQUE_NAME]",
5+
"description": "Pre-existing space"
6+
}
7+
8+
>>> [CLI] bundle deployment bind foo test-space-[UNIQUE_NAME] --auto-approve
9+
Updating deployment state...
10+
Successfully bound app_space with an id 'test-space-[UNIQUE_NAME]'
11+
Run 'bundle deploy' to deploy changes to your workspace
12+
13+
=== Deploy bundle
14+
>>> [CLI] bundle deploy --force-lock --auto-approve
15+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
16+
Deploying resources...
17+
Updating deployment state...
18+
Deployment complete!
19+
20+
>>> [CLI] apps get-space test-space-[UNIQUE_NAME]
21+
{
22+
"name": "test-space-[UNIQUE_NAME]",
23+
"description": "This is a test app space"
24+
}
25+
26+
=== Unbind app space
27+
>>> [CLI] bundle deployment unbind foo
28+
Updating deployment state...
29+
30+
=== Destroy bundle
31+
>>> [CLI] bundle destroy --auto-approve
32+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
33+
34+
Deleting files...
35+
Destroy complete!
36+
37+
=== Read the pre-defined app space again (expecting it still exists):
38+
>>> [CLI] apps get-space test-space-[UNIQUE_NAME]
39+
{
40+
"name": "test-space-[UNIQUE_NAME]",
41+
"description": "This is a test app space"
42+
}
43+
44+
=== Test cleanup
45+
>>> [CLI] apps delete-space test-space-[UNIQUE_NAME]
46+
0
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cleanup() {
2+
title "Test cleanup"
3+
trace $CLI apps delete-space "test-space-$UNIQUE_NAME"
4+
echo $?
5+
}
6+
trap cleanup EXIT
7+
8+
envsubst < databricks.yml.tmpl > databricks.yml
9+
10+
trace $CLI apps create-space "test-space-$UNIQUE_NAME" --description "Pre-existing space" | jq '{name, description}'
11+
12+
trace $CLI bundle deployment bind foo "test-space-$UNIQUE_NAME" --auto-approve
13+
14+
title "Deploy bundle"
15+
trace $CLI bundle deploy --force-lock --auto-approve
16+
17+
trace $CLI apps get-space "test-space-$UNIQUE_NAME" | jq '{name, description}'
18+
19+
title "Unbind app space"
20+
trace $CLI bundle deployment unbind foo
21+
22+
title "Destroy bundle"
23+
trace $CLI bundle destroy --auto-approve
24+
25+
title "Read the pre-defined app space again (expecting it still exists): "
26+
trace $CLI apps get-space "test-space-$UNIQUE_NAME" | jq '{name, description}'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Local = true
2+
Cloud = true
3+
4+
Ignore = [
5+
".databricks",
6+
"databricks.yml",
7+
]
8+
9+
[EnvMatrix]
10+
DATABRICKS_BUNDLE_ENGINE = ["direct"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bundle:
2+
name: test-bundle-$UNIQUE_NAME
3+
4+
resources:
5+
app_spaces:
6+
foo:
7+
name: app-space-$UNIQUE_NAME

acceptance/bundle/invariant/continue_293/out.test.toml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/invariant/migrate/out.test.toml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/invariant/migrate/test.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ EnvMatrixExclude.no_vector_search_endpoint = ["INPUT_CONFIG=vector_search_endpoi
44
# Error: Catalog resources are only supported with direct deployment mode
55
EnvMatrixExclude.no_catalog = ["INPUT_CONFIG=catalog.yml.tmpl"]
66
EnvMatrixExclude.no_external_location = ["INPUT_CONFIG=external_location.yml.tmpl"]
7+
EnvMatrixExclude.no_app_space = ["INPUT_CONFIG=app_space.yml.tmpl"]
78

89
# Cross-resource permission references (e.g. ${resources.jobs.job_b.permissions[0].level})
910
# don't work in terraform mode: the terraform interpolator converts the path to

0 commit comments

Comments
 (0)