diff --git a/.github/workflows/cpp-packaging.yml b/.github/workflows/cpp-packaging.yml index 2719961866..6ba23cd98b 100644 --- a/.github/workflows/cpp-packaging.yml +++ b/.github/workflows/cpp-packaging.yml @@ -111,13 +111,28 @@ jobs: - name: Fetch and build binutils run: | set +e - # Retry up to 10 times because Curl has a tendency to timeout on - # Github runners. - for retry in {1..10} error; do - if [[ $retry == "error" ]]; then exit 5; fi - curl -L https://ftpmirror.gnu.org/binutils/binutils-${{ matrix.binutils_version }}.tar.xz --output binutils.tar.xz && break - sleep 300 + # Retry up to 10 times with fallback mirrors and fail on HTTP errors. + urls=( + "https://ftpmirror.gnu.org/binutils/binutils-${{ matrix.binutils_version }}.tar.xz" + "https://ftp.gnu.org/gnu/binutils/binutils-${{ matrix.binutils_version }}.tar.xz" + "https://mirrors.kernel.org/gnu/binutils/binutils-${{ matrix.binutils_version }}.tar.xz" + ) + download_success=false + for retry in {1..10}; do + for url in "${urls[@]}"; do + rm -f binutils.tar.xz + echo "Attempting to download binutils from ${url} (attempt ${retry})..." + if curl -f -L --connect-timeout 30 --max-time 300 "${url}" --output binutils.tar.xz; then + download_success=true + break 2 + fi + done + sleep 30 done + if [[ "${download_success}" != "true" ]]; then + echo "Failed to download binutils after multiple retries." + exit 5 + fi set -e tar -xf binutils.tar.xz @@ -706,9 +721,10 @@ jobs: # Retry up to 10 times because Curl has a tendency to timeout on # Github runners. for retry in {1..10} error; do - if [[ $retry == "error" ]]; then exit 5; fi - curl -L https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}.zip --output firebase_cpp_sdk.zip && break - sleep 300 + if [[ $retry == "error" ]]; then exit 5; fi + rm -f firebase_cpp_sdk.zip + curl -f -L --connect-timeout 30 --max-time 300 https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_${GITHUB_EVENT_INPUTS_DOWNLOADPUBLICVERSION}.zip --output firebase_cpp_sdk.zip && break + sleep 30 done set -e env: diff --git a/build_scripts/android/install_prereqs.sh b/build_scripts/android/install_prereqs.sh index 396d2b85b8..02b16a1b83 100755 --- a/build_scripts/android/install_prereqs.sh +++ b/build_scripts/android/install_prereqs.sh @@ -22,10 +22,11 @@ else # Github runners. for retry in {1..10} error; do if [[ $retry == "error" ]]; then exit 5; fi - curl -LSs \ + rm -f Strings.zip + curl -f -LSs \ "https://download.sysinternals.com/files/Strings.zip" \ --output Strings.zip && break - sleep 300 + sleep 30 done set -e unzip -q Strings.zip && rm -f Strings.zip @@ -76,10 +77,11 @@ if [[ -z "${NDK_ROOT}" || -z $(grep "Pkg\.Revision = 21\." "${NDK_ROOT}/source.p # Github runners. for retry in {1..10} error; do if [[ $retry == "error" ]]; then exit 5; fi - curl --http1.1 -LSs \ + rm -f /tmp/android-ndk-r21e.zip + curl -f --http1.1 -LSs \ "https://dl.google.com/android/repository/android-ndk-r21e-${platform}-x86_64.zip" \ --output /tmp/android-ndk-r21e.zip && break - sleep 300 + sleep 30 done set -e (cd /tmp && unzip -oq android-ndk-r21e.zip && rm -f android-ndk-r21e.zip)