fix: guard static asset deploy permissions
Some checks failed
CD Pipeline / deploy (push) Failing after 1m9s
Some checks failed
CD Pipeline / deploy (push) Failing after 1m9s
This commit is contained in:
@@ -402,7 +402,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
|
||||
# ==========================================
|
||||
# 系統版本與路徑
|
||||
# ==========================================
|
||||
SYSTEM_VERSION = "V10.700"
|
||||
SYSTEM_VERSION = "V10.701"
|
||||
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
|
||||
public_url = PUBLIC_URL # 用於模板顯示
|
||||
|
||||
|
||||
@@ -777,3 +777,4 @@ POSTGRES_HOST=momo-db
|
||||
| 2026-06-25 | 治理與匯入頁也不得外露模型/權杖/欄位口徑 | V10.698 起缺貨匯入、供應商窗口、AI 歷史、預算、AI 流量、AI 分工與主機健康頁統一改用「必要資料、用量、建議引擎、建議路徑、雲端備援、AI 建議服務」等前台可讀詞,避免使用者在營運頁看到 raw model、token、欄位或模型品牌。 |
|
||||
| 2026-06-25 | 工具頁與簡報頁也必須使用作戰語言;Google Drive token 必須固定到持久化掛載 | V10.699 起簡報預覽、品牌素材、比價、匯入、缺貨與觀測台操作提示移除英文/內部流程字,改成可直接理解的狀態與下一步;正式容器明確指定 `/app/config/google_token.json` 與 `/app/config/google_credentials.json`,背景匯入不得因主機重啟或工作目錄變動而改找瀏覽器授權。 |
|
||||
| 2026-06-26 | 邊角治理頁不得把 raw caller、模型資料或推版代碼當主訊息 | V10.700 起 AI 流量、主機健康、通知模板與缺貨匯入提示再收斂為「使用情境、建議路徑、服務資料、更新摘要、先選擇供應商缺貨檔」等營運語言,避免低頻治理頁回流 `原始`、模型品牌、commit/pipeline 欄位或泛用檔案提示。 |
|
||||
| 2026-06-26 | 靜態資源部署必須保持容器可讀 | V10.701 起部署 SOP 改用 Git 物件打包差異檔,並以測試檢查 `web/static` 檔案可被容器讀取,避免 macOS / iCloud 工作目錄權限造成正式 `/static/*` 500,讓全站 CSS/JS 不再因檔案模式回歸而失效。 |
|
||||
|
||||
@@ -19,6 +19,19 @@ scp -o ProxyJump=wooo@192.168.0.110 app.py ollama@192.168.0.188:/home/ollama/mom
|
||||
scp -o ProxyJump=wooo@192.168.0.110 -r services/ ollama@192.168.0.188:/home/ollama/momo-pro/
|
||||
```
|
||||
|
||||
若使用 tar 打包差異檔,必須用 Git 物件建立部署包,避免 macOS / iCloud 工作目錄的 `600` 權限或 extended attributes 被帶到正式機,造成 `/static/*` 500:
|
||||
```bash
|
||||
BASE=<上一個已部署 commit>
|
||||
HEAD=$(git rev-parse HEAD)
|
||||
git diff --name-only "$BASE..$HEAD" > /tmp/momo-deploy-filelist.txt
|
||||
git archive --format=tar.gz -o /tmp/momo-deploy-files.tar.gz "$HEAD" $(cat /tmp/momo-deploy-filelist.txt)
|
||||
```
|
||||
|
||||
部署前本地必跑靜態檔可讀檢查:
|
||||
```bash
|
||||
.venv/bin/python -m pytest tests/test_frontend_v2_assets.py
|
||||
```
|
||||
|
||||
若部署時在 110 → 188 的內層 `scp` 遇到 `Host key verification failed`,先在 110 修正 `known_hosts`,不要用 `StrictHostKeyChecking=no` 硬跳過:
|
||||
```bash
|
||||
ssh wooo@192.168.0.110 \
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
import stat
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_static_assets_are_container_readable():
|
||||
unreadable = []
|
||||
for asset in (ROOT / "web/static").rglob("*"):
|
||||
if asset.is_file() and not (asset.stat().st_mode & stat.S_IROTH):
|
||||
unreadable.append(str(asset.relative_to(ROOT)))
|
||||
|
||||
assert unreadable == []
|
||||
|
||||
|
||||
def test_frontend_v2_shell_assets_exist_and_are_indexed():
|
||||
assert (ROOT / "web/static/css/ewoooc-tokens.css").exists()
|
||||
assert (ROOT / "web/static/css/ewoooc-shell.css").exists()
|
||||
|
||||
Reference in New Issue
Block a user