Skip to content

Commit 581975e

Browse files
committed
Fixed bind and unbind for non-Terraform resources
1 parent adfdee6 commit 581975e

File tree

14 files changed

+209
-5
lines changed

14 files changed

+209
-5
lines changed
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+
catalogs:
6+
foo:
7+
name: test-catalog-$UNIQUE_NAME
8+
comment: This is a test catalog

acceptance/bundle/deployment/bind/catalog/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] catalogs create test-catalog-[UNIQUE_NAME]
3+
{
4+
"comment": null,
5+
"name": "test-catalog-[UNIQUE_NAME]"
6+
}
7+
8+
>>> [CLI] bundle deployment bind foo test-catalog-[UNIQUE_NAME] --auto-approve
9+
Updating deployment state...
10+
Successfully bound catalog with an id 'test-catalog-[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] catalogs get test-catalog-[UNIQUE_NAME]
21+
{
22+
"comment": "This is a test catalog",
23+
"name": "test-catalog-[UNIQUE_NAME]"
24+
}
25+
26+
=== Unbind catalog
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 catalog again (expecting it still exists):
38+
>>> [CLI] catalogs get test-catalog-[UNIQUE_NAME]
39+
{
40+
"comment": "This is a test catalog",
41+
"name": "test-catalog-[UNIQUE_NAME]"
42+
}
43+
44+
=== Test cleanup
45+
>>> [CLI] catalogs delete test-catalog-[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 catalogs delete "test-catalog-$UNIQUE_NAME"
4+
echo $?
5+
}
6+
trap cleanup EXIT
7+
8+
envsubst < databricks.yml.tmpl > databricks.yml
9+
10+
trace $CLI catalogs create "test-catalog-$UNIQUE_NAME" | jq '{comment, name}'
11+
12+
trace $CLI bundle deployment bind foo "test-catalog-$UNIQUE_NAME" --auto-approve
13+
14+
title "Deploy bundle"
15+
trace $CLI bundle deploy --force-lock --auto-approve
16+
17+
trace $CLI catalogs get "test-catalog-$UNIQUE_NAME" | jq '{comment, name}'
18+
19+
title "Unbind catalog"
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 catalog again (expecting it still exists): "
26+
trace $CLI catalogs get "test-catalog-$UNIQUE_NAME" | jq '{comment, name}'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Local = true
2+
Cloud = false
3+
4+
Ignore = [
5+
".databricks",
6+
"databricks.yml",
7+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bundle:
2+
name: test-bundle-$UNIQUE_NAME
3+
4+
resources:
5+
external_locations:
6+
test_location:
7+
name: test-location-$UNIQUE_NAME
8+
url: s3://test-bucket/path-dabs
9+
credential_name: test_storage_credential
10+
comment: "Test external location from DABs"

acceptance/bundle/deployment/bind/external_location/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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
>>> [CLI] external-locations create test-location-[UNIQUE_NAME] s3://test-bucket/path test_storage_credential
3+
{
4+
"name": "test-location-[UNIQUE_NAME]",
5+
"url": "s3://test-bucket/path",
6+
"credential_name": "test_storage_credential"
7+
}
8+
9+
>>> [CLI] bundle deployment bind test_location test-location-[UNIQUE_NAME] --auto-approve
10+
Updating deployment state...
11+
Successfully bound external_location with an id 'test-location-[UNIQUE_NAME]'
12+
Run 'bundle deploy' to deploy changes to your workspace
13+
14+
=== Deploy bundle
15+
>>> [CLI] bundle deploy --force-lock --auto-approve
16+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
17+
Deploying resources...
18+
Updating deployment state...
19+
Deployment complete!
20+
21+
>>> [CLI] external-locations get test-location-[UNIQUE_NAME]
22+
{
23+
"name": "test-location-[UNIQUE_NAME]",
24+
"url": "s3://test-bucket/path-dabs",
25+
"credential_name": "test_storage_credential"
26+
}
27+
28+
=== Unbind external location
29+
>>> [CLI] bundle deployment unbind test_location
30+
Updating deployment state...
31+
32+
=== Destroy bundle
33+
>>> [CLI] bundle destroy --auto-approve
34+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
35+
36+
Deleting files...
37+
Destroy complete!
38+
39+
=== Read the pre-defined external location again (expecting it still exists):
40+
>>> [CLI] external-locations get test-location-[UNIQUE_NAME]
41+
{
42+
"name": "test-location-[UNIQUE_NAME]",
43+
"url": "s3://test-bucket/path-dabs",
44+
"credential_name": "test_storage_credential"
45+
}
46+
47+
=== Test cleanup
48+
>>> [CLI] external-locations delete test-location-[UNIQUE_NAME]
49+
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 external-locations delete "test-location-$UNIQUE_NAME"
4+
echo $?
5+
}
6+
trap cleanup EXIT
7+
8+
envsubst < databricks.yml.tmpl > databricks.yml
9+
10+
trace $CLI external-locations create "test-location-$UNIQUE_NAME" "s3://test-bucket/path" "test_storage_credential" | jq '{name, url, credential_name}'
11+
12+
trace $CLI bundle deployment bind test_location "test-location-$UNIQUE_NAME" --auto-approve
13+
14+
title "Deploy bundle"
15+
trace $CLI bundle deploy --force-lock --auto-approve
16+
17+
trace $CLI external-locations get "test-location-$UNIQUE_NAME" | jq '{name, url, credential_name}'
18+
19+
title "Unbind external location"
20+
trace $CLI bundle deployment unbind test_location
21+
22+
title "Destroy bundle"
23+
trace $CLI bundle destroy --auto-approve
24+
25+
title "Read the pre-defined external location again (expecting it still exists): "
26+
trace $CLI external-locations get "test-location-$UNIQUE_NAME" | jq '{name, url, credential_name}'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Local = true
2+
Cloud = false
3+
4+
Ignore = [
5+
".databricks",
6+
"databricks.yml",
7+
]

0 commit comments

Comments
 (0)