Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 214
Add support for dashboards in deployment bind/unbind commands#2516
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c6522c6ebd935074454448d7bd8ec68a43fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| bundle: | ||
| name: bind-dashboard-test-$UNIQUE_NAME | ||
| resources: | ||
| dashboards: | ||
| dashboard1: | ||
| display_name: $DASHBOARD_DISPLAY_NAME | ||
| warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID | ||
| embed_credentials: true | ||
| file_path: "sample-dashboard.lvdash.json" | ||
| parent_path: /Users/$CURRENT_USER_NAME | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| >>> [CLI] bundle deployment bind dashboard1 [DASHBOARD_ID] --auto-approve | ||
| Updating deployment state... | ||
| Successfully bound databricks_dashboard with an id '[DASHBOARD_ID]'. Run 'bundle deploy' to deploy changes to your workspace | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/bind-dashboard-test-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] lakeview get [DASHBOARD_ID] | ||
| { | ||
| "display_name": "test dashboard [UUID]", | ||
| "lifecycle_state": "ACTIVE", | ||
| "path": "/Users/[USERNAME]/test dashboard [UUID].lvdash.json", | ||
| "parent_path": "/Users/[USERNAME]", | ||
| "serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Page One\"}]}" | ||
| } | ||
| >>> [CLI] bundle deployment unbind dashboard1 | ||
| Updating deployment state... | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/bind-dashboard-test-[UNIQUE_NAME]/default | ||
| Deleting files... | ||
| Destroy complete! | ||
| >>> [CLI] lakeview get [DASHBOARD_ID] | ||
| { | ||
| "display_name": "test dashboard [UUID]", | ||
| "lifecycle_state": "ACTIVE", | ||
| "path": "/Users/[USERNAME]/test dashboard [UUID].lvdash.json", | ||
| "parent_path": "/Users/[USERNAME]", | ||
| "serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Page One\"}]}" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| bundle: | ||
| name: bind-dashboard-recreation-test-$UNIQUE_NAME | ||
| resources: | ||
| dashboards: | ||
| dashboard1: | ||
| display_name: $DASHBOARD_DISPLAY_NAME | ||
| warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID | ||
| embed_credentials: true | ||
| file_path: "sample-dashboard.lvdash.json" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| >>> [CLI] bundle deployment bind dashboard1 [DASHBOARD_ID] --auto-approve | ||
| Updating deployment state... | ||
| Successfully bound databricks_dashboard with an id '[DASHBOARD_ID]'. Run 'bundle deploy' to deploy changes to your workspace | ||
| >>> errcode [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/bind-dashboard-recreation-test-[UNIQUE_NAME]/default/files... | ||
| This action will result in the deletion or recreation of the following dashboards. | ||
| This will result in changed IDs and permanent URLs of the dashboards that will be recreated: | ||
| recreate dashboard dashboard1 | ||
| Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed | ||
| Exit code: 1 | ||
| >>> [CLI] bundle deployment unbind dashboard1 | ||
| Updating deployment state... | ||
| >>> [CLI] bundle deploy --auto-approve | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/bind-dashboard-recreation-test-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] lakeview get [DASHBOARD_ID] | ||
| { | ||
| "display_name": "test dashboard [UUID]", | ||
| "lifecycle_state": "ACTIVE" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"pages":[{"name":"02724bf2","displayName":"Page One"}]} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| DASHBOARD_DISPLAY_NAME="test dashboard $(uuid)" | ||
| if [ -z "$CLOUD_ENV" ]; then | ||
| DASHBOARD_DISPLAY_NAME="test dashboard 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally | ||
| export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234" | ||
| fi | ||
| export DASHBOARD_DISPLAY_NAME | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| # Create a pre-defined dashboard: | ||
| 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') | ||
| cleanupRemoveDashboard() { | ||
| $CLI lakeview trash "${DASHBOARD_ID}" | ||
| } | ||
| trap cleanupRemoveDashboard EXIT | ||
| trace $CLI bundle deployment bind dashboard1 "${DASHBOARD_ID}" --auto-approve | ||
| trace errcode $CLI bundle deploy | ||
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. I'm implementing bind for direct engine and don't quite understand why this is supposed to trigger recreation? We just bound the dashboard, there was no previous dashboard created from this bundle, why would we delete and create a new one here? @anton-107@andrewnester | ||
| trace $CLI bundle deployment unbind dashboard1 | ||
| trace $CLI bundle deploy --auto-approve | ||
| trace $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name, lifecycle_state}' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"pages":[{"name":"02724bf2","displayName":"Page One"}]} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| DASHBOARD_DISPLAY_NAME="test dashboard $(uuid)" | ||
| if [ -z "$CLOUD_ENV" ]; then | ||
| DASHBOARD_DISPLAY_NAME="test dashboard 6260d50f-e8ff-4905-8f28-812345678903" # use hard-coded uuid when running locally | ||
| export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234" | ||
anton-107 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| fi | ||
| export DASHBOARD_DISPLAY_NAME | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| # Create a pre-defined dashboard: | ||
| 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') | ||
| cleanupRemoveDashboard() { | ||
| $CLI lakeview trash "${DASHBOARD_ID}" | ||
| } | ||
| trap cleanupRemoveDashboard EXIT | ||
anton-107 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| trace $CLI bundle deployment bind dashboard1 "${DASHBOARD_ID}" --auto-approve | ||
| trace $CLI bundle deploy | ||
| trace $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name, lifecycle_state, path, parent_path, serialized_dashboard}' | ||
| trace $CLI bundle deployment unbind dashboard1 | ||
| trace $CLI bundle destroy --auto-approve | ||
| # Read the pre-defined dashboard again (expecting it still exists and is not deleted): | ||
| trace $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name, lifecycle_state, path, parent_path, serialized_dashboard}' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| Local = true | ||
| Cloud = true | ||
| RequiresWarehouse = true | ||
| Ignore = [ | ||
| "databricks.yml", | ||
| ] | ||
| [[Repls]] | ||
| Old = "[0-9a-f]{32}" | ||
| New = "[DASHBOARD_ID]" | ||
| [[Server]] | ||
| Pattern = "POST /api/2.0/lakeview/dashboards" | ||
| Response.Body = ''' | ||
| { | ||
| "dashboard_id":"1234567890abcdef1234567890abcdef" | ||
| } | ||
| ''' | ||
| [[Server]] | ||
| Pattern = "POST /api/2.0/lakeview/dashboards/{dashboard_id}/published" | ||
| [[Server]] | ||
| Pattern = "PATCH /api/2.0/lakeview/dashboards/{dashboard_id}" | ||
| [[Server]] | ||
| Pattern = "GET /api/2.0/lakeview/dashboards/{dashboard_id}" | ||
| Response.Body = ''' | ||
| { | ||
| "dashboard_id":"1234567890abcdef1234567890abcdef", | ||
| "display_name": "test dashboard 6260d50f-e8ff-4905-8f28-812345678903", | ||
| "lifecycle_state": "ACTIVE", | ||
| "path": "/Users/[USERNAME]/test dashboard [UUID].lvdash.json", | ||
| "parent_path": "/Users/tester@databricks.com", | ||
| "serialized_dashboard": "{\"pages\":[{\"name\":\"02724bf2\",\"displayName\":\"Page One\"}]}" | ||
| } | ||
| ''' | ||
| [[Server]] | ||
| Pattern = "DELETE /api/2.0/lakeview/dashboards/{dashboard_id}" |
Uh oh!
There was an error while loading. Please reload this page.