Skip to content

Commit 36084bd

Browse files
denikIsaac
andcommitted
bundle summary/open: show deployed values of ${resources.*} references
Read-only commands that display resources (summary, open, pipelines open/logs/history) loaded only ids from the deployed state, so a name or field that references another resource was shown as the raw reference, and URLs built from such names were broken. Resolve ${resources.*} references in all resources from the referenced resource's state, falling back to explicitly set config fields, before URLs are initialized. References to resources that were never deployed stay as they are. aws: TestAccept/bundle/resources/synced_database_tables/basic TestAccept/bundle/resources/postgres_synced_tables/basic Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 2900ed3 commit 36084bd

13 files changed

Lines changed: 103 additions & 20 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* `bundle summary` and `bundle open` now show the deployed values of `${resources.*}` references in resource names and URLs, instead of the unresolved reference (for example, a synced table named after its catalog). ([#8111](https://github.com/databricks/cli/pull/8111))

‎acceptance/bundle/resource_deps/unicode_reference/output.txt‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ Workspace:
1010

1111
Validation OK!
1212

13+
=== Before deploy, a reference to a job that was not deployed yet stays a reference
14+
15+
>>> [CLI] bundle summary
16+
Name: test-bundle
17+
Target: default
18+
Workspace:
19+
User: [USERNAME]
20+
Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
21+
Resources:
22+
Jobs:
23+
foo:
24+
Name: ${resources.jobs.变量.id}
25+
URL: (not deployed)
26+
变量:
27+
Name: hello
28+
URL: (not deployed)
29+
1330
>>> [CLI] bundle plan
1431
create jobs.foo
1532
create jobs.变量
@@ -32,7 +49,7 @@ Workspace:
3249
Resources:
3350
Jobs:
3451
foo:
35-
Name: ${resources.jobs.变量.id}
52+
Name: [变量_ID]
3653
URL: [DATABRICKS_URL]/jobs/[FOO_ID]?w=[WORKSPACE_ID]
3754
变量:
3855
Name: hello

‎acceptance/bundle/resource_deps/unicode_reference/script‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
title "A unicode resource key passes validate, plan and deploy"
22
trace $CLI bundle validate
3+
4+
title "Before deploy, a reference to a job that was not deployed yet stays a reference"
5+
trace $CLI bundle summary
6+
37
trace $CLI bundle plan
48
trace $CLI bundle deploy
59
replace_ids.py
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Checks that a unicode resource key passes validate, plan and deploy. RecordRequests = false, so the
22
# resolved id of ${resources.jobs.变量.id} is not recorded.
3-
Badness = "After deploy, bundle summary prints job foo's name unresolved, as '${resources.jobs.变量.id}'. This is not specific to unicode keys: synced_database_tables/basic shows the same for ASCII keys. It should print the resolved value."
43
RecordRequests = false

‎acceptance/bundle/resources/materialization_sets/membership/output.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
6767
>>> set_members
6868
[
6969
{
70-
"feature_name": "${resources.features.featb.full_name}",
70+
"feature_name": "main.matset_[UNIQUE_NAME].featb_[UNIQUE_NAME]",
7171
"is_online": null
7272
},
7373
{
74-
"feature_name": "${resources.features.featb.full_name}",
74+
"feature_name": "main.matset_[UNIQUE_NAME].featb_[UNIQUE_NAME]",
7575
"is_online": null
7676
}
7777
]

‎acceptance/bundle/resources/materialization_sets/removal_scope/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
4040
>>> set_members
4141
[
4242
{
43-
"feature_name": "${resources.features.featf2.full_name}",
43+
"feature_name": "main.matset_[UNIQUE_NAME].featf2_[UNIQUE_NAME]",
4444
"is_online": null
4545
}
4646
]

‎acceptance/bundle/resources/postgres_synced_tables/basic/output.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Resources:
2828
Name: Test Project for Synced Table
2929
Postgres synced tables:
3030
my_table:
31-
Name: ${resources.postgres_catalogs.my_catalog.catalog_id}.public.trips_synced
32-
URL: (not deployed)
31+
Name: lakebase_test_[UNIQUE_NAME].public.trips_synced
32+
URL: [DATABRICKS_URL]/explore/data/lakebase_test_[UNIQUE_NAME]/public/trips_synced
3333
Schemas:
3434
pipeline_storage:
3535
Name: pipeline_storage_[UNIQUE_NAME]

‎acceptance/bundle/resources/synced_database_tables/basic/out.summary.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ Resources:
1414
URL: [DATABRICKS_URL]/compute/database-instances/test-db-synced-table-[UNIQUE_NAME]
1515
Synced database tables:
1616
my_synced_table:
17-
Name: ${resources.database_catalogs.my_catalog.name}.${resources.database_catalogs.my_catalog.database_name}.my_synced_table
18-
URL: [DATABRICKS_URL]/explore/data/$%7Bresources.database_catalogs.my_catalog.name%7D.$%7Bresources.database_catalogs.my_catalog.database_name%7D.my_synced_table
17+
Name: my_catalog_[UNIQUE_NAME].my_database.my_synced_table
18+
URL: [DATABRICKS_URL]/explore/data/my_catalog_[UNIQUE_NAME].my_database.my_synced_table

‎acceptance/bundle/resources/synced_database_tables/basic/output.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Resources:
2020
URL: (not deployed)
2121
Synced database tables:
2222
my_synced_table:
23-
Name: ${resources.database_catalogs.my_catalog.name}.${resources.database_catalogs.my_catalog.database_name}.my_synced_table
24-
URL: [DATABRICKS_URL]/explore/data/$%7Bresources.database_catalogs.my_catalog.name%7D.$%7Bresources.database_catalogs.my_catalog.database_name%7D.my_synced_table
23+
Name: my_catalog_[UNIQUE_NAME].my_database.my_synced_table
24+
URL: [DATABRICKS_URL]/explore/data/my_catalog_[UNIQUE_NAME].my_database.my_synced_table
2525

2626
>>> [CLI] bundle validate
2727
Name: deploy-lakebase-synced-table-[UNIQUE_NAME]

‎acceptance/bundle/resources/synced_database_tables/basic/test.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
Cloud = true
2-
Badness = "After deploy, bundle summary prints the synced table's name unresolved, as '${resources.database_catalogs.my_catalog.name}.${resources.database_catalogs.my_catalog.database_name}.my_synced_table', and builds its URL from that string. It should print the resolved name (my_catalog_<name>.my_database.my_synced_table) and a working URL."
32

43
RecordRequests = false
54

0 commit comments

Comments
 (0)