[Feature] azd update command, auto-update, and channel management#6942
[Feature] azd update command, auto-update, and channel management#6942rajeshkamal5050 wants to merge 2 commits intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces an (alpha/hidden) self-update capability for the azd CLI, including channel selection (stable/daily) and an opt-in background stage/apply auto-update flow, with supporting telemetry and CI artifact publishing.
Changes:
- Added
azd update(hidden, alpha-gated) plus update configuration (channel, auto-update, check interval). - Implemented update manager for version checks, downloads, staging/applying binaries, and Windows MSI/package-manager aware update paths.
- Updated startup/version flows: background update checks + optional staging, applied-update banner, channel suffix in
azd version, and added telemetry fields/error mapping.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| eng/pipelines/templates/stages/publish.yml | Publishes version.txt for daily builds to support daily version checks. |
| cli/azd/resources/alpha_features.yaml | Adds update alpha feature toggle entry. |
| cli/azd/pkg/update/manager.go | Core update logic (check/download/stage/apply/replace/verify). |
| cli/azd/pkg/update/manager_test.go | Unit tests for update manager behaviors. |
| cli/azd/pkg/update/config.go | Update config + cache read/write helpers (channel/auto-update/interval). |
| cli/azd/pkg/update/config_test.go | Unit tests for update config + cache compatibility. |
| cli/azd/pkg/update/errors.go | Typed update errors with telemetry result codes. |
| cli/azd/main.go | Startup auto-update apply/stage flow + updated out-of-date banner logic. |
| cli/azd/internal/tracing/fields/fields.go | Adds update-related telemetry attribute keys. |
| cli/azd/internal/cmd/errors.go | Maps UpdateError codes into telemetry errorCode. |
| cli/azd/cmd/update.go | Implements azd update command/action (alpha-gated). |
| cli/azd/cmd/version.go | Adds optional channel suffix display when update alpha enabled. |
| cli/azd/cmd/root.go | Registers the hidden update command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fbdb4c1 to
723509e
Compare
Implements azd update (epic Azure#6721) as a hidden command behind the alpha.update feature toggle (default: off). Features: - Manual update via 'azd update' with install-method-aware strategy (brew/winget/choco delegation, direct binary download for scripts) - Channel switching (stable/daily) with downgrade confirmation - Auto-update: background staging + apply on next startup with re-exec - SHA256 checksum and code signing verification (macOS/Windows) - Elevation-aware auto-update (graceful fallback to warning for system installs, silent apply for user-writable locations) - Daily version tracking via single-line version.txt with build number parsed from the daily.N suffix - CI detection to skip auto-update in pipelines - 13 telemetry error codes integrated into MapError pipeline - azd version shows channel suffix when feature is enabled - Zero behavior change when alpha.update is off Pipeline changes: - Daily publish writes version.txt with full version string - SHA256 checksum generation for binary downloads Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
723509e to
2d57468
Compare
On Linux, os.Create fails with ETXTBSY when overwriting a running executable. Fix copyFile to unlink the old file first (the running process retains its fd via the inode), then create a new file at the same path. If the unlink fails with permission denied (e.g. root-owned directory), return the permission error so ApplyStagedUpdate can trigger the elevation/keep-staged path. Also preserve source file permissions via os.Chmod after remove-then- create, since the new file would otherwise get default 0666 permissions instead of the original executable 0755. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Feature
Adds a hidden and feature-toggled
azd updatecommand for self-updating azd — backgroundupdate checks, staged binary downloads with verification, and channel switching (stable ↔ daily).
Design Doc: #6910
Epic: #6721
Changes
azd updatecommand (cmd/update.go) — Hidden, auto-enables alpha feature on first run. Downloads, verifies, and applies updates.--channelflag for switching between stable/daily with confirmation prompt.pkg/update/manager.go) — Version check via GitHub releases API, download, staged binary verification (codesign on macOS, min size check), and safe file replacement.pkg/update/config.go) —updates.channelandupdates.autoUpdatesettings, gated behindupdatealpha feature flag.main.go) — Background check on every invocation, stages binaries, auto-applies or shows elevation warning on next run.brew upgrade(macOS),winget upgrade/choco upgrade(Windows). Script installs use direct binary replacement.msiexec /iinstead of direct binary replacement.cmd/version.go) — Shows(daily)or(stable)channel suffix, channel-aware "out of date" warnings.internal/tracing/fields/fields.go) — Update outcome, channel, method, error codes.eng/pipelines/) — Publishesversion.txtalongside daily builds.pkg/update/*_test.go) — Covers config, update checking, download, verification, staging, and apply flows.Results Summary
Linux tests: Ran in
golang:1.25Docker container (linux/amd64).E2E Test Details: https://gist.github.com/rajeshkamal5050/d509c03e30a7249a6a4a931ab761a286