From 660891ee6ea4f1cff3fe74e6faaa0deae90dfe84 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 13 Mar 2020 11:42:51 -0600 Subject: [PATCH] ci: force install/link bazelisk package in macos dependency setup (#10357) 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 Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- ci/mac_ci_setup.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ci/mac_ci_setup.sh b/ci/mac_ci_setup.sh index 42cb7c63faa5..b58c3a3eeed4 100755 --- a/ci/mac_ci_setup.sh +++ b/ci/mac_ci_setup.sh @@ -2,9 +2,9 @@ # 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 @@ -12,8 +12,7 @@ function is_installed { function install { echo "Installing $1" - if ! brew install "$1" - then + if ! brew install "$1"; then echo "Failed to install $1" exit 1 fi @@ -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}" @@ -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