修改容器化的配置
This commit is contained in:
parent
a044356623
commit
12fb2130e9
|
|
@ -117,14 +117,36 @@ class Deployer:
|
||||||
if not self.run_command("git pull", cwd=repo_path):
|
if not self.run_command("git pull", cwd=repo_path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# 更新所有子模块
|
# 初始化子模块(如果还没初始化)
|
||||||
if not self.run_command("git submodule update --init --recursive", cwd=repo_path):
|
if not self.run_command("git submodule update --init --recursive", cwd=repo_path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# 更新所有子模块到各自配置的分支
|
||||||
|
self.logger.info("更新所有子模块到最新代码...")
|
||||||
|
if not self.update_all_submodules(repo_path):
|
||||||
|
return False
|
||||||
|
|
||||||
self.logger.info("主仓库更新成功")
|
self.logger.info("主仓库更新成功")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def update_all_submodules(self, repo_path):
|
||||||
|
"""更新所有子模块到各自配置的分支"""
|
||||||
|
# 遍历所有配置的仓库,更新子模块到对应分支
|
||||||
|
for repo_config in self.config['repositories']:
|
||||||
|
branch = repo_config['branch']
|
||||||
|
submodule_path = repo_config['path']
|
||||||
|
|
||||||
|
self.logger.info(f"更新子模块 {repo_config['name']} 到分支 {branch}")
|
||||||
|
|
||||||
|
# 构建命令:进入子模块,切换分支并拉取
|
||||||
|
cmd = f"cd {submodule_path} && git checkout {branch} && git pull origin {branch}"
|
||||||
|
if not self.run_command(cmd, cwd=repo_path, timeout=300):
|
||||||
|
self.logger.warning(f"子模块 {repo_config['name']} 更新失败,继续处理其他子模块")
|
||||||
|
continue
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def update_submodule(self, repo_config):
|
def update_submodule(self, repo_config):
|
||||||
"""更新指定的子模块"""
|
"""更新指定的子模块"""
|
||||||
repo_path = self.runtime_path / 'a-cloud-all'
|
repo_path = self.runtime_path / 'a-cloud-all'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue