Resolve Lakebase .env values in non-interactive apps init#4740
Draft
Resolve Lakebase .env values in non-interactive apps init#4740
apps init#4740Conversation
Collaborator
|
Commit: f282f3a
20 interesting tests: 7 flaky, 7 SKIP, 6 RECOVERED
Top 20 slowest tests (at least 2 minutes):
|
When running `databricks apps init` with `--set` flags (non-interactive mode), the `.env` file had empty values for PGHOST, PGDATABASE, and LAKEBASE_ENDPOINT. These fields have a `Resolve` property that maps them to values derived from the selected branch. In interactive mode, `PromptForPostgres()` runs the full resolution flow, but in non-interactive mode no resolution logic ran. Extract the resolution logic into a new `ResolvePostgresValues()` function and call it from the non-interactive path after `--set` values are merged. Co-authored-by: Isaac
Extract ResolvePostgresValues from PromptForPostgres to reuse resolution of derived postgres fields (host, databaseName, endpointPath) in the non-interactive/flags code path. Consolidate CollectResources calls. Co-authored-by: Isaac
7538829 to
9f516e6
Compare
b55fc9b to
f282f3a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ResolvePostgresValues()fromPromptForPostgres()so it can be called from the non-interactive code path--setvalues are merged in flags mode, resolve derived postgres fields (host, databaseName, endpointPath) by callingListPostgresEndpointsandListPostgresDatabasesPGHOST,PGDATABASE, andLAKEBASE_ENDPOINTvalues in.envwhen usingdatabricks apps initwith--setflagsRepro command
Rebuild the CLI and run:
dbx apps init --name event-registration \ --features lakebase \ --set "lakebase.postgres.branch=projects/4de10316-dd6f-4606-878e-fdf3189f6766/branches/br-divine-term-y10rpplr" \ --set "lakebase.postgres.database=projects/4de10316-dd6f-4606-878e-fdf3189f6766/branches/br-divine-term-y10rpplr/databases/db-5vqi-xormgdrr0m" \ --description "Event registration app with Lakebase" \ --run none --profile DEFAULT --version 0.20.0Then see if .env has filled
PGHOST,PGDATABASE, andLAKEBASE_ENDPOINT:Test plan
go test ./libs/apps/prompt/... ./cmd/apps/...).envhas populated values forPGHOST,PGDATABASE,LAKEBASE_ENDPOINTThis pull request was AI-assisted by Isaac.