From cff9edbfbcf4bc859a0e17e847ef05b960271c61 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 6 Dec 2026 10:17:54 +0800 Subject: [PATCH] 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 --- .github/actions/ubuntu-archive/action.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/actions/ubuntu-archive/action.yml b/.github/actions/ubuntu-archive/action.yml index 319da5362f3..6640c1bd3a8 100644 --- a/.github/actions/ubuntu-archive/action.yml +++ b/.github/actions/ubuntu-archive/action.yml @@ -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.