Fix Foundry run-mode project restart#15342
Conversation
Ensure the default Foundry ACR is registered in run mode so project provisioning can restore its dependent outputs on restart. Add a regression test covering run-mode default container registry registration for Foundry projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15342Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15342" |
There was a problem hiding this comment.
Pull request overview
Fixes a Foundry project restart failure in run mode by ensuring the default Azure Container Registry (ACR) resource is registered in the distributed application model (so its state/outputs can be restored and persisted across stop/start).
Changes:
- Always registers the default Foundry container registry resource (previously publish-only).
- Adds a regression test verifying default ACR registration in run mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Azure.Tests/FoundryExtensionsTests.cs | Adds a run-mode regression test asserting the default ACR is present and wired to the project. |
| src/Aspire.Hosting.Foundry/Project/ProjectBuilderExtension.cs | Removes publish-mode gating so the default ACR is always added to the model. |
|
Maybe we don't enable this if we are using RunAsFoundryLocal()..? |
|
The transient CI rerun workflow requested reruns for the following jobs after analyzing the failed attempt.
|
Adjust the Foundry run-mode project test to expect the default container registry to be modeled in the app resources now that restart provisioning depends on it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #23228978422 |
Throw a clear InvalidOperationException when AddProject is combined with RunAsFoundryLocal in either order, and add tests covering both unsupported scenarios. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Foundry run-mode project restart Ensure the default Foundry ACR is registered in run mode so project provisioning can restore its dependent outputs on restart. Add a regression test covering run-mode default container registry registration for Foundry projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update Foundry run-mode test expectation Adjust the Foundry run-mode project test to expect the default container registry to be modeled in the app resources now that restart provisioning depends on it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Block Foundry projects on local mode Throw a clear InvalidOperationException when AddProject is combined with RunAsFoundryLocal in either order, and add tests covering both unsupported scenarios. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Fixes a run-mode restart failure for Foundry projects.
When a Foundry project used its default container registry, the registry resource was only added to the app model in publish mode. In run mode, the project still referenced the registry outputs during provisioning and restart, which meant the registry state was never restored or persisted. That caused restart failures such as missing
proj-acroutputs and preventedAzure:Deployments:proj:*state from being written.This change always registers the default Foundry container registry resource and adds a regression test covering run-mode registration.
Validation:
./dotnet.sh test --tl:off tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj -- --filter-method "*.AddProject_AddsDefaultContainerRegistryInRunMode" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"playground/FoundryAgentBasic/FoundryAgentBasic.AppHostusingaspire start/stop/startprojreachesRunningand user secrets now contain bothAzure:Deployments:proj-acr:*andAzure:Deployments:proj:*Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: