feat: prompt for unresolved network env vars during provision#9025
Draft
huimiu wants to merge 2 commits into
Draft
feat: prompt for unresolved network env vars during provision#9025huimiu wants to merge 2 commits into
huimiu wants to merge 2 commits into
Conversation
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.
Why
Before the unified
azure.yaml, unresolved${VAR}references that backed required infra parameters were prompted for at provision time by core azd's Bicep provider. After moving Foundry provisioning to the extension's in-memory synthesizer (internal/synthesis), an unresolved${VAR}in a service'snetwork:block now hard-errors withunresolved environment variable ${VAR}instead of prompting — a regression in interactive UX.This restores prompting on the provision path while keeping CI/CD deterministic.
What
resolveVarsnow returns a typedsynthesis.UnresolvedEnvVarError{Name}(sameError()string as before) so callers can detect it witherrors.As. Field-context wrapping via%wis preserved.Initializenow runs synthesis throughsynthesizeWithEnvPrompt, a bounded prompt-and-retry loop. On an unresolved network${VAR}it prompts for the value, persists it viaazd env set, adds it to the env map, and retries. Values entered are saved so later runs andazd env get-valuessee them.--no-prompt/ CI/CD: when the host reports "prompt required", the loop returns an actionable dependency error naming the variable (run \azd env set VAR ``), mirroring the existing subscription/location handling. Cancellation is handled the same way.Resolution order is unchanged: azd environment → process environment → prompt (only when neither has it).
Scope / notes
network:block${VAR}refs (peSubnet/agentSubnet vnet,dns.subscription) — the only fields the synthesizer resolves.--infra,PreserveVarRefs: true) is untouched:${VAR}still passes through verbatim.endpoint:) and on-disk./infra/Bicep paths are unaffected.environment_variables:${VAR}(resolved at deploy, pushed to the agent container) is not covered here — deploy currently substitutes unset refs to empty silently. That's a separate follow-up.Tests
TestSynthesize_UnresolvedVarIsTyped— assertserrors.Asextracts*UnresolvedEnvVarErrorwith the name.TestSynthesizeWithEnvPrompt_NoClientSurfacesActionableError— the no-client/--no-promptpath yields an actionable dependency error naming the variable.Draft — opening for design feedback on placement (Initialize vs. a dedicated pre-provision step) and on whether we also want a matching deploy-time check for
environment_variables.