[macos] simplify "brew_smart_install" helper (#8639)

* [macos] homebrew: use hardcoded condition for jq installation

we cannot use "jq" if we are asked to install "jq"

* [macos] always use "brew install"

* [macos] add retries to "get_github_package_download_url" helper

* [macos] add retries to chrome install script

* [macos] add retries to OpenJDK install script

* [macos] add retries to miniconda installer

* Update images/macos/provision/core/openjdk.sh

Co-authored-by: Vasilii Polikarpov <126792224+vpolikarpov-akvelon@users.noreply.github.com>

* fix copy-paste error

* Update images/macos/provision/core/openjdk.sh

Co-authored-by: Vasilii Polikarpov <126792224+vpolikarpov-akvelon@users.noreply.github.com>

* Update images/macos/provision/core/openjdk.sh

Co-authored-by: Vasilii Polikarpov <126792224+vpolikarpov-akvelon@users.noreply.github.com>

---------

Co-authored-by: Vasilii Polikarpov <126792224+vpolikarpov-akvelon@users.noreply.github.com>
This commit is contained in:
ilia-shipitsin
2023-10-26 15:17:57 +02:00
committed by GitHub
parent 7ca7296ba5
commit 883df0594b
4 changed files with 55 additions and 89 deletions

View File

@@ -14,7 +14,8 @@ echo "Google Chrome version is $FULL_CHROME_VERSION"
# Get Google Chrome versions information
CHROME_PLATFORM="mac-$arch"
CHROME_VERSIONS_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json"
CHROME_VERSIONS_JSON=$(curl -fsSL "${CHROME_VERSIONS_URL}")
download_with_retries "$CHROME_VERSIONS_URL" "/tmp" "latest-patch-versions-per-build-with-downloads.json"
CHROME_VERSIONS_JSON=$(cat /tmp/latest-patch-versions-per-build-with-downloads.json)
# Download and unpack the latest release of Chrome Driver
CHROMEDRIVER_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].version')

View File

@@ -1,9 +1,11 @@
#!/bin/bash -e -o pipefail
MINICONDA_INSTALLER="/tmp/miniconda.sh"
curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER
chmod +x $MINICONDA_INSTALLER
sudo $MINICONDA_INSTALLER -b -p /usr/local/miniconda
source ~/utils/utils.sh
download_with_retries "https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh" "/tmp" "miniconda.sh"
chmod +x /tmp/miniconda.sh
sudo /tmp/miniconda.sh -b -p /usr/local/miniconda
# Chmod with full permissions recursively to avoid permissions restrictions
sudo chmod -R 777 /usr/local/miniconda

View File

@@ -29,12 +29,12 @@ installOpenJDK() {
local JAVA_VERSION=$1
# Get link for Java binaries and Java version
assetUrl=$(curl -fsSL "https://api.adoptium.net/v3/assets/latest/${JAVA_VERSION}/hotspot")
download_with_retries "https://api.adoptium.net/v3/assets/latest/${JAVA_VERSION}/hotspot" "/tmp" "openjdk-hotspot.json"
if [[ $arch == "arm64" ]]; then
asset=$(echo ${assetUrl} | jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="aarch64")')
asset=$(jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="aarch64")' /tmp/openjdk-hotspot.json)
else
asset=$(echo ${assetUrl} | jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="x64")')
asset=$(jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="x64")' /tmp/openjdk-hotspot.json)
fi
archivePath=$(echo ${asset} | jq -r '.binary.package.link')