修复 runtime 路径问题,使用绝对路径
This commit is contained in:
parent
238d0276d8
commit
2e4d866634
|
|
@ -21,10 +21,23 @@ class Deployer:
|
||||||
"""初始化部署器"""
|
"""初始化部署器"""
|
||||||
self.config = config
|
self.config = config
|
||||||
self.logger = logging.getLogger('Deployer')
|
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_url = config['main_repository']['url']
|
||||||
self.main_repo_branch = config['main_repository']['branch']
|
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):
|
def run_command(self, cmd, cwd=None, timeout=600):
|
||||||
"""执行命令"""
|
"""执行命令"""
|
||||||
self.logger.info(f"执行命令: {cmd}")
|
self.logger.info(f"执行命令: {cmd}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue