Skip to content

fix(build): retry network downloads in container builds - #535

Merged
MaxRink merged 2 commits into
mainfrom
fix/initramfs-download-retries
Aug 19, 2026
Merged

fix(build): retry network downloads in container builds#535
MaxRink merged 2 commits into
mainfrom
fix/initramfs-download-retries

Conversation

@MaxRink

@MaxRink MaxRink commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Run 31880810092 on main failed in Build Flavors (arm64 default, path-filtered):

#40 [lvm 2/12] RUN wget -O "LVM2.2.03.27.tgz" https://mirrors.kernel.org/sourceware/lvm2/LVM2.2.03.27.tgz
#40 48.75 GnuTLS: Error in the pull function.
#40 48.75 Unable to establish SSL connection.
ERROR: process did not complete successfully: exit code: 4

One unretried wget broke the whole build.

Change, applied to every network fetch in the container builds:

  • wget: --tries=5 --waitretry=10 --retry-connrefused --timeout=30 plus retry on 429 and 5xx
  • curl: --retry 5 --retry-delay 5 --retry-connrefused --connect-timeout 30
  • apt-get update, install and download: -o Acquire::Retries=5
  • apk add, git clone, git fetch, go mod download: an until loop with 5 attempts and 10 second backoff

Integrity is unchanged. The LVM2 sha256 check, the FRR key fingerprint check, the pinned util-linux commit and apt signature checks all stay, so a retry cannot hide a corrupt artifact.

The retry loops fail closed. Each loop exits non-zero once the attempts run out, so an exhausted retry breaks the build instead of passing silently. Compare kubernetes-sigs/image-builder#2138, where retries existed but never took effect.

TestDockerfileDownloadsRetry enforces this. It flags a fetch without retry and a loop without a fail-closed exit. It found three real gaps while I wrote it (go mod download in the three test images), and it fails when I remove the wget flags again.

Verified locally with docker:

  • the LVM2 fetch plus checksum step builds, LVM2.2.03.27.tgz: OK
  • the sfdisk stage builds, covering apt retries and both git retry loops
  • the dev stage builds, covering the apk and go mod download loops
  • docker buildx build --check is clean on all five files, apart from two WorkdirRelativePath warnings that already exist on main
  • go test . passes

Not changed, reported instead: test/e2e/clab/vrnetlab/Dockerfile and initrd.Dockerfile still pin golang:1.26.5-alpine, one minor release behind the 1.26.6 toolchain that #532 put in the workflows.

#536 stacks on this branch and does that bump, including the micro-dev stage. Merge this PR first, then #536.

One transient TLS failure on a mirror broke the whole arm64 initramfs build and with it CI on main. The LVM2 wget had no retry.

Every network fetch now retries with backoff. apt-get uses Acquire::Retries, curl uses --retry, wget uses --tries. apk add, git clone, git fetch and go mod download use an until loop that exits non-zero once the attempts run out.

Checksum and signature checks stay in place, so a retry cannot hide a corrupt artifact. A new guard test fails the build when a fetch carries no retry, or when a retry loop cannot fail.
Copilot AI lite review requested due to automatic review settings August 15, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The dev and micro-dev stages build the shipped init binary. Both still used Go 1.26.5, which carries six stdlib findings. The vrnetlab test builder used the same pin.

Go 1.26.6 fixes GO-2026-5026, GO-2026-5972, GO-2026-6089, GO-2026-6090, GO-2026-6091 and GO-2026-6218.
Copilot AI review requested due to automatic review settings August 19, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MaxRink
MaxRink merged commit a555a3e into main Aug 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants