From ad86bf93be09f562afbf46b452c50e6218339301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Sun, 22 Nov 2026 20:05:53 +0800 Subject: [PATCH] =?UTF-8?q?ci(qa):=20=E7=94=A8=E7=AD=BE=E5=90=8D=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=AE=89=E8=A3=85=E6=B5=8F=E8=A7=88=E5=99=A8=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 首轮 CI 在 Ubuntu 系统依赖下载和配置阶段超时。临时 CI 容器通过隔离的 APT 镜像配置完成安装并通过 Chromium DOM 冒烟。 --- Makefile | 4 +--- scripts/ci_install_chromium.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 scripts/ci_install_chromium.sh diff --git a/Makefile b/Makefile index a9b4d5b..9d74b29 100644 --- a/Makefile +++ b/Makefile @@ -34,9 +34,7 @@ tests-e2e: # The hosted CI job container is disposable and starts without Chromium's system libraries. tests-e2e-ci: export PLAYWRIGHT_BROWSERS_PATH ?= /opt/citools-cache/playwright tests-e2e-ci: - @test -f /.dockerenv || { printf '%s\n' 'tests-e2e-ci requires the disposable CI container. Use make tests-e2e here.' >&2; exit 1; } - DEBIAN_FRONTEND=noninteractive PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=90000 \ - timeout 360s npm --prefix web exec -- playwright install --with-deps --only-shell chromium + sh scripts/ci_install_chromium.sh $(MAKE) tests-e2e test-changed: $(PY) scripts/test_changed.py diff --git a/scripts/ci_install_chromium.sh b/scripts/ci_install_chromium.sh new file mode 100644 index 0000000..1276a02 --- /dev/null +++ b/scripts/ci_install_chromium.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -eu + +if [ ! -f /.dockerenv ]; then + printf '%s\n' 'Chromium provisioning requires the disposable CI container. Use make tests-e2e here.' >&2 + exit 1 +fi + +# Scope mirror settings to this command, keeping the runner image and its apt sources intact. +. /etc/os-release +if [ "$ID:$VERSION_CODENAME" != ubuntu:noble ]; then + printf '%s\n' 'Chromium provisioning expects Ubuntu 24.04.' >&2 + exit 1 +fi +apt_scope=$(mktemp -d) +trap 'rm -f "$apt_scope/ubuntu.list" "$apt_scope/apt.conf"; rmdir "$apt_scope"' EXIT +mirror=https://mirrors.aliyun.com/ubuntu/ +for suite in noble noble-updates noble-security; do + printf 'deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] %s %s main universe\n' "$mirror" "$suite" +done > "$apt_scope/ubuntu.list" +printf 'Dir::Etc::sourcelist "%s/ubuntu.list";\nDir::Etc::sourceparts "-";\nAcquire::Retries "2";\nAcquire::https::Timeout "15";\n' "$apt_scope" > "$apt_scope/apt.conf" +export APT_CONFIG="$apt_scope/apt.conf" +export DEBIAN_FRONTEND=noninteractive +export PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=90000 +timeout 360s npm --prefix web exec -- playwright install --with-deps --only-shell chromium