Skip to content

Commit cc6f143

Browse files
authored
direct: Support bind/unbind (#4279)
## Why Closes #4061 ## Tests Existing tests all pass. bind/experiments test shows difference in final result, this is unrelated to bind and issue with experiments resource.
1 parent 7618251 commit cc6f143

File tree

76 files changed

+733
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+733
-247
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### CLI
88

99
### Bundles
10+
* engine/direct: Support bind & unbind. ([#4279](https://github.com/databricks/cli/pull/4279))
1011

1112
### Dependency updates
1213

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

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

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

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

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"state_version": 1,
3+
"cli_version": "[DEV_VERSION]",
4+
"lineage": "[UUID]",
5+
"serial": 2,
6+
"state": {
7+
"resources.dashboards.dashboard1": {
8+
"__id__": "[DASHBOARD_ID]",
9+
"state": {
10+
"display_name": "test dashboard [UNIQUE_NAME]",
11+
"embed_credentials": true,
12+
"etag": [ETAG],
13+
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/resources",
14+
"published": true,
15+
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Page One\",\"name\":\"02724bf2\"}]}",
16+
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
17+
}
18+
}
19+
}
20+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"version": 4,
3+
"terraform_version": "1.5.5",
4+
"serial": 1,
5+
"lineage": "[UUID]",
6+
"outputs": {},
7+
"resources": [
8+
{
9+
"mode": "managed",
10+
"type": "databricks_dashboard",
11+
"name": "dashboard1",
12+
"provider": "provider[\"registry.terraform.io/databricks/databricks\"]",
13+
"instances": [
14+
{
15+
"schema_version": 0,
16+
"attributes": {
17+
"create_time": "[TIMESTAMP]",
18+
"dashboard_change_detected": false,
19+
"dashboard_id": "[DASHBOARD_ID]",
20+
"dataset_catalog": null,
21+
"dataset_schema": null,
22+
"display_name": "test dashboard [UNIQUE_NAME]",
23+
"embed_credentials": null,
24+
"etag": [ETAG],
25+
"file_path": null,
26+
"id": "[DASHBOARD_ID]",
27+
"lifecycle_state": "ACTIVE",
28+
"md5": null,
29+
"parent_path": "/Users/[USERNAME]",
30+
"path": "/Users/[USERNAME]/test dashboard [UNIQUE_NAME].lvdash.json",
31+
"serialized_dashboard": "{\"pages\":[{\"displayName\":\"Untitled page\",\"name\":\"02724bf2\",\"pageType\":\"PAGE_TYPE_CANVAS\"}]}",
32+
"update_time": "[TIMESTAMP]",
33+
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
34+
},
35+
"sensitive_attributes": [],
36+
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjAifQ=="
37+
}
38+
]
39+
}
40+
],
41+
"check_results": null
42+
}

acceptance/bundle/deployment/bind/dashboard/recreation/out.test.toml

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

acceptance/bundle/deployment/bind/dashboard/recreation/output.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Updating deployment state...
44
Successfully bound dashboard with an id '[DASHBOARD_ID]'
55
Run 'bundle deploy' to deploy changes to your workspace
66

7+
>>> print_state.py
8+
[ETAG]
9+
10+
>>> [CLI] bundle plan
11+
recreate dashboards.dashboard1
12+
13+
Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged
14+
715
>>> errcode [CLI] bundle deploy
816
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
917

acceptance/bundle/deployment/bind/dashboard/recreation/script

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ envsubst < databricks.yml.tmpl > databricks.yml
55

66
# Create a pre-defined dashboard:
77
DASHBOARD_ID=$($CLI lakeview create --display-name "${DASHBOARD_DISPLAY_NAME}" --warehouse-id "${TEST_DEFAULT_WAREHOUSE_ID}" --serialized-dashboard '{"pages":[{"name":"02724bf2","displayName":"Untitled page"}]}' | jq -r '.dashboard_id')
8+
echo "$DASHBOARD_ID:DASHBOARD_ID" >> ACC_REPLS
89

910
cleanupRemoveDashboard() {
1011
$CLI lakeview trash "${DASHBOARD_ID}"
1112
}
1213
trap cleanupRemoveDashboard EXIT
1314

1415
trace $CLI bundle deployment bind dashboard1 "${DASHBOARD_ID}" --auto-approve
16+
trace print_state.py > out.state_after_bind.$DATABRICKS_BUNDLE_ENGINE.json
17+
ETAG=$(jq '.state["resources.dashboards.dashboard1"].state.etag // .resources[0].instances[0].attributes.etag // "no-etag"' < out.state_after_bind.$DATABRICKS_BUNDLE_ENGINE.json)
18+
echo $ETAG
19+
add_repl.py $ETAG ETAG
20+
json_in_json_normalize.py out.state_after_bind.$DATABRICKS_BUNDLE_ENGINE.json
1521

22+
trace $CLI bundle plan
1623
trace errcode $CLI bundle deploy
1724

1825
trace $CLI bundle deployment unbind dashboard1

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

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

0 commit comments

Comments
 (0)