{CI} Fix homebrew formula test by creating dummy homebrew tap#32162
{CI} Fix homebrew formula test by creating dummy homebrew tap#32162
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @bebound, |
️✔️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>
|
|
|
||
| echo == Install azure-cli.rb formula == | ||
| brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb | ||
| # Need to create a dummy homebrew tap to install the formula |
There was a problem hiding this comment.
This method is found in Homebrew/brew#18371 (comment)
It also mentions that:
Yea, installing formulae from paths is buggy and shouldn't be used. We should probably remove the ability to do that at some point.
So creating a tap is the recommended way to install formula.
PS: Setting HOMEBREW_DEVELOPER=1 is a another workaround but the owner says it changes a lot of the behaviour of Homebrew: Homebrew/brew#20414 (comment).
There was a problem hiding this comment.
Homebrew keeps changing. We may want to release a ZIP or tar.gz package as soon as possible.
| brew install --build-from-source $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb | ||
| # Need to create a dummy homebrew tap to install the formula | ||
| git config --global user.email "you@example.com" | ||
| git config --global user.name "Your Name" |
There was a problem hiding this comment.
tap-new requires Git user information; otherwise, the following error occurs:
linuxbrew@5ef95ab56d08:~$ brew tap-new dev/azure-cli
Warning: tap-new is a developer command, so Homebrew's
developer mode has been automatically turned on.
To turn developer mode off, run:
brew developer off
Initialized empty Git repository in /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/dev/homebrew-azure-cli/.git/
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'linuxbrew@5ef95ab56d08.(none)')
PS: Although brew tap-new enables developer mode, it's not equal to HOMEBREW_DEVELOPER=1. Formula can't be installed directly from a path, even if developer mode is on.
59a2587 to
3511d13
Compare
| git config --global user.name "Your Name" | ||
| brew tap-new dev/azure-cli | ||
| cp $SYSTEM_ARTIFACTSDIRECTORY/homebrew/azure-cli.rb $(brew --repository)/Library/Taps/dev/homebrew-azure-cli/Formula/ | ||
| brew install --build-from-source dev/homebrew-azure-cli/azure-cli |
There was a problem hiding this comment.
--build-from-source is required. Otherwise, brew tries to install azure-cli from core repo.
brew install dev/homebrew-azure-cli/azure-cli
==> Fetching downloads for: azure-cli
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/manifests/2.77.0
==> Fetching dev/azure-cli/azure-cli
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/blobs/sha256:3722168cdfb5ee06e816a2d9e6644feb1e59a8ebe9dfe43858ba6f285b1b4c02
==> Installing azure-cli from dev/azure-cli
==> Pouring azure-cli--2.77.0.sonoma.bottle.tar.gz
🍺 /usr/local/Cellar/azure-cli/2.77.0: 16,043 files, 329.2MB
==> No outdated dependents to upgrade!
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a CI/CD pipeline failure for Homebrew formula testing by addressing a breaking change in Homebrew 4.6.0 that prohibits installing formulas from direct file paths. The fix creates a dummy homebrew tap to enable formula installation.
- Creates a dummy homebrew tap to comply with Homebrew 4.6.0 requirements
- Copies the formula file to the tap directory and installs from the tap instead of a direct path
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| git config --global user.email "you@example.com" | ||
| git config --global user.name "Your Name" |
There was a problem hiding this comment.
Using placeholder values for git configuration in CI/CD pipelines is not ideal. Consider using environment variables or more descriptive values like 'ci@azure-cli.local' and 'Azure CLI CI' to better reflect the automated nature of these commits.
| git config --global user.email "you@example.com" | |
| git config --global user.name "Your Name" | |
| git config --global user.email "ci@azure-cli.local" | |
| git config --global user.name "Azure CLI CI" |
Description
Test Homebrew Formula task fails with
Homebrew 4.6.0 prohibits installing formula from path, see Homebrew/brew#20521. Need to create a dummy tap then install it.
Testing Guide
Task passed at
https://dev.azure.com/azclitools/public/_build/results?buildId=273283&view=logs&jobId=ebe8970d-a8af-5d7e-4086-8f4ce0be006b&j=ebe8970d-a8af-5d7e-4086-8f4ce0be006b&t=3f22f999-770c-5d06-3bb8-1a936f5d8384