Skip to content

Add automatic background CLI updates#14107

Closed
davidfowl wants to merge 2 commits intomainfrom
davidfowl/cli-auto-update
Closed

Add automatic background CLI updates#14107
davidfowl wants to merge 2 commits intomainfrom
davidfowl/cli-auto-update

Conversation

@davidfowl
Copy link
Copy Markdown
Contributor

Summary

Adds automatic background updates for the Aspire CLI to help customers stay on the latest version without manual intervention.

Features

  • Background auto-update: Fire-and-forget update check runs on CLI startup
  • Throttling: Stable channel checks once per 24 hours; daily/staging have no throttle
  • Opt-out: Set ASPIRE_CLI_AUTO_UPDATE_DISABLED=true to disable
  • Safe exclusions: Skips auto-update for:
    • dotnet tool installs (use dotnet tool update instead)
    • PR/hive builds (development builds shouldn't auto-update)
    • When running aspire update --self (avoid double-update)
  • Concurrency safe: Uses named Mutex to prevent concurrent updates across processes

Refactoring

  • Extracted shared CliInstaller used by both UpdateCommand and AutoUpdater
  • Extracted shared CliPlatformDetector for platform detection
  • Fixed backup filename collision by using millisecond timestamps

Testing

  • Added 12 unit tests for AutoUpdater
  • All 796 CLI tests pass

- Add AutoUpdater service that performs fire-and-forget background updates
- Throttle stable channel checks to once per 24 hours (no throttle for daily/staging)
- Skip auto-update for dotnet tool installs, PR/hive builds, and update --self command
- Use named Mutex to prevent concurrent update attempts across processes
- Add ASPIRE_CLI_AUTO_UPDATE_DISABLED env var to opt out

Refactoring:
- Extract shared CliInstaller for UpdateCommand and AutoUpdater
- Extract shared CliPlatformDetector for CliDownloader and AutoUpdater
- Use millisecond timestamps for backup files to avoid collisions
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 24, 2026

🚀 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14107

Or

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 24, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 0eeef57:

Test Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording

📹 Recordings uploaded automatically from CI run #21319705587

@davidfowl davidfowl closed this Feb 4, 2026
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 4, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant