Files
knowledge-governance/scripts/ci_install_chromium.sh
T
姚章浩 ad86bf93be
build / build (push) Successful in 3m58s
ci(qa): 用签名镜像安装浏览器依赖
首轮 CI 在 Ubuntu 系统依赖下载和配置阶段超时。临时 CI 容器通过隔离的 APT 镜像配置完成安装并通过 Chromium DOM 冒烟。
2026-11-22 20:05:53 +08:00

26 lines
1.1 KiB
Bash

#!/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