修复路径问题:直接克隆到 runtime 目录而不是 runtime/a-cloud-all

This commit is contained in:
孙小云 2026-01-09 17:56:23 +08:00
parent 2e4d866634
commit dd4ce57388
1 changed files with 13 additions and 11 deletions

View File

@ -68,14 +68,16 @@ class Deployer:
def ensure_main_repo(self):
"""确保主仓库存在并是最新的"""
repo_path = self.runtime_path / 'a-cloud-all'
# 直接使用 runtime_path 作为仓库路径
repo_path = self.runtime_path
if not repo_path.exists():
if not repo_path.exists() or not (repo_path / '.git').exists():
self.logger.info("主仓库不存在,开始克隆...")
self.runtime_path.mkdir(parents=True, exist_ok=True)
repo_path.parent.mkdir(parents=True, exist_ok=True)
# 克隆到 runtime 目录
cmd = f"git clone --recurse-submodules {self.main_repo_url} {repo_path}"
if not self.run_command(cmd, cwd=self.runtime_path):
if not self.run_command(cmd, cwd=repo_path.parent):
self.logger.error("克隆主仓库失败")
return False
@ -101,7 +103,7 @@ class Deployer:
def update_submodule(self, repo_config):
"""更新指定的子模块"""
repo_path = self.runtime_path / 'a-cloud-all'
repo_path = self.runtime_path
submodule_path = repo_path / repo_config['path']
self.logger.info(f"更新子模块: {repo_config['name']}")
@ -125,7 +127,7 @@ class Deployer:
def build_project(self, repo_config):
"""构建项目"""
repo_path = self.runtime_path / 'a-cloud-all'
repo_path = self.runtime_path
submodule_path = repo_path / repo_config['path']
self.logger.info(f"开始构建: {repo_config['name']}")
@ -142,7 +144,7 @@ class Deployer:
def copy_artifacts(self, repo_config):
"""复制构建产物到 docker 目录"""
repo_path = self.runtime_path / 'a-cloud-all'
repo_path = self.runtime_path
submodule_path = repo_path / repo_config['path']
self.logger.info(f"复制构建产物: {repo_config['name']}")
@ -183,7 +185,7 @@ class Deployer:
def run_deploy_script(self, repo_config):
"""执行部署脚本"""
repo_path = self.runtime_path / 'a-cloud-all'
repo_path = self.runtime_path
script_name = repo_config['deploy_script']
script_path = repo_path / '.devops' / 'scripts' / script_name
@ -213,7 +215,7 @@ class Deployer:
self.logger.info("自动提交已禁用,跳过")
return True
repo_path = self.runtime_path / 'a-cloud-all'
repo_path = self.runtime_path
self.logger.info("提交子模块更新到主仓库")
@ -296,7 +298,7 @@ class Deployer:
if 'infrastructure' not in self.config:
return True
repo_path = self.runtime_path / 'a-cloud-all'
repo_path = self.runtime_path
for infra in self.config['infrastructure']:
name = infra['name']