Add OS information to aspire doctor - #18252
Conversation
Report operating system details as an Environment check in aspire doctor, including structured JSON metadata and Linux distro information from /etc/os-release. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18252Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18252" |
There was a problem hiding this comment.
Pull request overview
This PR adds an "Operating system" environment check to the aspire doctor command. The new OperatingSystemCheck reports the current OS in both human-readable and JSON output, covering Windows, macOS, and Linux (with distro details from /etc/os-release). The check is registered at order 10 (after the Aspire version check but before WSL diagnostics), and results include structured metadata (osType, displayName, version, description) for tooling consumption.
Changes:
- New
OperatingSystemCheckclass implementingIEnvironmentCheck, with platform-specific detail builders and os-release parsing for Linux. - Unit tests (
OperatingSystemCheckTests) and integration test updates (DoctorCommandTests) validating the new check's output and JSON shape. - Resource strings (
.resx,.Designer.cs, 13.xlffiles) and documentation (cli-output-formats.md) updated to reflect the new check.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Cli/Utils/EnvironmentChecker/OperatingSystemCheck.cs |
New environment check: detects OS, parses Linux /etc/os-release, normalizes distro names, builds JSON metadata |
src/Aspire.Cli/Program.cs |
Registers OperatingSystemCheck as a singleton IEnvironmentCheck |
src/Aspire.Cli/Resources/DoctorCommandStrings.resx |
Adds OperatingSystemMessageFormat resource string |
src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs |
Auto-generated accessor for the new resource string |
src/Aspire.Cli/Resources/xlf/DoctorCommandStrings.*.xlf (13 files) |
XLF localization entries for all supported languages |
tests/Aspire.Cli.Tests/Commands/OperatingSystemCheckTests.cs |
Unit tests for OS detail creation, os-release parsing, and unquoting |
tests/Aspire.Cli.Tests/Commands/DoctorCommandTests.cs |
Integration test verifying OS check appears in JSON output; helper updated to register OperatingSystemCheck |
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs |
Registers OperatingSystemCheck in the shared test service collection |
docs/specs/cli-output-formats.md |
Documents the new operating-system check in the JSON output spec |
Files not reviewed (1)
- src/Aspire.Cli/Resources/DoctorCommandStrings.Designer.cs: Generated file
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Strip only matching quotes from os-release values and leave interior escapes unchanged because the values are displayed, not executed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove shell escape markers from double-quoted os-release values before showing them in doctor output while leaving single-quoted values literal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Treat backslash as a generic display escape marker in double-quoted os-release values instead of only handling a small set of example escapes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
PR Testing ReportPR Information
Artifact Version Verification
Changes AnalyzedFiles Changed
Change Categories
Test Scenarios ExecutedScenario 1: Artifact version verificationObjective: Verify the dogfood CLI artifacts match the latest PR commit. Steps:
Evidence:
Scenario 2: Linux doctor JSON outputObjective: Verify Steps:
Evidence:
Observations:
Scenario 3: Linux human-readable doctor outputObjective: Verify the human-readable doctor output includes the new OS row. Steps:
Evidence:
Scenario 4: Template smoke with PR CLIObjective: Verify the PR CLI can create a fresh app from the PR hive and report OS information from the generated file-based AppHost project context. Steps:
Evidence:
Observations:
Scenario 5: Local host smokeObjective: Verify the PR CLI reports OS information on the local macOS host as well as in Linux/container mode. Steps:
Evidence:
Observations:
Summary
Overall Result✅ PR VERIFIED Recommendations
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Posted 2 review comments.
Summary:
- Correctness: 1 issue in
OperatingSystemCheckunescape logic can alter validos-releasevalues. - Test coverage/contract: 1 issue in
OperatingSystemCheckTestscurrently codifies the broad unescape behavior.
Requested action in each comment: either fix, or explain why current behavior is safe; if behavior is changed, add/update tests accordingly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add documentation for the new operating system check introduced in microsoft/aspire#18252. The check appears in the Environment section of `aspire doctor` output and includes structured metadata in JSON format. Changes: - Update Environment checks description to mention OS reporting - Add OS check to sample table output - Add operating-system entry to JSON output example - Document the osType/displayName/version/description metadata fields Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1267
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1267 targeting Updated Note This draft PR needs human review before merging. |
Description
aspire doctorshould make basic host environment details easy to inspect alongside the existing SDK, container, certificate, and configuration checks. This adds an Environment check that reports the current operating system in both human-readable and JSON output.The check reports high-level Windows/macOS names with the OS version, and includes Linux distro details from
/etc/os-releasewhen available. JSON output includes structured metadata for tooling:osType,displayName,version, anddescription.User-facing usage
Human-readable output includes the OS row in the Environment section:
JSON output includes the same check:
{ "category": "environment", "name": "operating-system", "status": "pass", "message": "Operating system: Linux Ubuntu 24.04", "metadata": { "osType": "Linux", "displayName": "Linux Ubuntu", "version": "24.04", "description": "Ubuntu 24.04.2 LTS" } }Validation:
dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.OperatingSystemCheckTests" --filter-class "*.DoctorCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet build /t:UpdateXlf src/Aspire.Cli/Aspire.Cli.csprojaspire doctor --format jsonFixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?