chore: Add quiet flag to git commands and exclude data directory from uvicorn hot reload.

This commit is contained in:
vinland100 2026-01-06 16:45:12 +08:00
parent 4e7a4c5d9c
commit 99a73c7706
2 changed files with 9 additions and 9 deletions

View File

@ -432,16 +432,16 @@ class CIService:
logger.info(f"🔄 Updating repo at {target_dir}")
try:
# git fetch --all
subprocess.run(["git", "fetch", "--all"], cwd=target_dir, check=True)
subprocess.run(["git", "fetch", "-q", "--all"], cwd=target_dir, check=True)
if pr_number:
# Fetch PR ref specifically from base repo: refs/pull/ID/head
logger.info(f"📥 Fetching PR ref: refs/pull/{pr_number}/head")
subprocess.run(["git", "fetch", "origin", f"refs/pull/{pr_number}/head"], cwd=target_dir, check=True)
subprocess.run(["git", "checkout", "FETCH_HEAD"], cwd=target_dir, check=True)
subprocess.run(["git", "fetch", "-q", "origin", f"refs/pull/{pr_number}/head"], cwd=target_dir, check=True)
subprocess.run(["git", "checkout", "-q", "FETCH_HEAD"], cwd=target_dir, check=True)
else:
# git checkout branch
subprocess.run(["git", "checkout", branch], cwd=target_dir, check=True)
subprocess.run(["git", "checkout", "-q", branch], cwd=target_dir, check=True)
# git reset --hard origin/branch
subprocess.run(["git", "reset", "--hard", f"origin/{branch}"], cwd=target_dir, check=True)
except Exception as e:
@ -457,10 +457,10 @@ class CIService:
if pr_number:
logger.info(f"📥 Fetching PR ref: refs/pull/{pr_number}/head")
subprocess.run(["git", "fetch", "origin", f"refs/pull/{pr_number}/head"], cwd=target_dir, check=True)
subprocess.run(["git", "checkout", "FETCH_HEAD"], cwd=target_dir, check=True)
subprocess.run(["git", "fetch", "-q", "origin", f"refs/pull/{pr_number}/head"], cwd=target_dir, check=True)
subprocess.run(["git", "checkout", "-q", "FETCH_HEAD"], cwd=target_dir, check=True)
else:
subprocess.run(["git", "checkout", branch], cwd=target_dir, check=True)
subprocess.run(["git", "checkout", "-q", branch], cwd=target_dir, check=True)
except Exception as e:
logger.error(f"Git clone failed: {e}")
raise e

View File

@ -37,7 +37,7 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./backend/app:/app/app:ro # 挂载代码目录,修改后自动生效
- ./backend/app:/app/app:ro # 挂载代码目录,修改后自动生效
- backend_uploads:/app/uploads
- chroma_data:/app/data/vector_db
- /var/run/docker.sock:/var/run/docker.sock # 沙箱执行必须
@ -65,7 +65,7 @@ services:
redis:
condition: service_healthy
# 开发模式:启用 --reload 热重载
command: sh -c ".venv/bin/alembic upgrade head && .venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
command: sh -c ".venv/bin/alembic upgrade head && .venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --reload-exclude 'data/*'"
networks:
- deepaudit-network