{Packaging} Fix cask template and az upgrade for preview and homebrew-cask migration#33168
{Packaging} Fix cask template and az upgrade for preview and homebrew-cask migration#33168naga-nandyala wants to merge 3 commits intoAzure:devfrom
az upgrade for preview and homebrew-cask migration#33168Conversation
…oduction During the preview phase (Plan B), the cask is distributed as `azure-cli-preview` via a custom tap, while post-migration it becomes `azure-cli` in homebrew-cask. The `az upgrade` command now checks which cask token is installed and upgrades accordingly.
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
Updates az upgrade (util command module) to correctly upgrade Azure CLI when installed via Homebrew cask during the preview-to-production transition, by selecting the installed cask token before running brew upgrade.
Changes:
- Detect whether
azure-cli-previewis installed via Homebrew cask and select the appropriate cask token. - Use the detected cask token when invoking
brew upgrade --cask ...forHOMEBREW_CASKinstalls.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…x completion ordering
az upgrade: Detect correct cask token for preview vs productionaz upgrade for homebrew-cask migration (Plan B)
…d narrower exception handling Address Copilot review feedback: - Check both azure-cli-preview and azure-cli cask tokens explicitly - Fail early with UPGRADE_MSG if neither cask is installed - Catch OSError instead of broad Exception, with debug logging
az upgrade for homebrew-cask migration (Plan B)az upgrade for preview and homebrew-cask migration
Summary
Two packaging fixes for the upcoming homebrew-cask migration (Plan B):
1.
az upgrade: Detect correct cask token for preview vs productionThe current
az upgradehardcodesbrew upgrade --cask azure-cli. Under Plan B, preview users install via theazure-cli-previewcask token (from custom tapAzure/homebrew-azure-cli). This fix adds runtime detection soaz upgradeuses the correct token.Change:
src/azure-cli/azure/cli/command_modules/util/custom.pyazure-cli-previewcask is installed viabrew list --cask azure-cli-previewazure-cli-previewas the cask token; otherwise default toazure-cli2. Fix cask definition template (
azure-cli.rb.in)Fixes discovered during Homebrew PR #257931:
Change:
scripts/release/macos/templates/azure-cli.rb.inos macos: "macos"stanza — caused Homebrew CI to simulate Linux tags, resulting insha256: nilaudit failuremacosin URL — replaced#{os}interpolation sinceosstanza is removedverified:parameter to URL — required by Homebrew when URL domain differs from homepage domainThe updated template now matches the working cask in the custom tap
Azure/homebrew-azure-cli.Testing
azure-cli-previewcask inAzure/homebrew-azure-cliaz upgradelogic tested with bothazure-cliandazure-cli-previewcask tokens