Repository navigation
Use GitHub host configuration for Microsoft init source - #22719
Mitch Denny (mitchdenny) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22719Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22719" |
Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the host-based configuration-source selection change.
No open issues 🎉
What changed in this PR
Narrows Aspire CLI’s automatic Microsoft configuration-source suggestion to a configured msft.ghe.com GitHub host, replacing broad machine and employee detection. Explicit source overrides, consent, and telemetry detection remain unchanged.
Changes:
- Adds direct
hosts.ymlparsing andGH_HOSTsupport, following GitHub CLI’s configuration-directory precedence without invokinggh. - Separates configuration-source detection from telemetry detection and updates service registration.
- Adds detector tests, adapts command tests, and documents the new selection behavior.
| File | Description |
|---|---|
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs |
Registers separate configuration-source and telemetry test detectors. |
tests/Aspire.Cli.Tests/TestServices/TestConfigSourceServices.cs |
Adapts the shared fake to host-based detection. |
tests/Aspire.Cli.Tests/Configuration/ConfigSourceServiceTests.cs |
Verifies host configuration controls selection independently of telemetry heuristics. |
tests/Aspire.Cli.Tests/Configuration/ConfigSourceDetectorTests.cs |
Covers host matching, path precedence, malformed YAML, configuration changes, and cancellation. |
tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.SourceList.cs |
Updates source-list tests to use the new detector. |
tests/Aspire.Cli.Tests/Commands/NewCommandLocalTemplateTests.InitConfig.cs |
Updates template-consent tests to use host-based detection. |
tests/Aspire.Cli.Tests/Commands/ConfigSourceCommandTests.cs |
Updates detector registration and assertions across command scenarios. |
src/Aspire.Cli/Program.cs |
Registers the configuration-source detector. |
src/Aspire.Cli/Configuration/ConfigSourceService.cs |
Uses host detection when selecting the Microsoft default source. |
src/Aspire.Cli/Configuration/ConfigSourceDetector.cs |
Implements host detection, configuration-path resolution, and safe failure logging. |
src/Aspire.Cli/Aspire.Cli.csproj |
Adds YamlDotNet for parsing host configuration. |
docs/specs/cli-config-sources.md |
Defines host-based selection and configuration-directory precedence. |
docs/specs/cli-config-sources-1p-scenarios.md |
Updates developer scenarios for host-based suggestions. |
Review effort: Balanced
…ctory Co-authored-by: Copilot App <[email protected]>
Tests selector3 / 101 PR test projects · 4 PR jobs, from 11 changed files. Selected PR test projects (3 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed📦 affected project 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
4b2c977d66921fcd9e99dd4c1f8cb5889c32828e↑ Missing or relative gh config directories disable detection instead of reading the working directory.
↑ Host matching, platform path precedence, consent and overrides are covered.
↓ Published PR artifact and Windows/Linux execution remain unverified.
Description
Narrow the automatic Microsoft init-source suggestion during
aspire newto a configuredmsft.ghe.comGitHub CLI host, instead of broad machine and organization heuristics. The CLI readshosts.ymldirectly, honors GitHub CLI's configuration directory precedence andGH_HOST, and does not invokeghor inspect credentials. If no absolute config directory can be resolved from the environment, detection is disabled rather than falling back to the working directory. Explicit source overrides and consent remain unchanged; telemetry detection is unaffected.User-facing usage
Running
aspire newproposes the Microsoft source whenmsft.ghe.comis present in GitHub CLI's host configuration orGH_HOST=msft.ghe.com. Users can still select a different source withASPIRE_INIT_SOURCE_URLor decline the proposed source with--use-config-source false.Validation
./restore.sh— passed after merging main.dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ConfigSourceDetectorTests" --filter-class "*.ConfigSourceServiceTests" --filter-class "*.ConfigSourceCommandTests" --filter-class "*.NewCommandLocalTemplateTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"— passed, 906 tests after merging main.dotnet build src/Aspire.Cli/Aspire.Cli.csproj— passed before merging main; current sources were rebuilt by the test run.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?