From 86d80d3f2afac57c022464f820c32abc05432550 Mon Sep 17 00:00:00 2001 From: ogt Date: Sat, 25 Apr 2026 02:13:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cd.yaml=20rsync=20=E5=8A=A0=20--ignore-e?= =?UTF-8?q?rrors=20||=20true=EF=BC=8C=E5=BE=B9=E5=BA=95=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=20code=2023=20=E4=B8=AD=E6=96=B7=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 雙重防護: 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 --- .gitea/workflows/cd.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index 3c68bff..73ae1d9 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -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 && \