mirror of https://github.com/openspug/spug
A api update
parent
26e3c103ce
commit
350edfe018
|
@ -28,6 +28,7 @@ def deploy_dispatch(request, req, token):
|
||||||
)
|
)
|
||||||
if req.app.extend == '1':
|
if req.app.extend == '1':
|
||||||
env.update(json.loads(req.app.extend_obj.custom_envs))
|
env.update(json.loads(req.app.extend_obj.custom_envs))
|
||||||
|
helper.local(f'cd {REPOS_DIR} && rm -rf {req.app_id}_*')
|
||||||
_ext1_deploy(request, req, helper, env)
|
_ext1_deploy(request, req, helper, env)
|
||||||
else:
|
else:
|
||||||
_ext2_deploy(request, req, helper, env)
|
_ext2_deploy(request, req, helper, env)
|
||||||
|
@ -73,7 +74,7 @@ def _ext1_deploy(request, req, helper, env):
|
||||||
Thread(target=_deploy_host, args=(helper, h_id, extend, env)).start()
|
Thread(target=_deploy_host, args=(helper, h_id, extend, env)).start()
|
||||||
|
|
||||||
|
|
||||||
def _ext2_deploy(request, rds, req, token, env):
|
def _ext2_deploy(request, req, helper, env):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,6 +87,9 @@ def _deploy_host(helper, h_id, extend, env):
|
||||||
code, _ = ssh.exec_command(f'mkdir -p {extend.dst_repo} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]')
|
code, _ = ssh.exec_command(f'mkdir -p {extend.dst_repo} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]')
|
||||||
if code == 0:
|
if code == 0:
|
||||||
helper.send_error(host.id, f'please make sure the {extend.dst_dir!r} is not exists.')
|
helper.send_error(host.id, f'please make sure the {extend.dst_dir!r} is not exists.')
|
||||||
|
# clean
|
||||||
|
clean_command = f'ls -rd {env.APP_ID}_* | tail -n +{extend.versions + 1} | xargs rm -rf'
|
||||||
|
helper.remote(host.id, ssh, f'cd {extend.dst_repo} && {clean_command}')
|
||||||
# transfer files
|
# transfer files
|
||||||
tar_gz_file = f'{env.VERSION}.tar.gz'
|
tar_gz_file = f'{env.VERSION}.tar.gz'
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue