mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00: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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user