Skip to content

Commit

Permalink
ci: force install/link bazelisk package in macos dependency setup (#1…
Browse files Browse the repository at this point in the history
…0357)

Latest mac os images have bazel pre-installed so force install bazelisk and link with overwrite to allow install to succeed

Risk Level: Low
Testing: N/A
Docs Changes: N/A
Release Notes: N/A

Co-authored-by: Sunjay Bhatia <sbhatia@pivotal.io>
Co-authored-by: William A Rowe Jr <wrowe@pivotal.io>
Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
Signed-off-by: William A Rowe Jr <wrowe@pivotal.io>
  • Loading branch information
3 people authored Mar 13, 2020
1 parent f9dd0d2 commit 660891e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ci/mac_ci_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

# Installs the dependencies required for a macOS build via homebrew.
# Tools are not upgraded to new versions.

# Setup bazelbuild tap
brew tap bazelbuild/tap
# See:
# https://github.com/actions/virtual-environments/blob/master/images/macos/macos-10.15-Readme.md for
# a list of pre-installed tools in the macOS image.

function is_installed {
brew ls --versions "$1" >/dev/null
}

function install {
echo "Installing $1"
if ! brew install "$1"
then
if ! brew install "$1"; then
echo "Failed to install $1"
exit 1
fi
Expand All @@ -24,7 +23,7 @@ if ! brew update; then
exit 1
fi

DEPS="automake bazelbuild/tap/bazelisk cmake coreutils go libtool wget ninja"
DEPS="automake cmake coreutils go libtool wget ninja"
for DEP in ${DEPS}
do
is_installed "${DEP}" || install "${DEP}"
Expand All @@ -35,3 +34,12 @@ if [ -n "$CIRCLECI" ]; then
# convert https://github.com to ssh://git@github.com, which jgit does not support.
mv ~/.gitconfig ~/.gitconfig_save
fi

# Required as bazel and a foreign bazelisk are installed in the latest macos vm image, we have
# to unlink/overwrite them to install bazelisk
echo "Installing bazelbuild/tap/bazelisk"
brew install --force bazelbuild/tap/bazelisk
if ! brew link --overwrite bazelbuild/tap/bazelisk; then
echo "Failed to install and link bazelbuild/tap/bazelisk"
exit 1
fi

0 comments on commit 660891e

Please sign in to comment.