ci(ubuntu): use AWS regional mirror for apt in compile workflow

The compile_ubuntu workflow's apt operations talk directly to
archive.ubuntu.com, which round-robins across community mirrors that
occasionally serve out-of-sync index files mid-sync and break apt update
for everyone until the upstream catches up.

Apply the same mirror swap as build_deb_package.yml: rewrite the
container's apt sources to point at us-west-2.ec2.archive.ubuntu.com
before any apt operation runs, so both the inline 'apt update' and the
later Tools/setup/ubuntu.sh call benefit from the regional mirror.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche 2026-04-07 18:11:55 -07:00
parent f77a1a44a0
commit 2798910293

View File

@ -38,6 +38,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
# we only need this because we are running the job in a container
# when checkout pulls git it does it in a shared volume
# and file ownership changes between steps