ci(deb): use AWS regional mirror for apt in deb build container

The default archive.ubuntu.com round-robin can serve out-of-sync index
files mid-sync, which makes apt-get update fail with 'File has unexpected
size' errors and breaks the deb build job for everyone until the upstream
mirror catches up.

Rewrite the container's apt sources to point at us-west-2.ec2.archive.
ubuntu.com instead. The EC2 archive mirrors are Canonical-operated,
region-local to the runs-on instances, and sync aggressively, eliminating
the round-robin lottery as a CI failure mode.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche 2026-04-07 17:58:14 -07:00
parent 4da1c11db9
commit 1ba562f400

View File

@ -90,6 +90,17 @@ jobs:
- name: Fix git in container
run: |
# Switch to AWS regional mirrors. runs-on instances are in us-west-2,
# and the EC2 archive mirrors are Canonical-operated, region-local,
# and sync aggressively. The default archive.ubuntu.com round-robin
# sometimes serves out-of-sync index files mid-sync, breaking
# apt-get update.
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sed -i 's|http://archive.ubuntu.com/ubuntu|http://us-west-2.ec2.archive.ubuntu.com/ubuntu|g; s|http://security.ubuntu.com/ubuntu|http://us-west-2.ec2.archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources
fi
if [ -f /etc/apt/sources.list ]; then
sed -i 's|http://archive.ubuntu.com/ubuntu|http://us-west-2.ec2.archive.ubuntu.com/ubuntu|g; s|http://security.ubuntu.com/ubuntu|http://us-west-2.ec2.archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list
fi
apt-get update && apt-get install -y git
git config --global --add safe.directory $(realpath .)