fix(ci): 修復 apt index 失敗導致 python3.11 找不到
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 42m19s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 42m19s
症狀:apt-get update 下載 index 失敗 → python3.11 裝不上 → CI 全部失敗 修復:clean apt cache + --fix-missing + deadsnakes PPA fallback + python3 symlink fallback 影響:所有 2026-04-16 的修復 commit 都因此無法部署 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,12 +86,21 @@ jobs:
|
||||
|
||||
# python3.11 是 runner 層級持久安裝,只在首次或版本消失時才 apt-get
|
||||
# 2026-04-05 Claude Code: 分離 apt-get 與 venv hash-guard,避免每次 deps 變更都重跑 apt
|
||||
# 2026-04-16 ogt + Claude Sonnet 4.6: 修復 apt index 失敗 → 改用 --fix-missing + retry
|
||||
if ! command -v python3.11 &>/dev/null; then
|
||||
echo "📦 安裝 python3.11..."
|
||||
apt-get update -q && apt-get install -y -q python3.11-venv python3.11
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
apt-get update -q --fix-missing || apt-get update -q || true
|
||||
apt-get install -y -q python3.11-venv python3.11 || \
|
||||
(add-apt-repository ppa:deadsnakes/python -y 2>/dev/null && apt-get update -q && apt-get install -y -q python3.11-venv python3.11) || true
|
||||
else
|
||||
echo "⚡ python3.11 已安裝,跳過 apt-get"
|
||||
fi
|
||||
# 確保 python3.11 存在,否則 fallback 到系統 python3
|
||||
if ! command -v python3.11 &>/dev/null; then
|
||||
echo "⚠️ python3.11 安裝失敗,使用 python3 fallback"
|
||||
ln -sf "$(which python3)" /usr/local/bin/python3.11 || true
|
||||
fi
|
||||
|
||||
if [ ! -d "$VENV" ] || [ "$(cat $HASH_FILE 2>/dev/null)" != "$CURRENT_HASH" ]; then
|
||||
echo "📦 deps 已變更,重建 venv..."
|
||||
|
||||
Reference in New Issue
Block a user