mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[MacOS] improve errexit option handling (#8432)
* [MacOS] improve errexit option handling * Prevent prompting for override when unzipping * Explicitly allow failing when installing virtualbox * Remove libtcl symlinks * Add debug output
This commit is contained in:
committed by
GitHub
parent
fc9431c2eb
commit
378c4d7511
@@ -126,7 +126,7 @@ sdkTools="android-sdk-tools.zip"
|
|||||||
sdkToolsVersion=$(get_toolset_value '.android."sdk-tools"')
|
sdkToolsVersion=$(get_toolset_value '.android."sdk-tools"')
|
||||||
if [ "$sdkToolsVersion" != "null" ]; then
|
if [ "$sdkToolsVersion" != "null" ]; then
|
||||||
download_with_retries "https://dl.google.com/android/repository/${sdkToolsVersion}" "." $sdkTools
|
download_with_retries "https://dl.google.com/android/repository/${sdkToolsVersion}" "." $sdkTools
|
||||||
unzip -qq $sdkTools -d ${ANDROID_SDK_ROOT}
|
unzip -o -qq $sdkTools -d ${ANDROID_SDK_ROOT}
|
||||||
rm -f $sdkTools
|
rm -f $sdkTools
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ fi
|
|||||||
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
|
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
|
||||||
if is_Monterey; then
|
if is_Monterey; then
|
||||||
if is_Veertu; then
|
if is_Veertu; then
|
||||||
|
echo "Executing AppleScript to change security preferences (with retries)"
|
||||||
retry=5
|
retry=5
|
||||||
while [ $retry -gt 0 ]; do
|
while [ $retry -gt 0 ]; do
|
||||||
{
|
{
|
||||||
@@ -48,6 +49,7 @@ if is_Monterey; then
|
|||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
echo "Executing AppleScript to change security preferences"
|
||||||
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
|
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -82,13 +84,5 @@ bazel
|
|||||||
# Install Azure DevOps extension for Azure Command Line Interface
|
# Install Azure DevOps extension for Azure Command Line Interface
|
||||||
az extension add -n azure-devops
|
az extension add -n azure-devops
|
||||||
|
|
||||||
# Workaround https://github.com/actions/runner-images/issues/4931
|
|
||||||
# by making Tcl/Tk paths the same on macOS 10.15 and macOS 11
|
|
||||||
if is_Monterey; then
|
|
||||||
version=$(brew info tcl-tk --json | jq -r '.[].installed[].version')
|
|
||||||
ln -s /usr/local/Cellar/tcl-tk/$version/lib/libtcl8.6.dylib /usr/local/lib/libtcl8.6.dylib
|
|
||||||
ln -s /usr/local/Cellar/tcl-tk/$version/lib/libtk8.6.dylib /usr/local/lib/libtk8.6.dylib
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Invoke tests for all basic tools
|
# Invoke tests for all basic tools
|
||||||
invoke_tests "BasicTools"
|
invoke_tests "BasicTools"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function InstallPyPy
|
|||||||
PACKAGE_URL=$1
|
PACKAGE_URL=$1
|
||||||
|
|
||||||
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
|
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
|
||||||
echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'"
|
echo "Downloading tar archive '$PACKAGE_TAR_NAME'"
|
||||||
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
|
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
|
||||||
download_with_retries $PACKAGE_URL "/tmp" "$PACKAGE_TAR_NAME"
|
download_with_retries $PACKAGE_URL "/tmp" "$PACKAGE_TAR_NAME"
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,24 @@ download_with_retries() {
|
|||||||
local COMMAND="curl $URL -4 -sL -o '$DEST/$NAME' -w '%{http_code}'"
|
local COMMAND="curl $URL -4 -sL -o '$DEST/$NAME' -w '%{http_code}'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Save current errexit state and disable it to prevent unexpected exit on error
|
||||||
|
if echo $SHELLOPTS | grep '\(^\|:\)errexit\(:\|$\)' > /dev/null;
|
||||||
|
then
|
||||||
|
local ERR_EXIT_ENABLED=true
|
||||||
|
else
|
||||||
|
local ERR_EXIT_ENABLED=false
|
||||||
|
fi
|
||||||
|
set +e
|
||||||
|
|
||||||
echo "Downloading '$URL' to '${DEST}/${NAME}'..."
|
echo "Downloading '$URL' to '${DEST}/${NAME}'..."
|
||||||
retries=20
|
retries=20
|
||||||
interval=30
|
interval=30
|
||||||
while [ $retries -gt 0 ]; do
|
while [ $retries -gt 0 ]; do
|
||||||
((retries--))
|
((retries--))
|
||||||
# Temporary disable exit on error to retry on non-zero exit code
|
test "$ERR_EXIT_ENABLED" = true && set +e
|
||||||
set +e
|
|
||||||
http_code=$(eval $COMMAND)
|
http_code=$(eval $COMMAND)
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
test "$ERR_EXIT_ENABLED" = true && set -e
|
||||||
if [ $http_code -eq 200 ] && [ $exit_code -eq 0 ]; then
|
if [ $http_code -eq 200 ] && [ $exit_code -eq 0 ]; then
|
||||||
echo "Download completed"
|
echo "Download completed"
|
||||||
return 0
|
return 0
|
||||||
@@ -31,8 +40,6 @@ download_with_retries() {
|
|||||||
echo "Error — Either HTTP response code for '$URL' is wrong - '$http_code' or exit code is not 0 - '$exit_code'. Waiting $interval seconds before the next attempt, $retries attempts left"
|
echo "Error — Either HTTP response code for '$URL' is wrong - '$http_code' or exit code is not 0 - '$exit_code'. Waiting $interval seconds before the next attempt, $retries attempts left"
|
||||||
sleep 30
|
sleep 30
|
||||||
fi
|
fi
|
||||||
# Enable exit on error back
|
|
||||||
set -e
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Could not download $URL"
|
echo "Could not download $URL"
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ Describe "Helm" -Skip:($os.IsMonterey -or $os.IsVentura -or $os.IsVenturaArm64)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "Tcl/Tk" {
|
||||||
|
It "libtcl" {
|
||||||
|
"file /usr/local/lib/libtcl8.6.dylib" | Should -ReturnZeroExitCode
|
||||||
|
"file /usr/local/lib/libtk8.6.dylib" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Describe "bazelisk" {
|
Describe "bazelisk" {
|
||||||
It "bazelisk" {
|
It "bazelisk" {
|
||||||
"bazelisk version" | Should -ReturnZeroExitCode
|
"bazelisk version" | Should -ReturnZeroExitCode
|
||||||
|
|||||||
Reference in New Issue
Block a user