F 修复某些情况下保留历史版本不正确的问题

pull/111/head
vapao 2020-06-05 21:21:44 +08:00
parent c7a4055a33
commit e36897d3fc
1 changed files with 1 additions and 1 deletions

View File

@ -141,7 +141,7 @@ def _deploy_ext1_host(helper, h_id, extend, env):
if code == 0:
helper.send_error(host.id, f'please make sure the {extend.dst_dir!r} is not exists.')
# clean
clean_command = f'ls -rd {extend.deploy_id}_* 2> /dev/null | tail -n +{extend.versions + 1} | xargs rm -rf'
clean_command = f'ls -d {extend.deploy_id}_* 2> /dev/null | sort -t _ -rnk2 | tail -n +{extend.versions + 1} | xargs rm -rf'
helper.remote(host.id, ssh, f'cd {extend.dst_repo} && rm -rf {env.SPUG_VERSION} && {clean_command}')
# transfer files
tar_gz_file = f'{env.SPUG_VERSION}.tar.gz'