From 2e4d866634b3533e0bd62035eb2fb315f594f592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Fri, 9 Jan 2026 17:50:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20runtime=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BD=BF=E7=94=A8=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .devops/deployer.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.devops/deployer.py b/.devops/deployer.py index 4d9bf6d..6ae8c2d 100644 --- a/.devops/deployer.py +++ b/.devops/deployer.py @@ -21,10 +21,23 @@ class Deployer: """初始化部署器""" self.config = config self.logger = logging.getLogger('Deployer') - self.runtime_path = Path(config['main_repository']['runtime_path']) + + # 获取项目根目录(.devops 的父目录) + project_root = Path(__file__).parent.parent.resolve() + + # 将 runtime_path 转换为绝对路径 + runtime_path = config['main_repository']['runtime_path'] + if not Path(runtime_path).is_absolute(): + self.runtime_path = project_root / runtime_path + else: + self.runtime_path = Path(runtime_path) + self.main_repo_url = config['main_repository']['url'] self.main_repo_branch = config['main_repository']['branch'] + self.logger.info(f"项目根目录: {project_root}") + self.logger.info(f"Runtime 目录: {self.runtime_path}") + def run_command(self, cmd, cwd=None, timeout=600): """执行命令""" self.logger.info(f"执行命令: {cmd}")