fix(ci): use the Ubuntu Azure archive on Noble and Resolute (#17341)

* fix(ci): use the Ubuntu Azure archive on Resolute

* fix(ci): restore Noble archive access
This commit is contained in:
Vincent Koc
2026-12-06 10:17:54 +08:00
committed by GitHub
parent c58c6e768c
commit cff9edbfbc
+12 -7
View File
@@ -11,18 +11,23 @@ runs:
env:
REA_NOBLE_AZURE_FALLBACK: ${{ inputs.noble-azure-fallback }}
run: |
if [[ "$REA_NOBLE_AZURE_FALLBACK" == 'true' ]]; then
. /etc/os-release
if [[ "${ID:-}" != ubuntu || "${VERSION_CODENAME:-}" != noble ]]; then
echo 'The Azure archive fallback is only configured for Ubuntu Noble' >&2
exit 1
fi
. /etc/os-release
if [[ "$REA_NOBLE_AZURE_FALLBACK" == 'true' &&
( "${ID:-}" != ubuntu || "${VERSION_CODENAME:-}" != noble ) ]]; then
echo 'The Azure archive fallback is only configured for Ubuntu Noble' >&2
exit 1
fi
archive_host=archive.ubuntu.com
# Hosted CI has timed out fetching indexes and packages from the standard archive.
if [[ "${ID:-}" == ubuntu &&
( "${VERSION_CODENAME:-}" == noble || "${VERSION_CODENAME:-}" == resolute ) ]]; then
archive_host=azure.archive.ubuntu.com
fi
# Hosted Ubuntu runners can use Azure or regional EC2 mirrors.
sources=(/etc/apt/apt-mirrors.txt /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources)
for source in "${sources[@]}"; do
if [ -f "$source" ]; then
sudo sed -Ei.bak 's|https?://([[:alnum:]-]+\.)*archive\.ubuntu\.com/|https://archive.ubuntu.com/|g' "$source"
sudo sed -Ei.bak "s|https?://([[:alnum:]-]+\\.)*archive\\.ubuntu\\.com/|https://${archive_host}/|g" "$source"
fi
done
# Fixture installation needs package indexes, not localized descriptions.