From 758b9c2b7158dd5f6ecd80d3ced7810405bc54c6 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Fri, 23 Oct 2026 00:32:31 -0700 Subject: [PATCH] ci: avoid slow Ubuntu mirrors during WebKit setup (#32205) * ci: reuse bounded Ubuntu mirror setup for WebKit * ci: preserve Ubuntu setup for dispatched older refs --- .github/scripts/prepare-ubuntu-apt.sh | 14 ++++++++++++++ .github/workflows/e2e.yml | 18 +++++++++++------- .github/workflows/pr.yml | 4 +++- config/scripts/pr-code-change-scope.mjs | 1 + config/scripts/pr-e2e-source-routing.mjs | 1 + config/scripts/pr-layout-oracle-route.mjs | 1 + 6 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .github/scripts/prepare-ubuntu-apt.sh diff --git a/.github/scripts/prepare-ubuntu-apt.sh b/.github/scripts/prepare-ubuntu-apt.sh new file mode 100644 index 00000000000..c179dd4ccf4 --- /dev/null +++ b/.github/scripts/prepare-ubuntu-apt.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +# GitHub's mirror+file sources resolve through apt-mirrors.txt, not just sources.list. +for source in /etc/apt/apt-mirrors.txt /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do + if [ -f "$source" ]; then + sudo sed -i 's|https*://azure\.archive\.ubuntu\.com/ubuntu|https://archive.ubuntu.com/ubuntu|g' "$source" + fi +done +sudo tee /etc/apt/apt.conf.d/99-orca-ci >/dev/null <<'APTCONF' +Acquire::http::Timeout "15"; +Acquire::https::Timeout "15"; +Acquire::Retries "1"; +APTCONF diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 604594879f5..553b8918e78 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -88,17 +88,21 @@ jobs: exit 0 fi read -r -a packages <<< "$ORCA_E2E_APT_PACKAGES" - # Why apt-mirrors.txt: runner images resolve mirror+file: sources through it, so editing the lists alone leaves Azure in use. - for source in /etc/apt/apt-mirrors.txt /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do - if [ -f "$source" ]; then - sudo sed -i 's|https*://azure\.archive\.ubuntu\.com/ubuntu|https://archive.ubuntu.com/ubuntu|g' "$source" - fi - done - sudo tee /etc/apt/apt.conf.d/99-orca-e2e >/dev/null <<'APTCONF' + if [ -f .github/scripts/prepare-ubuntu-apt.sh ]; then + bash .github/scripts/prepare-ubuntu-apt.sh + else + # Dispatched refs can predate the shared preparation script. + for source in /etc/apt/apt-mirrors.txt /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; do + if [ -f "$source" ]; then + sudo sed -i 's|https*://azure\.archive\.ubuntu\.com/ubuntu|https://archive.ubuntu.com/ubuntu|g' "$source" + fi + done + sudo tee /etc/apt/apt.conf.d/99-orca-ci >/dev/null <<'APTCONF' Acquire::http::Timeout "15"; Acquire::https::Timeout "15"; Acquire::Retries "1"; APTCONF + fi timeout 120 sudo apt-get update timeout 300 sudo apt-get install -y "${packages[@]}" || timeout 300 sudo apt-get install -y --fix-missing "${packages[@]}" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bdccc7236a2..35751badddc 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -939,7 +939,9 @@ jobs: - name: Install WebKit for the drawer check id: webkit background: true - run: pnpm exec playwright-core install --with-deps webkit + run: | + bash .github/scripts/prepare-ubuntu-apt.sh + pnpm exec playwright-core install --with-deps webkit # The entry lives in mobile/ so one React resolves; without this every RN import is nothing. - uses: ./.github/actions/install-mobile-dependencies diff --git a/config/scripts/pr-code-change-scope.mjs b/config/scripts/pr-code-change-scope.mjs index faef257fa1d..f9840d5de37 100644 --- a/config/scripts/pr-code-change-scope.mjs +++ b/config/scripts/pr-code-change-scope.mjs @@ -173,6 +173,7 @@ const DEPENDENCY_ISOLATION_PREFIXES = [ ] const MOBILE_WEB_APP_PREFIXES = [ + '.github/scripts/prepare-ubuntu-apt.sh', 'config/scripts/build-mobile-web-app', 'config/scripts/run-mobile-web-app-checks', 'src/packages/process-host/', diff --git a/config/scripts/pr-e2e-source-routing.mjs b/config/scripts/pr-e2e-source-routing.mjs index 4d555a72c1b..b62dc9cdaeb 100644 --- a/config/scripts/pr-e2e-source-routing.mjs +++ b/config/scripts/pr-e2e-source-routing.mjs @@ -520,6 +520,7 @@ export function selectPrE2eSpecs( (file.startsWith('tests/e2e/helpers/') && [...specs].some((spec) => spec.startsWith(MANAGED_SSH_E2E_SPEC_PREFIX))) || file === '.github/workflows/e2e.yml' || + file === '.github/scripts/prepare-ubuntu-apt.sh' || file === 'config/scripts/ci-e2e-job-selection.mjs' ) ) { diff --git a/config/scripts/pr-layout-oracle-route.mjs b/config/scripts/pr-layout-oracle-route.mjs index 3c659cdf547..8050842b504 100644 --- a/config/scripts/pr-layout-oracle-route.mjs +++ b/config/scripts/pr-layout-oracle-route.mjs @@ -62,6 +62,7 @@ const LAYOUT_ORACLE_PREFIXES = [ '.github/scripts/e2e-with-window-manager.sh', // The job itself: the called workflow, its window-spec lane picker, and this route. '.github/workflows/e2e.yml', + '.github/scripts/prepare-ubuntu-apt.sh', 'config/scripts/ci-e2e-job-selection.mjs', 'config/scripts/pr-layout-oracle-route.mjs' ]