Skip to content

[design] azd update command, auto-update, and channel management#6910

Open
rajeshkamal5050 wants to merge 6 commits intoAzure:mainfrom
rajeshkamal5050:design/azd-update
Open

[design] azd update command, auto-update, and channel management#6910
rajeshkamal5050 wants to merge 6 commits intoAzure:mainfrom
rajeshkamal5050:design/azd-update

Conversation

@rajeshkamal5050
Copy link
Contributor

@rajeshkamal5050 rajeshkamal5050 commented Feb 26, 2026

Design doc for azd update command, auto-update, and channel management.

Covers:

  • azd update command with channel switching
  • Auto-update with two-phase stage/apply flow
  • Staged binary verification (codesign check to catch truncated downloads)
  • Install method-aware update strategies (brew/winget/choco delegation, direct binary for scripts)
  • Channel switch confirmation prompt (bidirectional, not just downgrade)
  • CI/CD detection to skip auto-updates
  • Update banner suppression during azd update and azd config
  • Duplicate WARNING prevention (elevation warning suppresses out-of-date banner)
  • azd version channel suffix derived from binary version string
  • Telemetry with 13 result codes integrated into MapError pipeline
  • Alpha feature toggle (alpha.update, default off) for safe rollout

Epic: #6721

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a draft design document describing the proposed azd update command, opt-in auto-update behavior, and stable/daily channel management as part of Epic #6721.

Changes:

  • Introduces a new design doc covering update command UX, configuration keys, and channel switching behavior.
  • Documents install-method-aware update strategies (package manager vs direct binary replace) and elevation handling.
  • Proposes daily build version tracking (build number) and an expanded update-check cache format.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 213 to 216
cmd := exec.Command("sudo", "mv", stagedBinary, currentBinaryPath)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says to use the existing CommandRunner for elevation (sudo), but the snippet uses exec.Command directly. Consider rewriting the example to use CommandRunner (or label it as simplified pseudocode) so the guidance doesn’t conflict with the intended implementation approach.

Suggested change
cmd := exec.Command("sudo", "mv", stagedBinary, currentBinaryPath)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// commandRunner is configured to pass through stdin/stdout/stderr so sudo
// can prompt the user for their password as usual.
err := commandRunner.Run(ctx, "sudo", "mv", stagedBinary, currentBinaryPath)
if err != nil {
// handle error
}

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +40
| Installer | Value | Default Location |
|-----------|-------|------------------|
| Bash script | `install-azd.sh` | `/opt/microsoft/azd/` |
| PowerShell script | `install-azd.ps1` | `C:\Program Files\Azure Dev CLI\` (customizable via `-InstallFolder`) |
| Homebrew | `brew` | Homebrew prefix (e.g., `/usr/local/Cellar/azd/`) |
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown table syntax here uses a double leading pipe (e.g., || Installer | ...), which renders as an extra empty column in most markdown renderers. Consider changing to a single leading pipe (| Installer | ...) for correct formatting (same pattern appears in other tables in this doc).

Copilot uses AI. Check for mistakes.
Comment on lines +116 to +120
Two new config keys via `azd config`:

```bash
azd config set updates.autoUpdate on # or "off" (default: off)
```
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says “Two new config keys via azd config:” but the example only shows updates.autoUpdate. Since the design also introduces updates.checkIntervalHours (and persists updates.channel), update the text to reflect the full set of keys or adjust it to match what’s being proposed.

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +58
- **Logic**: `main.go` → `fetchLatestVersion()` — async check at startup, cached in `~/.azd/update-check.json`
- **Skip**: `AZD_SKIP_UPDATE_CHECK=true` disables the check
- Already shows platform-specific upgrade instructions based on install method

**Current cache format** (`~/.azd/update-check.json`):
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache location is described as ~/.azd/update-check.json, but the code uses config.GetUserConfigDir() which can be overridden via AZD_CONFIG_DIR. Consider describing it as {AZD_CONFIG_DIR or ~/.azd}/update-check.json to avoid documenting an incorrect path.

Suggested change
- **Logic**: `main.go``fetchLatestVersion()` — async check at startup, cached in `~/.azd/update-check.json`
- **Skip**: `AZD_SKIP_UPDATE_CHECK=true` disables the check
- Already shows platform-specific upgrade instructions based on install method
**Current cache format** (`~/.azd/update-check.json`):
- **Logic**: `main.go``fetchLatestVersion()` — async check at startup, cached in `{AZD_CONFIG_DIR or ~/.azd}/update-check.json`
- **Skip**: `AZD_SKIP_UPDATE_CHECK=true` disables the check
- Already shows platform-specific upgrade instructions based on install method
**Current cache format** (`{AZD_CONFIG_DIR or ~/.azd}/update-check.json`):

Copilot uses AI. Check for mistakes.
Comment on lines 234 to 238
Startup (every azd invocation):
1. Check AZD_SKIP_UPDATE_CHECK / CI env vars → skip if set
2. Check non-interactive terminal → skip if detected
3. Background goroutine: check version (respecting channel-dependent cache TTL)
4. If newer version available → download to ~/.azd/staging/
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto-update flow includes “Check non-interactive terminal → skip if detected”, but the explicit skip list later only mentions CI / --no-prompt / AZD_SKIP_UPDATE_CHECK. Please align these two sections by adding the non-interactive/TTY condition to the list (and defining detection) or removing it from the flow.

Copilot uses AI. Check for mistakes.
rajeshkamal5050 and others added 3 commits February 26, 2026 22:52
- Daily version format: single-line 1.24.0-beta.1-daily.5935787
- Code signing verification (macOS codesign, Windows Authenticode)
- Elevation-aware auto-update with graceful fallback
- Alpha feature toggle (alpha.update) for safe rollout
- Telemetry fields and error codes including codeSignatureInvalid
- Two-phase auto-update flow (stage + apply with re-exec)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Channel switch: bidirectional confirmation prompt (not just downgrade)
- Cancellation UX: plain message instead of SUCCESS banner
- Staged binary verification: codesign check before apply
- copyFile fsync: flush data to disk to prevent corruption
- Duplicate WARNING suppression: elevation warning suppresses out-of-date banner
- Banner suppression for azd update and azd config commands
- Fix telemetry code: update.signatureInvalid (not codeSignatureInvalid)
- Version output: shows (daily) not (daily, build N), derived from binary

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rajeshkamal5050 rajeshkamal5050 changed the title Design doc for azd update and auto-update [design] azd update command, auto-update, and channel management Feb 27, 2026
rajeshkamal5050 and others added 2 commits February 27, 2026 19:17
…idance

- Remove SHA256 checksum step (HTTPS provides integrity)
- Windows: use MSI installer instead of direct binary replacement
- Brew: document delegation to brew commands, no direct overwrite
- Add update method column to elevation table

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants