Parcourir la source

fix: plain build without CACHEBUST build-arg (set -u); add curl retries for flaky build-host DNS

ric il y a 1 mois
Parent
commit
0fb485d3ed
2 fichiers modifiés avec 30 ajouts et 8 suppressions
  1. 12 0
      CHANGELOG.md
  2. 18 8
      Dockerfile

+ 12 - 0
CHANGELOG.md

@@ -35,6 +35,18 @@ All notable changes to this project are documented here.
   (MIT/MIT/BSD-3/MIT); no verbatim code copied, attribution not legally
   required, listed for transparency.
 
+### Fixed
+- Plain `docker build` (without `--build-arg CACHEBUST`) failed with
+  `/bin/sh: CACHEBUST: parameter not set` because `ARG CACHEBUST` had no
+  default and the src stages run with `set -u`. Now `ARG CACHEBUST=""` —
+  plain builds work, the test suite keeps passing a timestamp to force
+  fresh integrity verification.
+- Source downloads in both src stages now use
+  `curl --retry 3 --retry-delay 2 --retry-all-errors --max-time …`:
+  build-host DNS can be flaky (observed 2026-10-23: WSL/Windows resolver
+  intermittently failing on nlnetlabs.nl while public resolvers answered
+  in ~30 ms), which aborted builds with `curl: (6) Could not resolve host`.
+
 ## [0.1.0] - 2026-10-23
 
 ### Added

+ 18 - 8
Dockerfile

@@ -46,14 +46,21 @@ ARG UNBOUND_VERSION
 ARG UNBOUND_SHA256
 # CACHEBUST: test suite passes a timestamp so integrity verification (SHA256 +
 # GPG) re-runs on every test run even when the build stages are cached.
-ARG CACHEBUST
+# Default empty: plain builds (no --build-arg) must not trip `set -u`.
+ARG CACHEBUST=""
+# Retry flags for downloads: DNS on the build host can be flaky
+# (observed 2026-10-23: WSL/Windows resolver intermittently fails on
+# nlnetlabs.nl). --retry-all-errors covers DNS failures too (curl >= 7.71).
 RUN set -eux \
  && echo "cachebust=$CACHEBUST" \
- && curl -sSL "https://unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz" -o unbound.tar.gz \
- && curl -sSL "https://unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz.asc" -o unbound.tar.gz.asc \
+ && curl -sSL --retry 3 --retry-delay 2 --retry-all-errors --max-time 120 \
+       "https://unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz" -o unbound.tar.gz \
+ && curl -sSL --retry 3 --retry-delay 2 --retry-all-errors --max-time 60 \
+       "https://unbound.net/downloads/unbound-${UNBOUND_VERSION}.tar.gz.asc" -o unbound.tar.gz.asc \
  && echo "${UNBOUND_SHA256}  unbound.tar.gz" | sha256sum -c - \
  && export GNUPGHOME="$(mktemp -d)" \
- && curl -sSL "https://nlnetlabs.nl/downloads/keys/releases-g2.asc" -o "$GNUPGHOME/releases-g2.asc" \
+ && curl -sSL --retry 3 --retry-delay 2 --retry-all-errors --max-time 60 \
+       "https://nlnetlabs.nl/downloads/keys/releases-g2.asc" -o "$GNUPGHOME/releases-g2.asc" \
  && gpg --no-tty --import "$GNUPGHOME/releases-g2.asc" \
  && gpg --batch --verify unbound.tar.gz.asc unbound.tar.gz \
  && tar xzf unbound.tar.gz --strip 1
@@ -62,14 +69,17 @@ FROM base AS ldns-src
 WORKDIR /src/ldns
 ARG LDNS_VERSION
 ARG LDNS_SHA256
-ARG CACHEBUST
+ARG CACHEBUST=""
 RUN set -eux \
  && echo "cachebust=$CACHEBUST" \
- && curl -sSL "https://nlnetlabs.nl/downloads/ldns/ldns-${LDNS_VERSION}.tar.gz" -o ldns.tar.gz \
- && curl -sSL "https://nlnetlabs.nl/downloads/ldns/ldns-${LDNS_VERSION}.tar.gz.asc" -o ldns.tar.gz.asc \
+ && curl -sSL --retry 3 --retry-delay 2 --retry-all-errors --max-time 120 \
+       "https://nlnetlabs.nl/downloads/ldns/ldns-${LDNS_VERSION}.tar.gz" -o ldns.tar.gz \
+ && curl -sSL --retry 3 --retry-delay 2 --retry-all-errors --max-time 60 \
+       "https://nlnetlabs.nl/downloads/ldns/ldns-${LDNS_VERSION}.tar.gz.asc" -o ldns.tar.gz.asc \
  && echo "${LDNS_SHA256}  ldns.tar.gz" | sha256sum -c - \
  && export GNUPGHOME="$(mktemp -d)" \
- && curl -sSL "https://nlnetlabs.nl/downloads/keys/releases-g2.asc" -o "$GNUPGHOME/releases-g2.asc" \
+ && curl -sSL --retry 3 --retry-delay 2 --retry-all-errors --max-time 60 \
+       "https://nlnetlabs.nl/downloads/keys/releases-g2.asc" -o "$GNUPGHOME/releases-g2.asc" \
  && gpg --no-tty --import "$GNUPGHOME/releases-g2.asc" \
  && gpg --batch --verify ldns.tar.gz.asc ldns.tar.gz \
  && tar xzf ldns.tar.gz --strip 1