Skip to content

Use channel mappings for integration restore#17636

Closed
sebastienros wants to merge 1 commit into
mainfrom
sebastienros/fix-staging-source-mapping
Closed

Use channel mappings for integration restore#17636
sebastienros wants to merge 1 commit into
mainfrom
sebastienros/fix-staging-source-mapping

Conversation

@sebastienros
Copy link
Copy Markdown
Contributor

Description

TypeScript and other polyglot AppHosts that use the bundled AppHost server can fail to restore Aspire integrations from staging CLI builds when an ambient NuGet.config has package source mappings. In that case, adding the staging/DARC feed as RestoreAdditionalProjectSources is not enough because NuGet still applies the ambient mapping and can route Aspire* packages away from the staging feed.

This changes the project-reference integration restore path to reuse the existing temporary NuGet.config flow for explicit channels, even when --source is not provided. That preserves channel mappings such as Aspire* -> DARC feed while keeping --source override behavior on the stronger override path and preserving the local hive guardrails.

There is no new command syntax. Existing staging-channel TypeScript/polyglot AppHosts should now restore integration packages through the channel mappings that the CLI resolved for the staging build.

Fixes #17629

Validation:

  • ./restore.sh
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method "*.PrebuiltAppHostServerTests.PrepareAsync_WithProjectReferencesAndExplicitChannelButNoOverride_UsesNuGetConfigForChannelMappings" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.PrebuiltAppHostServerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • git diff --check

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Project-reference integration restores now use the explicit channel's temporary NuGet.config when available so staging/DARC package source mappings are honored even without --source.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 23:22
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17636

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17636"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes integration restore for polyglot (e.g., TypeScript) AppHosts using the prebuilt/bundled AppHost server when an ambient NuGet.config has packageSourceMapping that would otherwise exclude the staging/DARC feed. The project-reference restore path now prefers generating and using a temporary NuGet.config so resolved channel mappings (e.g., Aspire* -> staging/DARC) are honored even when --source is not provided.

Changes:

  • Always attempt to create and use a temporary NuGet.config for explicit-channel project-reference restore so channel package source mappings are applied.
  • Update/replace the regression test to assert the generated restore project uses <RestoreConfigFile> and that the temp config contains expected packageSourceMapping entries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs Switches project-reference restore to use a temporary NuGet.config for explicit channels to preserve channel package source mappings.
tests/Aspire.Cli.Tests/Projects/PrebuiltAppHostServerTests.cs Updates regression coverage to validate <RestoreConfigFile> is used and channel mappings are present in the generated temp NuGet.config.

Comment on lines +322 to +325
// Explicit channels need their package source mappings during project-reference restore.
// RestoreAdditionalProjectSources can add the feed URLs, but it cannot override ambient
// packageSourceMapping entries that might route Aspire* packages to another feed.
using var temporaryNuGetConfig = await TryCreateTemporaryNuGetConfigAsync(requestedChannel, packageSourceOverride, cancellationToken);
@sebastienros sebastienros deleted the sebastienros/fix-staging-source-mapping branch May 28, 2026 23:55
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.5 milestone May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

CLI E2E Tests unknown — 107 passed, 0 failed, 2 unknown (commit 3c40701)

View all recordings
Status Test Recording Job Artifacts
AddPackageInteractiveWhileAppHostRunningDetached Recording #78409529072 Logs
AddPackageWhileAppHostRunningDetached Recording #78409529072 Logs
AgentCommands_AllHelpOutputs_AreCorrect Recording #78409529154 Logs
AgentInitCommand_DefaultSelection_InstallsDefaultSkills Recording #78409529154 Logs
AgentInitCommand_MigratesDeprecatedConfig Recording #78409529154 Logs
AgentMcpListStructuredLogsReturnsLogsFromStarterApp Recording #78409528683 Logs
AgentMcpListStructuredLogsReturnsLogsFromStarterApp_DevLocalhost Recording #78409528683 Logs
AgentMcpListStructuredLogsReturnsLogsFromStarterApp_Isolated Recording #78409528683 Logs
AllPublishMethodsBuildDockerImages Recording #78409529096 Logs
AspireAddAndStartWorkAgainstLegacyAppHostTs Recording #78409529276 Logs
AspireAddPackageVersionToDirectoryPackagesProps Recording #78409528948 Logs
AspireInitSingleFileAppHostRunsViaDotnetRunAppHost Recording #78409529204 Logs
AspireInitWithExistingAppHostDirRecreatesMissingNuGetConfigAndPreservesFiles Recording #78409529283 Logs
AspireInitWithSolutionFileGeneratesAppHostThatBuildsAgainstChannelHive Recording #78409529283 Logs
AspireStartUpdatesStaleTypeScriptAppHostPath Recording #78409529067 Logs
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps Recording #78409528948 Logs
AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent Recording #78409528948 Logs
Banner_DisplayedOnFirstRun Recording #78409528844 Logs
Banner_DisplayedWithExplicitFlag Recording #78409528844 Logs
Banner_NotDisplayedWithNoLogoFlag Recording #78409528844 Logs
CertificatesClean_RemovesCertificates Recording #78409529467 Logs
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate Recording #78409529467 Logs
CertificatesTrust_WithUntrustedCert_TrustsCertificate Recording #78409529467 Logs
ConfigSetGet_CreatesNestedJsonFormat Recording #78409529192 Logs
CreateAndRunAspireStarterProject Recording #78409528676 Logs
CreateAndRunAspireStarterProjectWithBundle Recording #78409529365 Logs
CreateAndRunEmptyAppHostProject Recording #78409528900 Logs
CreateAndRunJavaEmptyAppHostProject Recording #78409529166 Logs
CreateAndRunJsReactProject Recording #78409529480 Logs
CreateAndRunPythonReactProject Recording #78409528929 Logs
CreateAndRunTypeScriptEmptyAppHostProject Recording #78409528911 Logs
CreateAndRunTypeScriptStarterProject Recording #78409528684 Logs
CreateJavaAppHostWithViteApp Recording #78409529265 Logs
CreateTypeScriptAppHostWithViteApp_AllowsGuestAppPackageManagerToDiffer Recording #78409529279 Logs
CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain Recording #78409529279 Logs
DashboardRunWithAgentMcpListTracesReturnsNoTraces Recording #78409528743 Logs
DashboardRunWithAgentMcpListTracesReturnsNoTraces_DevLocalhost Recording #78409528743 Logs
DashboardRunWithOtelTracesReturnsNoTraces Recording #78409528743 Logs
DashboardRunWithOtelTracesReturnsNoTraces_DevLocalhost Recording #78409528743 Logs
DeployK8sBasicApiService Recording #78409529499 Logs
DeployK8sWithExternalHelmChart Recording #78409528774 Logs
DeployK8sWithGarnet Recording #78409529038 Logs
DeployK8sWithMongoDB Recording #78409529318 Logs
DeployK8sWithMySql Recording #78409528855 Logs
DeployK8sWithPostgres Recording #78409529168 Logs
DeployK8sWithRabbitMQ Recording #78409529101 Logs
DeployK8sWithRedis Recording #78409529314 Logs
DeployK8sWithSqlServer Recording #78409528638 Logs
DeployK8sWithValkey Recording #78409528729 Logs
DeployTypeScriptAppToKubernetes Recording #78409529150 Logs
DescribeCommandResolvesReplicaNames Recording #78409529053 Logs
DescribeCommandShowsRunningResources Recording #78409529053 Logs
DetachFormatJsonProducesValidJson Recording #78409528694 Logs
DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance Recording #78409528694 Logs
DoPublishAndDeployListStepsWork Recording #78409528989 Logs
DocsCommand_RendersInteractiveMarkdownFromLocalSource Recording #78409529453 Logs
DoctorCommand_DetectsDeprecatedAgentConfig Recording #78409529154 Logs
DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain Recording #78409528749 Logs
DoctorCommand_WithSslCertDir_ShowsTrusted Recording #78409528749 Logs
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted Recording #78409528749 Logs
GatewayWithoutExternalEndpoint_FailsPublishWithGuidance Recording #78409528831 Logs
GeneratedAspireDevScript_StartsWatchMode_WithConfiguredToolchain Recording #78409529279 Logs
GlobalMigration_HandlesCommentsAndTrailingCommas Recording #78409529192 Logs
GlobalMigration_HandlesMalformedLegacyJson Recording #78409529192 Logs
GlobalMigration_PreservesAllValueTypes Recording #78409529192 Logs
GlobalMigration_SkipsWhenNewConfigExists Recording #78409529192 Logs
GlobalSettings_MigratedFromLegacyFormat Recording #78409529192 Logs
IngressWithoutExternalEndpoint_FailsPublishWithGuidance Recording #78409528831 Logs
InitTypeScriptAppHost_AugmentsExistingViteRepoInWorkspaceSubdirectory Recording #78409529279 Logs
InteractiveCSharpInitCreatesExpectedFiles Recording #78409529360 Logs
InvalidAppHostPathWithComments_IsHealedOnRun Recording #78409529203 Logs
JavaScriptHostingApisRunFromTypeScriptAppHost Recording #78409529096 Logs
LatestCliCanStartStableChannelAppHost Recording #78409528676 Logs
LatestCliCanStartStableChannelTypeScriptAppHost Recording #78409528676 Logs
LegacySettingsMigration_AdjustsRelativeAppHostPath Recording #78409529067 Logs
LogsCommandShowsResourceLogs Recording #78409529010 Logs
OtelLogsReturnsStructuredLogsFromStarterApp Recording #78409528788 Logs
OtelLogsReturnsStructuredLogsFromStarterAppIsolated Recording #78409528788 Logs
PsCommandListsRunningAppHost Recording #78409529178 Logs
PsFormatJsonOutputsOnlyJsonToStdout Recording #78409529178 Logs
PublishJavaScriptPatternsGeneratesExpectedDockerComposeArtifacts Recording #78409529214 Logs
PublishWithConfigureEnvFileUpdatesEnvOutput Recording #78409529214 Logs
PublishWithDockerComposeServiceCallbackSucceeds Recording #78409529214 Logs
PublishWithoutOutputPathUsesAppHostDirectoryDefault Recording #78409529214 Logs
ResourceCommand_FailedExecution_DisplaysAppHostLogPathAndLogContainsEntries Recording #78409528696 Logs
ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput Recording #78409528696 Logs
RestoreGeneratesSdkFiles Recording #78409528769 Logs
RestoreGeneratesSdkFiles_WithConfiguredToolchain Recording #78409528779 Logs
RestoreRefreshesGeneratedSdkAfterAddingIntegration Recording #78409528779 Logs
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes Recording #78409529301 Logs
RunFromParentDirectory_UsesExistingConfigNearAppHost Recording #78409529441 Logs
RunReportsSyntaxErrorsForDotNetAppHost Recording #78409528879 Logs
RunReportsSyntaxErrorsForTypeScriptAppHost Recording #78409528879 Logs
SecretCrudOnDotNetAppHost Recording #78409529078 Logs
SecretCrudOnTypeScriptAppHost Recording #78409528924 Logs
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels Recording #78409529176 Logs
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets Recording #78409528784 Logs
StartReportsSyntaxErrorsForDotNetAppHost Recording #78409528879 Logs
StartReportsSyntaxErrorsForTypeScriptAppHost Recording #78409528879 Logs
StopAllAppHostsFromAppHostDirectory Recording #78409528808 Logs
StopJavaPolyglotAppHostUsingApphostDirectory Recording #78409529488 Logs
StopNonInteractiveSingleAppHost Recording #78409528808 Logs
StopTypeScriptPolyglotAppHostUsingApphostDirectory Recording #78409528902 Logs
StopWithNoRunningAppHostExitsSuccessfully Recording #78409529072 Logs
UnAwaitedChainsCompileWithAutoResolvePromises Recording #78409528779 Logs
UpdateProjectChannelToStable_CSharpEmptyAppHost_PreservesAspireConfigChannel Recording #78409528868 Logs
UpdateProjectChannelToStable_CSharpSingleFileInit_PreservesAspireConfigChannel Recording #78409528868 Logs
UpdateProjectChannelToStable_TypeScriptSingleFileInit_PreservesAspireConfigChannel Recording #78409528868 Logs
UpdateProjectChannelToStable_TypeScript_PreviewsStablePackagesAndPreservesChannel Recording #78409528868 Logs

📹 Recordings uploaded automatically from CI run #26608132894

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Staging TypeScript AppHost integration restore adds DARC feed without package source mappings

2 participants