From fc13fa46fb3b9a06e0fbafc69bac23dcb0f6453e Mon Sep 17 00:00:00 2001 From: DenzelPenzel Date: Tue, 28 Jul 2026 17:06:53 +0100 Subject: [PATCH] ci: retry apt-get update and install to absorb transient mirror failures --- .../workflows/actions/use-nodes/action.yml | 21 ++++++++++++++++++- .github/workflows/build-nodes.yml | 21 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions/use-nodes/action.yml b/.github/workflows/actions/use-nodes/action.yml index 06fc74a5548..2093fcbbc4e 100644 --- a/.github/workflows/actions/use-nodes/action.yml +++ b/.github/workflows/actions/use-nodes/action.yml @@ -5,7 +5,26 @@ runs: steps: - name: Install dependencies shell: bash - run: sudo apt-get update && sudo apt-get install -y curl gcc make clang cmake + run: | + set -euo pipefail + + apt_get() { + sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 "$@" + } + + attempts=3 + for attempt in $(seq "$attempts"); do + if apt_get -o APT::Update::Error-Mode=any update && apt_get install -y curl gcc make clang cmake; then + exit 0 + fi + + if [ "$attempt" -lt "$attempts" ]; then + sleep $((attempt * 10)) + fi + done + + echo "::error::apt-get update/install failed after $attempts attempts" + exit 1 - name: Download substrate-node binary id: download-substrate-binary diff --git a/.github/workflows/build-nodes.yml b/.github/workflows/build-nodes.yml index 29cfe9ca81e..14324f9658d 100644 --- a/.github/workflows/build-nodes.yml +++ b/.github/workflows/build-nodes.yml @@ -18,7 +18,26 @@ jobs: repository: paritytech/polkadot-sdk - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler curl gcc make clang cmake llvm-dev libclang-dev + run: | + set -euo pipefail + + apt_get() { + sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 "$@" + } + + attempts=3 + for attempt in $(seq "$attempts"); do + if apt_get -o APT::Update::Error-Mode=any update && apt_get install -y protobuf-compiler curl gcc make clang cmake llvm-dev libclang-dev; then + exit 0 + fi + + if [ "$attempt" -lt "$attempts" ]; then + sleep $((attempt * 10)) + fi + done + + echo "::error::apt-get update/install failed after $attempts attempts" + exit 1 - name: Install Rust stable toolchain uses: actions-rs/toolchain@v1