MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / execute_deploy_script

Function execute_deploy_script

mod/project/git/scripts/deploy.py:86–104  ·  view source on GitHub ↗

执行部署脚本

(site_path, deploy_script)

Source from the content-addressed store, hash-verified

84 pass
85
86def execute_deploy_script(site_path, deploy_script):
87 """执行部署脚本"""
88 if not deploy_script:
89 return True, ""
90
91 log("执行部署脚本...")
92 script_file = f"/tmp/deploy_{int(time.time())}.sh"
93 try:
94 with open(script_file, 'w') as f:
95 f.write(f"cd {site_path}\n{deploy_script}")
96 os.chmod(script_file, 0o755)
97
98 if not run_cmd(f"bash {script_file}"):
99 return False, "部署脚本执行失败"
100
101 return True, ""
102 finally:
103 if os.path.exists(script_file):
104 os.remove(script_file)
105
106def auto_deploy(config):
107 """自动部署(无分支无commit)"""

Callers 3

auto_deployFunction · 0.85
manual_branch_deployFunction · 0.85
manual_rollback_deployFunction · 0.85

Calls 7

openFunction · 0.85
timeMethod · 0.80
logFunction · 0.70
run_cmdFunction · 0.70
writeMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected