fix: bwrap 多路径检测(环境变量+已知位置兜底)

This commit is contained in:
ymq 2026-08-13 18:07:16 +08:00
parent 29a4a5e0ef
commit 011dd9cb95

View File

@ -23,9 +23,15 @@ logger = logging.getLogger("pipeline.deploy_account")
DEPLOY_ENV_BASE = "/d/pipeline/deploy_envs"
# bwrap 可执行文件(未安装时为 None,降级为目录隔离)
# 检测顺序:系统 PATH → 环境变量 → 已知安装位置
BWRAP = shutil.which("bwrap")
if not BWRAP and os.path.exists("/d/pipeline/bin/bwrap"):
BWRAP = "/d/pipeline/bin/bwrap"
for _p in (
os.environ.get("BWRAP_PATH", ""),
"/d/pipeline/bin/bwrap",
"/d/pipeline/pipeline-app/bin/bwrap",
):
if not BWRAP and _p and os.path.exists(_p):
BWRAP = _p
# 账号名合法字符(目录安全,防路径穿越)
_SAFE_RE = re.compile(r"[^a-zA-Z0-9_-]")