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}")