Repository navigation
Fix Foundry hosted agent endpoint resolution - #16797
Conversation
Resolve hosted-agent environment endpoint references through compute environment deployment expressions during publish so aspire deploy does not wait on endpoint allocation snapshots. Throw for unsupported internal referenced endpoints and add regression coverage for direct and nested endpoint expressions. Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16797Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16797" |
There was a problem hiding this comment.
Pull request overview
This PR fixes PublishAsHostedAgent(...) hanging during aspire deploy by making hosted-agent environment-variable resolution publish-aware, resolving endpoint-related values via the target compute environment’s deployed endpoint expressions (rather than waiting on runtime endpoint allocation snapshots).
Changes:
- Added
IComputeEnvironmentResource.GetEndpointPropertyExpression(...)with a default implementation, plus Azure Container Apps and App Service overrides for publish-time endpoint properties. - Updated Foundry hosted agent environment variable resolution to correctly handle
EndpointReference,EndpointReferenceExpression, and nestedReferenceExpressionvalues in publish mode (and to fail fast for internal-only endpoints). - Added unit tests covering default/ACA/App Service endpoint property expressions and hosted-agent publish-time resolution scenarios.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/ComputeEnvironmentValidationTests.cs | Adds tests for the default compute-environment endpoint property expression behavior (including failure case for custom schemes without ports). |
| tests/Aspire.Hosting.Azure.Tests/FoundryExtensionsTests.cs | Adds publish-mode tests validating hosted-agent environment variable resolution for external ACA endpoints and reference/endpoint expressions. |
| tests/Aspire.Hosting.Azure.Tests/AzureContainerAppsTests.cs | Adds tests for ACA-specific endpoint property expression behavior in publish mode. |
| tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs | Adds tests for App Service-specific endpoint property expression behavior in publish mode. |
| src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs | Introduces new (experimental) public API for resolving deployed endpoint properties via compute environments. |
| src/Aspire.Hosting.Foundry/HostedAgent/AzureHostedAgentResource.cs | Implements publish-aware environment variable resolution for hosted agents to avoid hangs on allocated-endpoint snapshots. |
| src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs | Overrides endpoint property expression resolution to match App Service deployed endpoint semantics. |
| src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppEnvironmentResource.cs | Overrides endpoint property expression resolution to match Azure Container Apps deployed endpoint semantics. |
Fix endpoint resolution diagnostics, reuse the shared formatting helper, keep upgraded endpoint TLS values consistent with the effective scheme, and document endpoint property resolution behavior. Co-authored-by: Copilot <[email protected]>
Clarify that compute environment endpoint property expressions are generally useful whenever callers need environment-specific reference expressions, not only for deployment publishers. Co-authored-by: Copilot <[email protected]>
|
/backport to release/13.3 |
|
Started backporting to |
|
A follow up to add the new api to test polyglot apphosts will be necessary |
Is the existing |
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
|
🎬 CLI E2E Test Recordings — 76 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25406750024 |
|
No documentation PR is required for this change. This is a bug fix that corrects
|
* Fix hosted agent endpoint resolution Resolve hosted-agent environment endpoint references through compute environment deployment expressions during publish so aspire deploy does not wait on endpoint allocation snapshots. Throw for unsupported internal referenced endpoints and add regression coverage for direct and nested endpoint expressions. Co-authored-by: Copilot <[email protected]> * Address hosted agent review comments Fix endpoint resolution diagnostics, reuse the shared formatting helper, keep upgraded endpoint TLS values consistent with the effective scheme, and document endpoint property resolution behavior. Co-authored-by: Copilot <[email protected]> * Refine endpoint property documentation Clarify that compute environment endpoint property expressions are generally useful whenever callers need environment-specific reference expressions, not only for deployment publishers. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
Description
PublishAsHostedAgent(...)resolved target environment variables through context-free value providers, which could wait forever on endpoint allocation snapshots duringaspire deploywhen a hosted agent referenced an Azure Container Apps endpoint. This change makes hosted-agent environment resolution publish-aware: endpoint values are resolved through the target compute environment's deployed endpoint expressions, including nestedReferenceExpressionvalues and directEndpointReferenceExpressionvalues.The change adds a default
IComputeEnvironmentResource.GetEndpointPropertyExpression(...)implementation plus Azure Container Apps and App Service overrides so publish-time endpoint URL, host, port, scheme, and host-and-port behavior stays aligned with those environments. Referenced internal endpoints now fail fast with an actionable exception instead of hanging.Fixes #16608
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: