-
Notifications
You must be signed in to change notification settings - Fork 177
bundle: Add genie_space resource (direct engine only) #5282
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
9e46a65
517d22e
fc4af0d
0145b87
5535c46
133a64c
5decb00
786ded7
cd3f101
732641c
41f36a9
0b27cc4
2ff9273
04ec5fa
3303b8d
b1f7595
9891229
0a9f3cb
03350e8
e5d49dd
2b186cb
a595ca4
dcce42e
9118a3b
1c1aa88
b80768c
c82791c
fe19eb2
6760708
55f1ed2
6566ff1
4be04ae
cdf670c
d1487ea
7072a39
3911870
23b0f68
cc53f04
ea9e983
4e18b60
e90597e
c22a3fa
df2e06b
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,13 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| genie_spaces: | ||
| genie_space1: | ||
| title: $GENIE_SPACE_TITLE | ||
| warehouse_id: "test-warehouse-id" | ||
| parent_path: /Users/$CURRENT_USER_NAME | ||
| # Inline body matches the out-of-band-created space byte-for-byte, so the | ||
| # only possible post-bind drift signal is the etag. | ||
| serialized_space: | ||
| version: 1 |
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,37 @@ | ||
|
|
||
| >>> [CLI] bundle deployment bind genie_space1 [GENIE_SPACE_ID] --auto-approve | ||
| Updating deployment state... | ||
| Successfully bound genie_space with an id '[GENIE_SPACE_ID]' | ||
| Run 'bundle deploy' to deploy changes to your workspace | ||
|
|
||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] genie get-space [GENIE_SPACE_ID] | ||
| { | ||
| "parent_path": "/Users/[USERNAME]", | ||
| "title": "test genie space [UNIQUE_NAME]", | ||
| "warehouse_id": "test-warehouse-id" | ||
| } | ||
|
|
||
| >>> [CLI] bundle deployment unbind genie_space1 | ||
| Updating deployment state... | ||
|
|
||
| >>> [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! | ||
|
|
||
| >>> [CLI] genie get-space [GENIE_SPACE_ID] | ||
| { | ||
| "parent_path": "/Users/[USERNAME]", | ||
| "title": "test genie space [UNIQUE_NAME]", | ||
| "warehouse_id": "test-warehouse-id" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| GENIE_SPACE_TITLE="test genie space $UNIQUE_NAME" | ||
|
|
||
| export GENIE_SPACE_TITLE | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| # Create a Genie space out of band, then bind the bundle resource to it. | ||
| GENIE_SPACE_ID=$($CLI genie create-space "test-warehouse-id" '{"version":1}' --title "${GENIE_SPACE_TITLE}" | jq -r '.space_id') | ||
|
|
||
| cleanupRemoveGenieSpace() { | ||
| $CLI genie trash-space "${GENIE_SPACE_ID}" | ||
| } | ||
| trap cleanupRemoveGenieSpace EXIT | ||
|
|
||
| trace $CLI bundle deployment bind genie_space1 "${GENIE_SPACE_ID}" --auto-approve | ||
|
|
||
| # Bind must copy the remote etag into state, so the first plan after bind is | ||
| # clean. Without that, the etag drift signal (empty stored vs remote) would | ||
| # produce a bogus update here. | ||
| trace $CLI bundle plan | ||
|
|
||
| trace $CLI bundle deploy | ||
|
|
||
| trace $CLI genie get-space "${GENIE_SPACE_ID}" | jq --sort-keys '{title, parent_path, warehouse_id}' | ||
|
|
||
| trace $CLI bundle deployment unbind genie_space1 | ||
|
|
||
| trace $CLI bundle destroy --auto-approve | ||
|
|
||
| # Read the Genie space again (expecting it still exists and is not deleted): | ||
| trace $CLI genie get-space "${GENIE_SPACE_ID}" | jq --sort-keys '{title, parent_path, warehouse_id}' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Local = true | ||
|
|
||
| # Genie spaces are only deployed via the direct deployment engine. | ||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
|
|
||
| # Uses a literal warehouse id and a version-sensitive serialized_space, so this | ||
| # lifecycle test runs against the local mock server only (overrides the Cloud=true | ||
| # inherited from acceptance/bundle/deployment/test.toml). | ||
| Cloud = false | ||
|
|
||
| [[Repls]] | ||
| Old = "[0-9a-f]{32}" | ||
| New = "[GENIE_SPACE_ID]" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bundle: | ||
| name: genie-space-generate |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "title": "test genie space", | ||
| "description": "test description", | ||
| "parent_path": "/Workspace/test-$UNIQUE_NAME", | ||
| "warehouse_id": "test-warehouse-id", | ||
| "serialized_space": "{\"tables\":[],\"questions\":[]}" | ||
| } |
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,4 @@ | ||
| { | ||
| "questions": [], | ||
| "tables": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| resources: | ||
| genie_spaces: | ||
| test_genie_space: | ||
| title: "test genie space" | ||
| warehouse_id: test-warehouse-id | ||
| file_path: ../genie_space/test_genie_space.geniespace.json | ||
| description: test description | ||
| parent_path: /Workspace/test-[UNIQUE_NAME] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| >>> [CLI] workspace mkdirs /Workspace/test-[UNIQUE_NAME] | ||
|
|
||
| >>> [CLI] bundle generate genie-space --existing-id [GENIE_SPACE_ID] --genie-space-dir out/genie_space --resource-dir out/resource | ||
| Writing genie space to out/genie_space/test_genie_space.geniespace.json | ||
| Writing configuration to out/resource/test_genie_space.genie_space.yml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| trace $CLI workspace mkdirs /Workspace/test-$UNIQUE_NAME | ||
|
|
||
| # create a genie space to import | ||
| envsubst < genie_space.json.tmpl > genie_space.json | ||
| genie_space_id=$($CLI genie create-space --json @genie_space.json | jq -r '.space_id') | ||
| rm genie_space.json | ||
|
|
||
| trace $CLI bundle generate genie-space --existing-id $genie_space_id --genie-space-dir out/genie_space --resource-dir out/resource |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [[Repls]] | ||
| Old = '\\\\' | ||
| New = '/' | ||
|
|
||
| [[Repls]] | ||
| Old = "[0-9a-f]{32}" | ||
| New = "[GENIE_SPACE_ID]" | ||
|
|
||
| [Env] | ||
| MSYS_NO_PATHCONV = "1" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bundle: | ||
| name: test-bundle |
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,4 @@ | ||
| Error: genie space with ID f00dcafe not found | ||
|
|
||
|
|
||
| Exit code: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Test that bundle generate genie-space fails when the existing ID is not found | ||
| exec $CLI bundle generate genie-space --existing-id f00dcafe |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| bundle: | ||
| name: genie space update inplace | ||
|
|
||
| resources: | ||
| genie_spaces: | ||
| test_genie_space: | ||
| title: "test genie space" | ||
| warehouse_id: "my-warehouse-1234" | ||
| file_path: ./space.geniespace.json |
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,30 @@ | ||
|
|
||
| >>> cat space.geniespace.json | ||
| {} | ||
|
|
||
| === deploy initial genie space | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/genie space update inplace/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === update the genie space | ||
| >>> [CLI] genie update-space [GENIE_SPACE_ID] --serialized-space {"a":"b"} | ||
| { | ||
| "etag": "2", | ||
| "parent_path": "/Users/[USERNAME]/.bundle/genie space update inplace/default/resources", | ||
| "serialized_space": "{\"a\":\"b\"}", | ||
| "space_id": "[GENIE_SPACE_ID]", | ||
| "title": "test genie space", | ||
| "warehouse_id": "my-warehouse-1234" | ||
| } | ||
|
|
||
| === update the genie space file using bundle generate | ||
| >>> [CLI] bundle generate genie-space --resource test_genie_space --force | ||
| Writing genie space to space.geniespace.json | ||
|
|
||
| >>> cat space.geniespace.json | ||
| { | ||
| "a": "b" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| trace cat space.geniespace.json | ||
|
|
||
| title "deploy initial genie space" | ||
| trace $CLI bundle deploy | ||
| genie_space_id=$($CLI bundle summary --output json | jq -r '.resources.genie_spaces.test_genie_space.id') | ||
|
|
||
| title "update the genie space" | ||
| trace $CLI genie update-space $genie_space_id --serialized-space '{"a":"b"}' | ||
|
|
||
| title "update the genie space file using bundle generate" | ||
| trace $CLI bundle generate genie-space --resource test_genie_space --force | ||
|
|
||
| trace cat space.geniespace.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Genie spaces are only deployed via the direct deployment engine. | ||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
|
|
||
| [[Repls]] | ||
| Old = "[0-9a-f]{32}" | ||
| New = "[GENIE_SPACE_ID]" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| genie_spaces: | ||
| foo: | ||
| warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID | ||
| title: test-genie-space-$UNIQUE_NAME | ||
| # Inline (structured) serialized_space is marshalled to a JSON string by | ||
| # ConfigureGenieSpaceSerializedSpace; this config doubles as a regression | ||
| # guard that the normalization produces a drift-free deploy. | ||
| serialized_space: | ||
| version: 1 | ||
| display_name: test-genie-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,22 @@ | ||
| bundle: | ||
| name: deploy-genie-space-inline-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| genie_spaces: | ||
| sales_analytics: | ||
| title: "Sales Analytics Inline Genie" | ||
| description: "Inline serialized_space test" | ||
| warehouse_id: "test-warehouse-id" | ||
| parent_path: /Users/$CURRENT_USER_NAME | ||
| serialized_space: | ||
| version: 1 | ||
| config: | ||
| sample_questions: | ||
| - id: "sq-001" | ||
| question: ["What is the total revenue?"] | ||
| data_sources: | ||
| tables: | ||
| - identifier: "main.sales.orders" | ||
| column_configs: | ||
| - column_name: "amount" | ||
| get_example_values: true |
Uh oh!
There was an error while loading. Please reload this page.
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.
Note to reviewers: All cloud tests are currently disabled, currently doing a couple of runs to spot obvious issues in advance but can be follow-up