-
Notifications
You must be signed in to change notification settings - Fork 161
Add app_spaces as a DABs resource type (direct mode only) #4982
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
base: main
Are you sure you want to change the base?
Changes from all commits
8df75a8
b990cb4
16886c3
40d3138
00e8b3f
0ce6a07
d4b5458
3d3510d
e8ce30b
efde2da
35640c2
dd092e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| app_spaces: | ||
| foo: | ||
| name: test-space-$UNIQUE_NAME | ||
| description: This is a test app space |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
|
|
||
| >>> [CLI] apps create-space test-space-[UNIQUE_NAME] --description Pre-existing space | ||
| { | ||
| "name": "test-space-[UNIQUE_NAME]", | ||
| "description": "Pre-existing space" | ||
| } | ||
|
|
||
| >>> [CLI] bundle deployment bind foo test-space-[UNIQUE_NAME] --auto-approve | ||
| Updating deployment state... | ||
| Successfully bound app_space with an id 'test-space-[UNIQUE_NAME]' | ||
| Run 'bundle deploy' to deploy changes to your workspace | ||
|
|
||
| === Deploy bundle | ||
| >>> [CLI] bundle deploy --force-lock --auto-approve | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] apps get-space test-space-[UNIQUE_NAME] | ||
| { | ||
| "name": "test-space-[UNIQUE_NAME]", | ||
| "description": "This is a test app space" | ||
| } | ||
|
|
||
| === Unbind app space | ||
| >>> [CLI] bundle deployment unbind foo | ||
| Updating deployment state... | ||
|
|
||
| === Destroy bundle | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! | ||
|
|
||
| === Read the pre-defined app space again (expecting it still exists): | ||
| >>> [CLI] apps get-space test-space-[UNIQUE_NAME] | ||
| { | ||
| "name": "test-space-[UNIQUE_NAME]", | ||
| "description": "This is a test app space" | ||
| } | ||
|
|
||
| === Test cleanup | ||
| >>> [CLI] apps delete-space test-space-[UNIQUE_NAME] | ||
| 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| cleanup() { | ||
| title "Test cleanup" | ||
| trace $CLI apps delete-space "test-space-$UNIQUE_NAME" | ||
| echo $? | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| trace $CLI apps create-space "test-space-$UNIQUE_NAME" --description "Pre-existing space" | jq '{name, description}' | ||
|
|
||
| trace $CLI bundle deployment bind foo "test-space-$UNIQUE_NAME" --auto-approve | ||
|
|
||
| title "Deploy bundle" | ||
| trace $CLI bundle deploy --force-lock --auto-approve | ||
|
|
||
| trace $CLI apps get-space "test-space-$UNIQUE_NAME" | jq '{name, description}' | ||
|
|
||
| title "Unbind app space" | ||
| trace $CLI bundle deployment unbind foo | ||
|
|
||
| title "Destroy bundle" | ||
| trace $CLI bundle destroy --auto-approve | ||
|
|
||
| title "Read the pre-defined app space again (expecting it still exists): " | ||
| trace $CLI apps get-space "test-space-$UNIQUE_NAME" | jq '{name, description}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Local = true | ||
| Cloud = true | ||
|
|
||
| Ignore = [ | ||
| ".databricks", | ||
| "databricks.yml", | ||
| ] | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| app_spaces: | ||
| foo: | ||
| name: app-space-$UNIQUE_NAME |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| app_spaces: | ||
| mykey: | ||
| name: myspacename | ||
| description: my_space_description | ||
| resources: | ||
| - name: my-serving-endpoint | ||
| serving_endpoint: | ||
| name: my-endpoint | ||
| permission: CAN_QUERY | ||
| - name: my-warehouse | ||
| sql_warehouse: | ||
| id: warehouse-id-1 | ||
| permission: CAN_USE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/app-spaces", | ||
| "body": { | ||
| "description": "my_space_description", | ||
| "name": "myspacename", | ||
| "resources": [ | ||
| { | ||
| "name": "my-serving-endpoint", | ||
| "serving_endpoint": { | ||
| "name": "my-endpoint", | ||
| "permission": "CAN_QUERY" | ||
| } | ||
| }, | ||
| { | ||
| "name": "my-warehouse", | ||
| "sql_warehouse": { | ||
| "id": "warehouse-id-1", | ||
| "permission": "CAN_USE" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| { | ||
| "method": "DELETE", | ||
| "path": "/api/2.0/app-spaces/myspacename" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
|
|
||
| >>> [CLI] bundle validate | ||
| Name: test-bundle | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default | ||
|
|
||
| Validation OK! | ||
|
|
||
| >>> [CLI] bundle plan | ||
| create app_spaces.mykey | ||
|
|
||
| Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> print_requests.py //app-spaces | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test-bundle | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default | ||
| Resources: | ||
| App Spaces: | ||
| mykey: | ||
| Name: myspacename | ||
| URL: (not deployed) | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.app_spaces.mykey | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! | ||
|
|
||
| >>> print_requests.py //app-spaces |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| trace $CLI bundle validate | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle deploy | ||
| trace print_requests.py //app-spaces > out.requests.$DATABRICKS_BUNDLE_ENGINE.json | ||
| trace $CLI bundle summary | ||
| trace $CLI bundle destroy --auto-approve | ||
| trace print_requests.py //app-spaces >> out.requests.$DATABRICKS_BUNDLE_ENGINE.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Local = true | ||
| Cloud = false | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| app_spaces: | ||
| mykey: | ||
| name: original-space-name | ||
| description: my_space_description |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/app-spaces", | ||
| "body": { | ||
| "description": "my_space_description", | ||
| "name": "original-space-name" | ||
| } | ||
| } | ||
| { | ||
| "method": "DELETE", | ||
| "path": "/api/2.0/app-spaces/original-space-name" | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/app-spaces", | ||
| "body": { | ||
| "description": "my_space_description", | ||
| "name": "renamed-space" | ||
| } | ||
| } | ||
| { | ||
| "method": "DELETE", | ||
| "path": "/api/2.0/app-spaces/renamed-space" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Please look into adding invariant tests as well - you need one config in acceptance/bundle/invariant/configs.
Does this resource support permissions?
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.
Yes, thanks for calling this out!
App Spaces support 3 different permissions levels (CAN_USE, CAN_CREATE, CAN_MANAGE) via
/api/2.0/permissions/app-spaces/{space-name}. I added a newAppSpacePermissiontype to handle this.Also, added that invariant config.