Fix PR channel version selection in Aspire CLI#16125
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16125Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16125" |
There was a problem hiding this comment.
Pull request overview
This PR fixes version drift when the Aspire CLI is running against PR hives / pr-* channels by preferring the currently installed CLI version during template and package selection, preventing mismatched stable vs PR-build dependencies.
Changes:
- Prefer the current CLI/SDK version when resolving templates/packages from
pr-*channels (and when PR hives are present foraspire add). - Add unit tests covering
aspire new,aspire init, andaspire addPR-channel/PR-hive selection behavior. - Extend a shared test
IPackagingServicehelper to allow test-controlled channel enumeration.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/TestServices/TestPackagingService.cs | Adds a callback hook to control GetChannelsAsync in tests. |
| tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs | Adds coverage ensuring PR channel selects the current CLI version without prompting. |
| tests/Aspire.Cli.Tests/Commands/InitCommandTests.cs | Adds coverage ensuring PR channel selects the current CLI version without prompting. |
| tests/Aspire.Cli.Tests/Commands/AddCommandTests.cs | Adds coverage ensuring PR hives cause add to prefer the current CLI version. |
| src/Aspire.Cli/Utils/VersionHelper.cs | Introduces IsPrChannel helper for consistent PR-channel detection. |
| src/Aspire.Cli/Templating/DotNetTemplateFactory.cs | Prefers current CLI version when selecting templates from pr-* channels. |
| src/Aspire.Cli/Commands/NewCommand.cs | Prefers current CLI version when resolving template version from a pr-* channel. |
| src/Aspire.Cli/Commands/InitCommand.cs | Prefers current CLI version when selecting templates from pr-* channels. |
| src/Aspire.Cli/Commands/AddCommand.cs | Prefers current CLI version for integration packages when PR hives are present. |
|
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.
|
|
/deployment-test |
1 similar comment
|
/deployment-test |
|
🚀 Deployment tests starting on PR #16125... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
/deployment-test |
|
🚀 Deployment tests starting on PR #16125... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
🚀 Deployment tests starting on PR #16125... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
|
🚀 Deployment tests starting on PR #16125... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
Documentation Check ✅No documentation PR is required for this change. Reason: This is an internal bug fix for PR channel version selection in the Aspire CLI build infrastructure. All changes are in internal CLI command implementations (
|
|
❌ Deployment E2E Tests failed — 26 passed, 1 failed, 0 cancelled View test results and recordings
|
Description
PR-built CLI installs can see both stable feed results and PR hive packages at the same time. That let
aspire add,aspire new, andaspire initdrift to a stable or latest version instead of the exact PR build version, which caused mismatches like stable AppHost package requests against prerelease-only PR hives.This change prefers the current CLI version whenever a
pr-*channel or PR hive is in play across package and template selection. It updates the shared .NET template selection path as well, adds focused unit coverage foradd,new, andinit, and reuses the shared test packaging helper instead of another file-local implementation.Fixes # N/A
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: