From 02dbe81faee97c12046a250822f1c4b71acb821a Mon Sep 17 00:00:00 2001 From: shum Date: Fri, 21 Aug 2026 12:43:47 +0000 Subject: [PATCH] scripts: retry cabal update on mirror failure --- scripts/relay/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/relay/Dockerfile b/scripts/relay/Dockerfile index ba5c735fb0..401371a0d7 100644 --- a/scripts/relay/Dockerfile +++ b/scripts/relay/Dockerfile @@ -19,13 +19,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ llvm-12 llvm-12-dev \ && rm -rf /var/lib/apt/lists/* +# cabal update is retried: on a failed fetch cabal falls back to the mirrors in +# Hackage's mirrors.json, which are dead, and the last one aborts the build. RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org \ | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ BOOTSTRAP_HASKELL_GHC_VERSION="${GHC}" \ BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL}" sh \ && ghcup set ghc "${GHC}" \ && ghcup set cabal "${CABAL}" \ - && cabal update + && { cabal update || { sleep 5; cabal update; } || { sleep 20; cabal update; }; } # Declared after the toolchain layers so that changing the ref does not rebuild # them. Unlike `clone --branch`, this form also accepts a commit hash.