mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2026-01-01 14:47:38 +08:00
[Mac OS] Rewrite function download_with_retry (#8914)
* [Mac OS] Rewrite function download_with_retry * Update powershell function DownloadWithRetry
This commit is contained in:
committed by
GitHub
parent
bf202afb1e
commit
5f5ab19246
@@ -13,14 +13,12 @@ Function Install-Asset {
|
||||
[object] $ReleaseAsset
|
||||
)
|
||||
|
||||
$assetFolderPath = Join-Path "/tmp" "$($ReleaseAsset.filename)-temp-dir"
|
||||
New-Item -ItemType Directory -Path $assetFolderPath | Out-Null
|
||||
$assetArchivePath = Join-Path $assetFolderPath $ReleaseAsset.filename
|
||||
|
||||
Write-Host "Download $($ReleaseAsset.filename) archive to the $assetFolderPath folder..."
|
||||
Start-DownloadWithRetry -Url $ReleaseAsset.download_url -DownloadPath $assetFolderPath
|
||||
Write-Host "Download $($ReleaseAsset.filename) archive..."
|
||||
$assetArchivePath = Invoke-DownloadWithRetry $ReleaseAsset.download_url
|
||||
|
||||
Write-Host "Extract $($ReleaseAsset.filename) content..."
|
||||
$assetFolderPath = Join-Path "/tmp" "$($ReleaseAsset.filename)-temp-dir"
|
||||
New-Item -ItemType Directory -Path $assetFolderPath | Out-Null
|
||||
tar -xzf $assetArchivePath -C $assetFolderPath
|
||||
|
||||
Write-Host "Invoke installation script..."
|
||||
|
||||
@@ -12,9 +12,9 @@ if [ ! -d $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE ]; then
|
||||
mkdir -p $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
||||
fi
|
||||
|
||||
downloadUrl=$(get_github_package_download_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
||||
echo "Downloading action-versions $downloadUrl"
|
||||
download_with_retries "$downloadUrl" "/tmp" action-versions.tar.gz
|
||||
tar -xzf /tmp/action-versions.tar.gz -C $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
||||
download_url=$(get_github_package_download_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
||||
echo "Downloading action-versions $download_url"
|
||||
archive_path=$(download_with_retry "$download_url")
|
||||
tar -xzf "$archive_path" -C "$ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE"
|
||||
|
||||
invoke_tests "ActionArchiveCache"
|
||||
|
||||
@@ -43,19 +43,18 @@ ANDROID_NDK_MAJOR_LATEST=$(get_toolset_value '.android.ndk."versions"[-1]')
|
||||
# Newer version(s) require Java 11 by default
|
||||
# See https://github.com/actions/runner-images/issues/6960
|
||||
ANDROID_HOME=$HOME/Library/Android/sdk
|
||||
ANDROID_OSX_SDK_FILE=tools-macosx.zip
|
||||
|
||||
# Download the latest command line tools so that we can accept all of the licenses.
|
||||
# See https://developer.android.com/studio/#command-tools
|
||||
cmdlineToolsVersion=$(get_toolset_value '.android."cmdline-tools"')
|
||||
|
||||
if [[ $cmdlineToolsVersion == "latest" ]]; then
|
||||
repositoryXmlUrl="https://dl.google.com/android/repository/repository2-1.xml"
|
||||
download_with_retries $repositoryXmlUrl "/tmp" "repository2-1.xml"
|
||||
repository_xml_url="https://dl.google.com/android/repository/repository2-1.xml"
|
||||
repository_xml_path=$(download_with_retry $repository_xml_url)
|
||||
cmdlineToolsVersion=$(
|
||||
yq -p=xml \
|
||||
'.sdk-repository.remotePackage[] | select(."+@path" == "cmdline-tools;latest" and .channelRef."+@ref" == "channel-0").archives.archive[].complete.url | select(contains("commandlinetools-mac"))' \
|
||||
/tmp/repository2-1.xml
|
||||
"$repository_xml_path"
|
||||
)
|
||||
|
||||
if [[ -z $cmdlineToolsVersion ]]; then
|
||||
@@ -65,16 +64,15 @@ if [[ $cmdlineToolsVersion == "latest" ]]; then
|
||||
fi
|
||||
|
||||
echo "Downloading android command line tools..."
|
||||
download_with_retries "https://dl.google.com/android/repository/${cmdlineToolsVersion}" /tmp $ANDROID_OSX_SDK_FILE
|
||||
archive_path=$(download_with_retry "https://dl.google.com/android/repository/${cmdlineToolsVersion}")
|
||||
|
||||
echo "Uncompressing android command line tools..."
|
||||
mkdir -p $HOME/Library/Android/sdk
|
||||
unzip -q /tmp/$ANDROID_OSX_SDK_FILE -d $HOME/Library/Android/sdk/cmdline-tools
|
||||
# Command line tools need to be placed in $HOME/Library/Android/sdk/cmdline-tools/latest to function properly
|
||||
mv $HOME/Library/Android/sdk/cmdline-tools/cmdline-tools $HOME/Library/Android/sdk/cmdline-tools/latest
|
||||
rm -f /tmp/$ANDROID_OSX_SDK_FILE
|
||||
mkdir -p "$ANDROID_HOME"
|
||||
unzip -q "$archive_path" -d "$ANDROID_HOME/cmdline-tools"
|
||||
# Command line tools need to be placed in $ANDROID_HOME/cmdline-tools/latest to function properly
|
||||
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
|
||||
|
||||
echo ANDROID_HOME is $ANDROID_HOME
|
||||
echo ANDROID_HOME is "$ANDROID_HOME"
|
||||
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest:$ANDROID_HOME/cmdline-tools/latest/bin
|
||||
|
||||
SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager
|
||||
@@ -127,12 +125,10 @@ do
|
||||
done
|
||||
|
||||
# Download SDK tools to preserve backward compatibility
|
||||
sdkTools="android-sdk-tools.zip"
|
||||
sdkToolsVersion=$(get_toolset_value '.android."sdk-tools"')
|
||||
if [ "$sdkToolsVersion" != "null" ]; then
|
||||
download_with_retries "https://dl.google.com/android/repository/${sdkToolsVersion}" "." $sdkTools
|
||||
unzip -o -qq $sdkTools -d ${ANDROID_SDK_ROOT}
|
||||
rm -f $sdkTools
|
||||
sdk_tools_version=$(get_toolset_value '.android."sdk-tools"')
|
||||
if [ "$sdk_tools_version" != "null" ]; then
|
||||
sdk_tools_archive_path=$(download_with_retry "https://dl.google.com/android/repository/${sdk_tools_version}")
|
||||
unzip -o -qq "$sdk_tools_archive_path" -d "${ANDROID_SDK_ROOT}"
|
||||
fi
|
||||
|
||||
invoke_tests "Android"
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
source ~/utils/utils.sh
|
||||
|
||||
echo Installing aws...
|
||||
AWS_CLI_URL="https://awscli.amazonaws.com/AWSCLIV2.pkg"
|
||||
download_with_retries $AWS_CLI_URL "/tmp"
|
||||
sudo installer -pkg /tmp/AWSCLIV2.pkg -target /
|
||||
awscliv2_pkg_path=$(download_with_retry "https://awscli.amazonaws.com/AWSCLIV2.pkg")
|
||||
sudo installer -pkg "$awscliv2_pkg_path" -target /
|
||||
|
||||
echo Installing aws sam cli...
|
||||
brew tap aws/tap
|
||||
|
||||
@@ -8,19 +8,14 @@ source ~/utils/utils.sh
|
||||
arch=$(get_arch)
|
||||
|
||||
# Check MacOS architecture and if ARM install using brew
|
||||
if [ $arch == "arm64" ]; then
|
||||
if [ "$arch" == "arm64" ]; then
|
||||
brew_smart_install azcopy
|
||||
else
|
||||
AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac"
|
||||
|
||||
download_with_retries $AZCOPY_DOWNLOAD_URL "/tmp" "azcopy.zip"
|
||||
unzip /tmp/azcopy.zip -d azcopy
|
||||
AZCOPY_EXTRACTED=$(echo azcopy/azcopy*)
|
||||
cp "$AZCOPY_EXTRACTED/azcopy" "/usr/local/bin/azcopy"
|
||||
archive_path=$(download_with_retry "https://aka.ms/downloadazcopy-v10-mac")
|
||||
unzip -qq "$archive_path" -d /tmp/azcopy
|
||||
extract_path=$(echo /tmp/azcopy/azcopy*)
|
||||
cp "$extract_path/azcopy" "/usr/local/bin/azcopy"
|
||||
chmod +x "/usr/local/bin/azcopy"
|
||||
|
||||
echo "Done, cleaning up"
|
||||
rm -rf azcopy*
|
||||
fi
|
||||
|
||||
invoke_tests "Common" "AzCopy"
|
||||
|
||||
@@ -19,20 +19,18 @@ 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"
|
||||
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)
|
||||
CHROME_VERSIONS_JSON="$(cat "$(download_with_retry "$CHROME_VERSIONS_URL")")"
|
||||
|
||||
# Download and unpack the latest release of Chrome Driver
|
||||
CHROMEDRIVER_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].version')
|
||||
echo "Installing Chrome Driver version $CHROMEDRIVER_VERSION"
|
||||
|
||||
CHROMEDRIVER_URL=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].downloads.chromedriver[] | select(.platform=="'"${CHROME_PLATFORM}"'").url')
|
||||
CHROMEDRIVER_ARCHIVE="chromedriver-${CHROME_PLATFORM}.zip"
|
||||
CHROMEDRIVER_DIR="/usr/local/share/chromedriver-${CHROME_PLATFORM}"
|
||||
CHROMEDRIVER_BIN="$CHROMEDRIVER_DIR/chromedriver"
|
||||
|
||||
download_with_retries "$CHROMEDRIVER_URL" "/tmp" "$CHROMEDRIVER_ARCHIVE"
|
||||
unzip -qq /tmp/$CHROMEDRIVER_ARCHIVE -d /tmp/
|
||||
CHROMEDRIVER_ARCHIVE_PATH=$(download_with_retry "$CHROMEDRIVER_URL")
|
||||
unzip -qq "$CHROMEDRIVER_ARCHIVE_PATH" -d /tmp/
|
||||
sudo mv "/tmp/chromedriver-${CHROME_PLATFORM}" "$CHROMEDRIVER_DIR"
|
||||
ln -s "$CHROMEDRIVER_BIN" /usr/local/bin/chromedriver
|
||||
echo "export CHROMEWEBDRIVER=$CHROMEDRIVER_DIR" >> "${HOME}/.bashrc"
|
||||
@@ -42,11 +40,10 @@ CHROME_FOR_TESTING_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"
|
||||
echo "Installing Google Chrome for Testing version $CHROME_FOR_TESTING_VERSION"
|
||||
|
||||
CHROME_FOR_TESTING_URL=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].downloads.chrome[] | select(.platform=="'"${CHROME_PLATFORM}"'").url')
|
||||
CHROME_FOR_TESTING_ARCHIVE="chrome-${CHROME_PLATFORM}.zip"
|
||||
CHROME_FOR_TESTING_APP="Google Chrome for Testing.app"
|
||||
|
||||
download_with_retries $CHROME_FOR_TESTING_URL "/tmp" $CHROME_FOR_TESTING_ARCHIVE
|
||||
unzip -qq /tmp/$CHROME_FOR_TESTING_ARCHIVE -d /tmp/
|
||||
CHROME_FOR_TESTING_ARCHIVE_PATH=$(download_with_retry "$CHROME_FOR_TESTING_URL")
|
||||
unzip -qq "$CHROME_FOR_TESTING_ARCHIVE_PATH" -d /tmp/
|
||||
mv "/tmp/chrome-${CHROME_PLATFORM}/${CHROME_FOR_TESTING_APP}" "/Applications/${CHROME_FOR_TESTING_APP}"
|
||||
|
||||
echo "Installing Selenium"
|
||||
|
||||
@@ -7,21 +7,20 @@
|
||||
source ~/utils/utils.sh
|
||||
|
||||
# Retrieve the CLI version of the latest CodeQL bundle.
|
||||
download_with_retries https://raw.githubusercontent.com/github/codeql-action/v2/src/defaults.json "/tmp" "codeql-defaults.json"
|
||||
bundle_version="$(jq -r '.cliVersion' /tmp/codeql-defaults.json)"
|
||||
defaults_json_path=$(download_with_retry https://raw.githubusercontent.com/github/codeql-action/v2/src/defaults.json)
|
||||
bundle_version="$(jq -r '.cliVersion' "$defaults_json_path")"
|
||||
bundle_tag_name="codeql-bundle-v$bundle_version"
|
||||
|
||||
echo "Downloading CodeQL bundle $bundle_version..."
|
||||
# Note that this is the all-platforms CodeQL bundle, to support scenarios where customers run
|
||||
# different operating systems within containers.
|
||||
download_with_retries "https://github.com/github/codeql-action/releases/download/$bundle_tag_name/codeql-bundle.tar.gz" "/tmp" "codeql-bundle.tar.gz"
|
||||
codeql_archive="/tmp/codeql-bundle.tar.gz"
|
||||
archive_path=$(download_with_retry "https://github.com/github/codeql-action/releases/download/$bundle_tag_name/codeql-bundle.tar.gz")
|
||||
|
||||
codeql_toolcache_path="$AGENT_TOOLSDIRECTORY/CodeQL/$bundle_version/x64"
|
||||
mkdir -p "$codeql_toolcache_path"
|
||||
|
||||
echo "Unpacking the downloaded CodeQL bundle archive..."
|
||||
tar -xzf "$codeql_archive" -C "$codeql_toolcache_path"
|
||||
tar -xzf "$archive_path" -C "$codeql_toolcache_path"
|
||||
|
||||
# Touch a file to indicate to the CodeQL Action that this bundle shipped with the toolcache. This is
|
||||
# to support overriding the CodeQL version specified in defaults.json on GitHub Enterprise.
|
||||
|
||||
@@ -8,8 +8,8 @@ source ~/utils/utils.sh
|
||||
|
||||
# Download and install YQ in cases when it is not available in the formulae as for macOS 11: https://formulae.brew.sh/formula/yq
|
||||
if is_BigSur; then
|
||||
download_with_retries "https://github.com/mikefarah/yq/releases/latest/download/yq_darwin_amd64" "/tmp" "yq"
|
||||
sudo install /tmp/yq /usr/local/bin/yq
|
||||
binary_path=$(download_with_retry "https://github.com/mikefarah/yq/releases/latest/download/yq_darwin_amd64")
|
||||
sudo install "$binary_path" /usr/local/bin/yq
|
||||
fi
|
||||
|
||||
# Monterey needs future review:
|
||||
@@ -27,12 +27,10 @@ for package in $cask_packages; do
|
||||
if is_Monterey && [[ $package == "virtualbox" ]]; then
|
||||
# Do not update VirtualBox on macOS 12 due to the issue with VMs in gurumediation state which blocks Vagrant on macOS: https://github.com/actions/runner-images/issues/8730
|
||||
# macOS host: Dropped all kernel extensions. VirtualBox relies fully on the hypervisor and vmnet frameworks provided by Apple now.
|
||||
vbcask_url="https://raw.githubusercontent.com/Homebrew/homebrew-cask/aa3c55951fc9d687acce43e5c0338f42c1ddff7b/Casks/virtualbox.rb"
|
||||
download_with_retries $vbcask_url
|
||||
brew install ./virtualbox.rb
|
||||
rm ./virtualbox.rb
|
||||
virtualbox_cask_path=$(download_with_retry "https://raw.githubusercontent.com/Homebrew/homebrew-cask/aa3c55951fc9d687acce43e5c0338f42c1ddff7b/Casks/virtualbox.rb")
|
||||
brew install "$virtualbox_cask_path"
|
||||
else
|
||||
brew install --cask $package
|
||||
brew install --cask "$package"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ arch=$(get_arch)
|
||||
|
||||
# Download installer from dot.net and keep it locally
|
||||
DOTNET_INSTALL_SCRIPT="https://dot.net/v1/dotnet-install.sh"
|
||||
download_with_retries $DOTNET_INSTALL_SCRIPT .
|
||||
chmod +x ./dotnet-install.sh
|
||||
install_script_path=$(download_with_retry $DOTNET_INSTALL_SCRIPT)
|
||||
chmod +x "$install_script_path"
|
||||
|
||||
ARGS_LIST=()
|
||||
echo "Parsing dotnet SDK (except rc and preview versions) from .json..."
|
||||
@@ -22,15 +22,15 @@ DOTNET_VERSIONS=($(get_toolset_value ".dotnet.arch[\"$arch\"].versions | .[]"))
|
||||
|
||||
for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do
|
||||
RELEASE_URL="https://raw.githubusercontent.com/dotnet/core/main/release-notes/${DOTNET_VERSION}/releases.json"
|
||||
download_with_retries "$RELEASE_URL" "/tmp" "dotnet_${DOTNET_VERSION}.json"
|
||||
releases_json_file=$(download_with_retry "$RELEASE_URL")
|
||||
|
||||
if [[ $DOTNET_VERSION == "6.0" ]]; then
|
||||
ARGS_LIST+=(
|
||||
$(cat /tmp/dotnet_${DOTNET_VERSION}.json | jq -r 'first(.releases[].sdks[]?.version | select(contains("preview") or contains("rc") | not))')
|
||||
$(cat "$releases_json_file" | jq -r 'first(.releases[].sdks[]?.version | select(contains("preview") or contains("rc") | not))')
|
||||
)
|
||||
else
|
||||
ARGS_LIST+=(
|
||||
$(cat /tmp/dotnet_${DOTNET_VERSION}.json | \
|
||||
$(cat "$releases_json_file" | \
|
||||
jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*' | \
|
||||
sort -r | rev | uniq -s 2 | rev)
|
||||
)
|
||||
@@ -38,11 +38,9 @@ for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do
|
||||
done
|
||||
|
||||
for ARGS in "${ARGS_LIST[@]}"; do
|
||||
./dotnet-install.sh --version $ARGS -NoPath --arch $arch
|
||||
"$install_script_path" --version $ARGS -NoPath --arch $arch
|
||||
done
|
||||
|
||||
rm ./dotnet-install.sh
|
||||
|
||||
# dotnet installer doesn't create symlink to executable in /user/local/bin
|
||||
# Moreover at that moment /user/local/bin doesn't exist (though already added to $PATH)
|
||||
ln -s ~/.dotnet/dotnet /usr/local/bin/dotnet
|
||||
|
||||
@@ -17,29 +17,23 @@ echo "Version of Microsoft Edge: ${EDGE_VERSION}"
|
||||
|
||||
echo "Installing Microsoft Edge WebDriver..."
|
||||
|
||||
EDGE_DRIVER_VERSION_URL="https://msedgedriver.azureedge.net/LATEST_RELEASE_${EDGE_VERSION_MAJOR}_MACOS"
|
||||
download_with_retries "$EDGE_DRIVER_VERSION_URL" "/tmp" "edge-version"
|
||||
EDGE_DRIVER_LATEST_VERSION=$(cat /tmp/edge-version | iconv -f utf-16 -t utf-8 | tr -d '\r')
|
||||
EDGE_DRIVER_VERSION_FILE_PATH=$(download_with_retry "https://msedgedriver.azureedge.net/LATEST_RELEASE_${EDGE_VERSION_MAJOR}_MACOS")
|
||||
EDGE_DRIVER_LATEST_VERSION=$(iconv -f utf-16 -t utf-8 "$EDGE_DRIVER_VERSION_FILE_PATH" | tr -d '\r')
|
||||
EDGE_DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_DRIVER_LATEST_VERSION}/edgedriver_mac64.zip"
|
||||
|
||||
echo "Compatible version of WebDriver: ${EDGE_DRIVER_LATEST_VERSION}"
|
||||
|
||||
pushd "/tmp" > /dev/null
|
||||
download_with_retries $EDGE_DRIVER_URL "." "edgedriver.zip"
|
||||
EDGE_DRIVER_ARCHIVE_PATH=$(download_with_retry "$EDGE_DRIVER_URL")
|
||||
|
||||
# Move webdriver to the separate directory to be consistent with the docs
|
||||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
|
||||
|
||||
APPLICATION="/usr/local/bin/msedgedriver"
|
||||
EDGEDRIVER_DIR="/usr/local/share/edge_driver"
|
||||
EDGEDRIVER_BIN="$EDGEDRIVER_DIR/msedgedriver"
|
||||
EDGE_DRIVER_DIR="/usr/local/share/edge_driver"
|
||||
mkdir -p $EDGE_DRIVER_DIR
|
||||
unzip -qq "$EDGE_DRIVER_ARCHIVE_PATH" -d "$EDGE_DRIVER_DIR"
|
||||
ln -s "$EDGE_DRIVER_DIR/msedgedriver" "/usr/local/bin/msedgedriver"
|
||||
|
||||
mkdir -p $EDGEDRIVER_DIR
|
||||
|
||||
unzip "edgedriver.zip" -d $EDGEDRIVER_DIR
|
||||
ln -s "$EDGEDRIVER_BIN" $APPLICATION
|
||||
echo "export EDGEWEBDRIVER=${EDGEDRIVER_DIR}" >> "${HOME}/.bashrc"
|
||||
popd > /dev/null
|
||||
echo "export EDGEWEBDRIVER=${EDGE_DRIVER_DIR}" >> "${HOME}/.bashrc"
|
||||
|
||||
# Configure Edge Updater to prevent auto update
|
||||
# https://learn.microsoft.com/en-us/deployedge/edge-learnmore-edgeupdater-for-macos
|
||||
|
||||
@@ -9,8 +9,8 @@ source ~/utils/utils.sh
|
||||
arch=$(get_arch)
|
||||
|
||||
echo "Installing Homebrew..."
|
||||
download_with_retries "https://raw.githubusercontent.com/Homebrew/install/master/install.sh" "/tmp" "homebrew-install.sh"
|
||||
/bin/bash /tmp/homebrew-install.sh
|
||||
homebrew_installer_path=$(download_with_retry "https://raw.githubusercontent.com/Homebrew/install/master/install.sh")
|
||||
/bin/bash "$homebrew_installer_path"
|
||||
|
||||
if [[ $arch == "arm64" ]]; then
|
||||
/opt/homebrew/bin/brew update
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
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
|
||||
miniconda_installer_path=$(download_with_retry "https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh")
|
||||
chmod +x "$miniconda_installer_path"
|
||||
sudo "$miniconda_installer_path" -b -p /usr/local/miniconda
|
||||
|
||||
# Chmod with full permissions recursively to avoid permissions restrictions
|
||||
sudo chmod -R 777 /usr/local/miniconda
|
||||
|
||||
@@ -7,43 +7,38 @@
|
||||
# Source utility functions
|
||||
source ~/utils/utils.sh
|
||||
|
||||
# Create a temporary directory to store downloaded files
|
||||
TMP_DIR=$(mktemp -d /tmp/visualstudio.XXXX)
|
||||
|
||||
# Install Mono Framework
|
||||
MONO_VERSION_FULL=$(get_toolset_value '.mono.framework.version')
|
||||
MONO_VERSION=$(echo "$MONO_VERSION_FULL" | cut -d. -f 1,2,3)
|
||||
MONO_VERSION_SHORT=$(echo $MONO_VERSION_FULL | cut -d. -f 1,2)
|
||||
MONO_PKG_URL="https://download.mono-project.com/archive/${MONO_VERSION}/macos-10-universal/MonoFramework-MDK-${MONO_VERSION_FULL}.macos10.xamarin.universal.pkg"
|
||||
MONO_PKG_NAME=${MONO_PKG_URL##*/}
|
||||
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
||||
|
||||
download_with_retries "$MONO_PKG_URL" "$TMP_DIR"
|
||||
echo "Installing $MONO_PKG_NAME..."
|
||||
sudo installer -pkg "$TMP_DIR/$MONO_PKG_NAME" -target /
|
||||
MONO_PKG_PATH=$(download_with_retry "$MONO_PKG_URL")
|
||||
echo "Installing Mono Framework ${MONO_VERSION_FULL}..."
|
||||
sudo installer -pkg "$MONO_PKG_PATH" -target /
|
||||
|
||||
# Download and install NUnit console
|
||||
NUNIT_VERSION=$(get_toolset_value '.mono.nunit.version')
|
||||
NUNIT_ARCHIVE_URL="https://github.com/nunit/nunit-console/releases/download/${NUNIT_VERSION}/NUnit.Console-${NUNIT_VERSION}.zip"
|
||||
NUNIT_ARCHIVE_NAME=${NUNIT_ARCHIVE_URL##*/}
|
||||
NUNIT_PATH="/Library/Developer/nunit"
|
||||
NUNIT_VERSION_PATH="$NUNIT_PATH/$NUNIT_VERSION"
|
||||
|
||||
download_with_retries "$NUNIT_ARCHIVE_URL" "$TMP_DIR"
|
||||
echo "Installing $NUNIT_ARCHIVE_NAME..."
|
||||
NUNIT_ARCHIVE_PATH=$(download_with_retry "$NUNIT_ARCHIVE_URL")
|
||||
echo "Installing NUnit ${NUNIT_VERSION}..."
|
||||
sudo mkdir -p "$NUNIT_VERSION_PATH"
|
||||
sudo unzip -q "$TMP_DIR/$NUNIT_ARCHIVE_NAME" -d "$NUNIT_VERSION_PATH"
|
||||
sudo unzip -q "$NUNIT_ARCHIVE_PATH" -d "$NUNIT_VERSION_PATH"
|
||||
|
||||
# Create a wrapper script for nunit3-console
|
||||
echo "Creating nunit3-console wrapper..."
|
||||
NUNIT3_CONSOLE_WRAPPER=nunit3-console
|
||||
cat <<EOF > "${TMP_DIR}/${NUNIT3_CONSOLE_WRAPPER}"
|
||||
NUNIT3_CONSOLE_WRAPPER=$(mktemp)
|
||||
cat <<EOF > "$NUNIT3_CONSOLE_WRAPPER"
|
||||
#!/bin/bash -e -o pipefail
|
||||
exec ${MONO_VERSIONS_PATH}/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT_VERSION_PATH/nunit3-console.exe "\$@"
|
||||
EOF
|
||||
cat "${TMP_DIR}/${NUNIT3_CONSOLE_WRAPPER}"
|
||||
sudo chmod +x "${TMP_DIR}/${NUNIT3_CONSOLE_WRAPPER}"
|
||||
sudo mv "${TMP_DIR}/${NUNIT3_CONSOLE_WRAPPER}" "${MONO_VERSIONS_PATH}/${MONO_VERSION}/Commands/${NUNIT3_CONSOLE_WRAPPER}"
|
||||
cat "$NUNIT3_CONSOLE_WRAPPER"
|
||||
sudo chmod +x "$NUNIT3_CONSOLE_WRAPPER"
|
||||
sudo mv "$NUNIT3_CONSOLE_WRAPPER" "${MONO_VERSIONS_PATH}/${MONO_VERSION}/Commands/nunit3-console"
|
||||
|
||||
# Create a symlink for the short version of Mono (e.g., 6.12)
|
||||
echo "Creating short symlink '${MONO_VERSION_SHORT}'..."
|
||||
|
||||
@@ -13,8 +13,8 @@ brew_smart_install "node@$defaultVersion"
|
||||
brew link node@$defaultVersion --force --overwrite
|
||||
|
||||
echo Installing yarn...
|
||||
download_with_retries "https://yarnpkg.com/install.sh" "/tmp" "yarn-install.sh"
|
||||
bash /tmp/yarn-install.sh
|
||||
yarn_installer_path=$(download_with_retry "https://yarnpkg.com/install.sh")
|
||||
bash "$yarn_installer_path"
|
||||
|
||||
if is_BigSur || is_Monterey; then
|
||||
npm_global_packages=$(get_toolset_value '.npm.global_packages[].name')
|
||||
|
||||
@@ -7,25 +7,22 @@
|
||||
source ~/utils/utils.sh
|
||||
|
||||
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
|
||||
VERSION=$(curl "${authString[@]}" -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
|
||||
download_with_retries "https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh" "/tmp" "nvm-install.sh"
|
||||
bash /tmp/nvm-install.sh
|
||||
nvm_version=$(curl "${authString[@]}" -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
|
||||
nvm_installer_path=$(download_with_retry "https://raw.githubusercontent.com/nvm-sh/nvm/$nvm_version/install.sh")
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
. ~/.bashrc
|
||||
nvm --version
|
||||
nodeVersions=$(get_toolset_value '.node.nvm_versions[]')
|
||||
for version in ${nodeVersions[@]}
|
||||
do
|
||||
nvm install v${version}
|
||||
done
|
||||
if bash "$nvm_installer_path"; then
|
||||
. ~/.bashrc
|
||||
nvm --version
|
||||
for version in $(get_toolset_value '.node.nvm_versions[]'); do
|
||||
nvm install "v${version}"
|
||||
done
|
||||
|
||||
# set system node as default
|
||||
nvm alias default system
|
||||
# set system node as default
|
||||
nvm alias default system
|
||||
|
||||
echo "Node version manager has been installed successfully"
|
||||
else
|
||||
echo error
|
||||
echo "Node version manager installation failed"
|
||||
fi
|
||||
|
||||
echo "Node version manager has been installed successfully"
|
||||
|
||||
invoke_tests "Node" "nvm"
|
||||
|
||||
@@ -34,16 +34,16 @@ installOpenJDK() {
|
||||
local JAVA_VERSION=$1
|
||||
|
||||
# Get link for Java binaries and Java version
|
||||
download_with_retries "https://api.adoptium.net/v3/assets/latest/${JAVA_VERSION}/hotspot" "/tmp" "openjdk-hotspot.json"
|
||||
hotspot_json_path=$(download_with_retry "https://api.adoptium.net/v3/assets/latest/${JAVA_VERSION}/hotspot")
|
||||
|
||||
if [[ $arch == "arm64" ]]; then
|
||||
asset=$(jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="aarch64")' /tmp/openjdk-hotspot.json)
|
||||
asset=$(jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="aarch64")' "$hotspot_json_path")
|
||||
else
|
||||
asset=$(jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="x64")' /tmp/openjdk-hotspot.json)
|
||||
asset=$(jq -r '.[] | select(.binary.os=="mac" and .binary.image_type=="jdk" and .binary.architecture=="x64")' "$hotspot_json_path")
|
||||
fi
|
||||
|
||||
archivePath=$(echo ${asset} | jq -r '.binary.package.link')
|
||||
fullVersion=$(echo ${asset} | jq -r '.version.semver' | tr '+' '-')
|
||||
archive_url=$(echo "$asset" | jq -r '.binary.package.link')
|
||||
fullVersion=$(echo "$asset" | jq -r '.version.semver' | tr '+' '-')
|
||||
|
||||
# Remove 'LTS' suffix from the version if present
|
||||
fullVersion="${fullVersion//.LTS/}"
|
||||
@@ -58,12 +58,12 @@ installOpenJDK() {
|
||||
fi
|
||||
|
||||
# Download and extract Java binaries
|
||||
download_with_retries ${archivePath} /tmp OpenJDK-${fullVersion}.tar.gz
|
||||
archive_path=$(download_with_retry "$archive_url")
|
||||
|
||||
echo "Creating ${javaToolcacheVersionArchPath} directory"
|
||||
mkdir -p ${javaToolcacheVersionArchPath}
|
||||
|
||||
tar -xf /tmp/OpenJDK-${fullVersion}.tar.gz -C ${javaToolcacheVersionArchPath} --strip-components=1
|
||||
tar -xf "$archive_path" -C ${javaToolcacheVersionArchPath} --strip-components=1
|
||||
|
||||
# Create complete file
|
||||
if [[ $arch == "arm64" ]]; then
|
||||
|
||||
@@ -9,16 +9,15 @@ source ~/utils/utils.sh
|
||||
echo Installing PowerShell...
|
||||
arch=$(get_arch)
|
||||
|
||||
download_with_retries "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json" "/tmp" "powershell-metadata.json"
|
||||
psver=$(cat /tmp/powershell-metadata.json | jq -r '.LTSReleaseTag[0]')
|
||||
psDownloadUrl=$(get_github_package_download_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$psver" "$API_PAT")
|
||||
download_with_retries $psDownloadUrl "/tmp" "powershell.pkg"
|
||||
metadata_json_path=$(download_with_retry "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json")
|
||||
version=$(jq -r '.LTSReleaseTag[0]' "$metadata_json_path")
|
||||
download_url=$(get_github_package_download_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT")
|
||||
pkg_path=$(download_with_retry "$download_url")
|
||||
|
||||
# Work around the issue on macOS Big Sur 11.5 or higher for possible error message ("can't be opened because Apple cannot check it for malicious software") when installing the package
|
||||
sudo xattr -rd com.apple.quarantine /tmp/powershell.pkg
|
||||
sudo xattr -rd com.apple.quarantine "$pkg_path"
|
||||
|
||||
|
||||
sudo installer -pkg /tmp/powershell.pkg -target /
|
||||
sudo installer -pkg "$pkg_path" -target /
|
||||
|
||||
# Install PowerShell modules
|
||||
psModules=$(get_toolset_value '.powershellModules[].name')
|
||||
|
||||
@@ -10,13 +10,12 @@ function InstallPyPy
|
||||
{
|
||||
PACKAGE_URL=$1
|
||||
|
||||
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
|
||||
PACKAGE_TAR_NAME=$(basename "$PACKAGE_URL")
|
||||
echo "Downloading tar archive '$PACKAGE_TAR_NAME'"
|
||||
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
|
||||
download_with_retries $PACKAGE_URL "/tmp" "$PACKAGE_TAR_NAME"
|
||||
archive_path=$(download_with_retry "$PACKAGE_URL")
|
||||
|
||||
echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder"
|
||||
tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp
|
||||
tar xf "$archive_path" -C /tmp
|
||||
|
||||
# Get Python version
|
||||
PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/}
|
||||
@@ -70,17 +69,14 @@ function InstallPyPy
|
||||
|
||||
echo "Create complete file"
|
||||
touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete
|
||||
|
||||
echo "Remove '$PACKAGE_TAR_TEMP_PATH'"
|
||||
rm -f $PACKAGE_TAR_TEMP_PATH
|
||||
}
|
||||
|
||||
arch=$(get_arch)
|
||||
download_with_retries "https://downloads.python.org/pypy/versions.json" "/tmp" "pypy-versions.json"
|
||||
versions_json_path=$(download_with_retry "https://downloads.python.org/pypy/versions.json")
|
||||
toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .arch.'$arch'.versions[]')
|
||||
|
||||
for toolsetVersion in $toolsetVersions; do
|
||||
latestMajorPyPyVersion=$(cat /tmp/pypy-versions.json |
|
||||
latestMajorPyPyVersion=$(cat "$versions_json_path" |
|
||||
jq -r --arg toolsetVersion $toolsetVersion '.[]
|
||||
| select((.python_version | startswith($toolsetVersion)) and .stable == true).files[]
|
||||
| select(.platform == "darwin").download_url' | head -1)
|
||||
|
||||
@@ -10,19 +10,19 @@ echo "Installing Python Tooling"
|
||||
|
||||
if is_Monterey || is_BigSur; then
|
||||
echo "Install latest Python 2"
|
||||
Python2Url="https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg"
|
||||
download_with_retries $Python2Url "/tmp" "python2.pkg"
|
||||
python2_pkg=$(download_with_retry "https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg")
|
||||
|
||||
sudo installer -showChoiceChangesXML -pkg /tmp/python2.pkg -target / > /tmp/python2_choices.xml
|
||||
choice_changes_xml=$(mktemp /tmp/python2_choice_changes.xml.XXXXXX)
|
||||
sudo installer -showChoiceChangesXML -pkg "$python2_pkg" -target / | tee "$choice_changes_xml" > /dev/null
|
||||
|
||||
# To avoid symlink conflicts, remove tools installation in /usr/local/bin using installer choices
|
||||
xmllint --shell /tmp/python2_choices.xml <<EOF
|
||||
xmllint --shell "$choice_changes_xml" <<EOF
|
||||
cd //array/dict[string[text()='org.python.Python.PythonUnixTools-2.7']]/integer
|
||||
set 0
|
||||
save
|
||||
EOF
|
||||
|
||||
sudo installer -applyChoiceChangesXML /tmp/python2_choices.xml -pkg /tmp/python2.pkg -target /
|
||||
sudo installer -applyChoiceChangesXML "$choice_changes_xml" -pkg "$python2_pkg" -target /
|
||||
|
||||
pip install --upgrade pip
|
||||
|
||||
|
||||
@@ -45,11 +45,10 @@ if ! is_Arm64; then
|
||||
mkdir -p $RUBY_VERSION_PATH
|
||||
|
||||
echo "Downloading tar archive $PACKAGE_TAR_NAME"
|
||||
DOWNLOAD_URL="https://github.com/ruby/ruby-builder/releases/download/toolcache/${PACKAGE_TAR_NAME}"
|
||||
download_with_retries $DOWNLOAD_URL "/tmp" $PACKAGE_TAR_NAME
|
||||
ARCHIVE_PATH=$(download_with_retry "https://github.com/ruby/ruby-builder/releases/download/toolcache/${PACKAGE_TAR_NAME}")
|
||||
|
||||
echo "Expand '$PACKAGE_TAR_NAME' to the '$RUBY_VERSION_PATH' folder"
|
||||
tar xf "/tmp/$PACKAGE_TAR_NAME" -C $RUBY_VERSION_PATH
|
||||
tar xf "$ARCHIVE_PATH" -C $RUBY_VERSION_PATH
|
||||
COMPLETE_FILE_PATH="$RUBY_VERSION_PATH/x64.complete"
|
||||
if [ ! -f $COMPLETE_FILE_PATH ]; then
|
||||
echo "Create complete file"
|
||||
|
||||
@@ -21,18 +21,16 @@ install_vsmac() {
|
||||
fi
|
||||
|
||||
echo "Installing Visual Studio ${VSMAC_VERSION} for Mac"
|
||||
TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX`
|
||||
TMPMOUNT_DOWNLOADS="$TMPMOUNT/downloads"
|
||||
mkdir $TMPMOUNT_DOWNLOADS
|
||||
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/visualstudio.XXXX)
|
||||
mkdir -p "$TMPMOUNT/downloads"
|
||||
|
||||
download_with_retries $VSMAC_DOWNLOAD_URL $TMPMOUNT_DOWNLOADS
|
||||
VSMAC_INSTALLER=$(download_with_retry "$VSMAC_DOWNLOAD_URL" "$TMPMOUNT/downloads/${VSMAC_DOWNLOAD_URL##*/}")
|
||||
|
||||
echo "Mounting Visual Studio..."
|
||||
VISUAL_STUDIO_NAME=${VSMAC_DOWNLOAD_URL##*/}
|
||||
hdiutil attach "$TMPMOUNT_DOWNLOADS/$VISUAL_STUDIO_NAME" -mountpoint "$TMPMOUNT"
|
||||
hdiutil attach "$VSMAC_INSTALLER" -mountpoint "$TMPMOUNT"
|
||||
|
||||
echo "Moving Visual Studio to /Applications/..."
|
||||
pushd $TMPMOUNT
|
||||
pushd "$TMPMOUNT"
|
||||
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
|
||||
|
||||
if [ $VSMAC_VERSION != $VSMAC_DEFAULT ]; then
|
||||
|
||||
Reference in New Issue
Block a user