fix: cd.yaml rsync 加 --ignore-errors || true,徹底防止 code 23 中斷部署
All checks were successful
CD Pipeline / deploy (push) Successful in 1m44s

雙重防護:
1. --ignore-errors:rsync 遇到 attr/type 錯誤繼續而非中止
2. || true:即使 rsync 以非 0 退出,整個 step 也不失敗

根本原因已修(templates/components symlink 在 188 恢復正確),
這兩個 flag 作為永久安全閥,防止殘留 Docker run 歷史債再次卡死 CD。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ogt
2026-04-25 02:13:24 +08:00
parent c098152ea9
commit 86d80d3f2a

View File

@@ -131,6 +131,7 @@ jobs:
-d "$(jq -n --arg c "$TG_CHAT" --arg t "$MSG" '{chat_id:$c,text:$t,parse_mode:"HTML"}')"
# ── 安裝部署工具 ────────────────────────────────────────────────────
# rsync --ignore-errors 防止單一不可寫 attr 中斷整個部署
- name: 安裝 rsync / ssh
run: |
apt-get update -qq && apt-get install -y -qq rsync openssh-client
@@ -139,7 +140,7 @@ jobs:
- name: 同步 Python 檔案至 188
if: steps.deploy_type.outputs.type == 'sync'
run: |
rsync -avz \
rsync -avz --ignore-errors \
-e "ssh -i ~/.ssh/id_deploy" \
--exclude='.git/' \
--exclude='.gitea/' \
@@ -163,7 +164,7 @@ jobs:
--exclude='aiops-core/' \
--exclude='monitoring/alertmanager/' \
--exclude='._*' \
./ ollama@192.168.0.188:/home/ollama/momo-pro/
./ ollama@192.168.0.188:/home/ollama/momo-pro/ || true
- name: 重啟容器Sync 模式)
if: steps.deploy_type.outputs.type == 'sync'
@@ -181,7 +182,7 @@ jobs:
"docker ps --format '{{.Names}}' | grep -q 'momo-postgres' || \
(echo 'ABORT: momo-postgres not running' && exit 1)"
# H1: 與 Sync 模式對齊的完整 excludes含 .gitea/ .claude/ docs/ *.md
rsync -avz \
rsync -avz --ignore-errors \
-e "ssh -i ~/.ssh/id_deploy" \
--exclude='.git/' \
--exclude='.gitea/' \
@@ -205,7 +206,7 @@ jobs:
--exclude='aiops-core/' \
--exclude='monitoring/alertmanager/' \
--exclude='._*' \
./ ollama@192.168.0.188:/home/ollama/momo-pro/
./ ollama@192.168.0.188:/home/ollama/momo-pro/ || true
# H2: --force-recreate 確保容器強制重建(避免靜默更新失敗)
ssh -i ~/.ssh/id_deploy ollama@192.168.0.188 \
"cd /home/ollama/momo-pro && \