{Packaging} Fix Homebrew test install on older brew by rewriting formula_opt_prefix in test jobs#33647
Merged
YangAn-microsoft merged 1 commit intoJun 25, 2026
Conversation
…ula_opt_prefix in test jobs The macOS CI jobs fail with NoMethodError undefined method formula_opt_prefix during brew install. Upstream homebrew-core azure-cli.rb now uses the newer formula_opt_prefix DSL helper, absent on the older Homebrew on the macOS-14 agent image. Following the existing no_autobump convention, patch the formula only in the test jobs right before brew install via sed, rewriting it to the backward-compatible Formula opt_prefix form. The generated and submitted formula stays upstream-faithful.
️✔️AzureCLI-FullTest
|
|
Hi @YangAn-microsoft, |
️✔️AzureCLI-BreakingChangeTest
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the macOS Homebrew CI test jobs to work around older Homebrew versions that lack the formula_opt_prefix DSL helper, by rewriting that call in the locally tested azure-cli.rb formula just before brew install.
Changes:
- Add a macOS-CI-only
sedrewrite to replaceformula_opt_prefix("...")withFormula["..."].opt_prefixprior to installation. - Apply the same shim in both the inline
TestHomebrewFormulapipeline step and the (currently disabled)TestHomebrewPackagescript. - Document the workaround with
TODO(packaging)comments for future removal.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
scripts/release/homebrew/test_homebrew_package.sh |
Patches the artifact formula in-place before brew install during the package test flow. |
azure-pipelines.yml |
Patches the tapped formula in-place before brew install in the active Homebrew formula test job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Packaging |
naga-nandyala
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The upstream homebrew-core
azure-cli.rbdef installnow callsformula_opt_prefix("openssl@3"), a new Homebrew DSL helper (brewutils/path.rb). That helper is missing on the older Homebrew preinstalled on themacOS-14CI agent image, sobrew installfails with aNoMethodError. This was first observed in the batched/nightly CI failure around 2026-06-23.Fix
Patch the formula only in the macOS test jobs, right before
brew install, rewriting the call to the backward-compatibleFormula["openssl@3"].opt_prefixform — mirroring the existingno_autobump!sed convention. The generated/submitted homebrew-core formula is intentionally left upstream-faithful (no change toformula_generate.py).Changed files:
azure-pipelines.yml(jobTestHomebrewFormula)scripts/release/homebrew/test_homebrew_package.shNote
TestHomebrewPackageis currentlycondition: false(disabled), so onlyTestHomebrewFormulaactively exercises this fix; the shell-script change is preventative for when that job is re-enabled.Cleanup
A
TODO(packaging)marker was added above each shim so it can be removed once the agent image's Homebrew shipsformula_opt_prefix.HISTORY.rst
Intentionally skipped — this is an internal CI/packaging change with no customer-facing behavior.