Resolve cross-resource references in bundle summary#5639
Conversation
Co-authored-by: Isaac
63ca70e to
64ce952
Compare
Approval status: pending
|
| Jobs: | ||
| foo: | ||
| Name: ${resources.jobs.变量.id} | ||
| Name: [NUMID] |
There was a problem hiding this comment.
could you add replace_ids.py to script so that instead of NUMID we have concrete replacement.
| // from the resolved names. | ||
| mutators = append(mutators, | ||
| mutator.ResolveResourceReferences(), | ||
| mutator.InitializeURLs(), |
There was a problem hiding this comment.
This approach is a bit concerning because it introduces a completely different way to resolve $resources references.
One major difference is that it uses values from config not from the state. This could match but they can also be different if config is changed but not yet deployed.
There could also be other differences simply because it's a completely different approach to resolve these.
Let's explore looking up required fields from the state instead?
Integration test reportCommit: 64ce952
25 interesting tests: 14 SKIP, 7 KNOWN, 4 flaky
Top 20 slowest tests (at least 2 minutes):
|
Changes
bundle summarynow resolves${resources.*}cross-resource references in thereported resource name (and the URL derived from it), instead of printing the
raw reference.
For example, a synced database table whose name embeds another resource's catalog
name:
Before:
After:
The resolution runs in the state-loading path used by
bundle summary(andbundle open), right beforeInitializeURLs, so the URL is derived from theresolved name. References whose target is not known yet (e.g. an output-only
idbefore deployment, or a reference to a field that isn't set) are left untouched
rather than resolved to an empty value or failing the command.
Why
The
resourcesprefix is intentionally excluded from the variable resolutionthat runs during
initializebecause some of those references are only knownafter a resource is deployed. As a result, with the direct engine, a name that
embeds a
${resources...}reference was never resolved back into the config, sobundle summary(including the in-workspace Bundle resources view, which callsbundle summary) showed the raw reference and a broken, percent-encoded URL.Every other resource resolved correctly because their displayed names use
${workspace...}/${var...}references that are resolved during initialize.Tests
bundle/resources/synced_database_tables/summary_resolves_referencescovers the resolution inbundle summarywithout a deployment.TestResolveResourceReferencescovers resolving a known reference and skipping one whose target isn't set.summaryoutput now shows resolved references (synced_database_tables/basic,postgres_synced_tables/basic,resource_deps/unicode_reference,templates/default-python/integration_classic).