Skip to content

Design doc for azd update and auto-update#6910

Open
rajeshkamal5050 wants to merge 1 commit intoAzure:mainfrom
rajeshkamal5050:design/azd-update
Open

Design doc for azd update and auto-update#6910
rajeshkamal5050 wants to merge 1 commit intoAzure:mainfrom
rajeshkamal5050:design/azd-update

Conversation

@rajeshkamal5050
Copy link
Contributor

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

Covers:

  • azd update command with channel switching
  • Auto-update with configurable check intervals
  • Install method-aware update strategies
  • CI/CD detection to skip auto-updates

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.
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.

2 participants