mirror of https://github.com/openspug/spug
A web update
parent
8638039198
commit
95ad5a149b
|
@ -51,7 +51,6 @@ def _ext1_deploy(request, req, helper, env):
|
|||
else:
|
||||
tree_ish = extras[1]
|
||||
env.update(TAG=extras[1])
|
||||
if req.type == '1':
|
||||
helper.local(f'cd {REPOS_DIR} && rm -rf {req.app_id}_*')
|
||||
helper.send_step('local', 1, '完成\r\n')
|
||||
|
||||
|
@ -101,7 +100,6 @@ 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} ]')
|
||||
if code == 0:
|
||||
helper.send_error(host.id, f'please make sure the {extend.dst_dir!r} is not exists.')
|
||||
if env.DEPLOY_TYPE == '1':
|
||||
# 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} && rm -rf {env.VERSION} && {clean_command}')
|
||||
|
|
|
@ -67,7 +67,11 @@ class RequestView(View):
|
|||
req = DeployRequest.objects.filter(pk=form.id).first()
|
||||
if not req:
|
||||
return json_response(error='未找到指定发布申请')
|
||||
pre_req = DeployRequest.objects.filter(app_id=req.app_id, id__lt=req.id, status='3').first()
|
||||
pre_req = DeployRequest.objects.filter(
|
||||
app_id=req.app_id,
|
||||
type='1',
|
||||
id__lt=req.id,
|
||||
version__isnull=False).first()
|
||||
if not pre_req:
|
||||
return json_response(error='未找到该应用可以用于回滚的版本')
|
||||
if form.action == 'check':
|
||||
|
|
|
@ -28,7 +28,7 @@ class Ext1Setup2 extends React.Component {
|
|||
<Form.Item required label="目标主机仓库路径" help="此目录用于存储应用的历史版本,例如:/data/spug/repos">
|
||||
<Input value={info['dst_repo']} onChange={e => info['dst_repo'] = e.target.value} placeholder="请输入目标主机仓库路径"/>
|
||||
</Form.Item>
|
||||
<Form.Item required label="保留历史版本数量" help="早于指定数量的历史版本将无法回滚">
|
||||
<Form.Item required label="保留历史版本数量" help="早于指定数量的历史版本会被删除,以释放空间">
|
||||
<Input value={info['versions']} onChange={e => info['versions'] = e.target.value} placeholder="请输入保留历史版本数量"/>
|
||||
</Form.Item>
|
||||
<Form.Item required label="发布目标主机">
|
||||
|
|
|
@ -27,7 +27,7 @@ class Index extends React.Component {
|
|||
|
||||
componentWillUnmount() {
|
||||
if (this.socket) this.socket.close();
|
||||
store.request = { targets: []};
|
||||
store.request = {targets: []};
|
||||
store.outputs = {};
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,6 @@ class Index extends React.Component {
|
|||
onBack={() => history.goBack()}/>
|
||||
<Collapse defaultActiveKey={1} className={styles.collapse}>
|
||||
<Collapse.Panel showArrow={false} key={1} header={
|
||||
store.request.type === '1' ?
|
||||
<Steps>
|
||||
<Steps.Step {...this.getStatus('local', 0)} title="建立连接"/>
|
||||
<Steps.Step {...this.getStatus('local', 1)} title="发布准备"/>
|
||||
|
@ -105,9 +104,6 @@ class Index extends React.Component {
|
|||
<Steps.Step {...this.getStatus('local', 3)} title="执行检出"/>
|
||||
<Steps.Step {...this.getStatus('local', 4)} title="检出后任务"/>
|
||||
<Steps.Step {...this.getStatus('local', 5)} title="执行打包"/>
|
||||
</Steps> : <Steps style={{width: 400}}>
|
||||
<Steps.Step {...this.getStatus('local', 0)} title="建立连接"/>
|
||||
<Steps.Step {...this.getStatus('local', 1)} title="发布准备"/>
|
||||
</Steps>}>
|
||||
<pre className={styles.console}>{lds.get(store.outputs, 'local.data')}</pre>
|
||||
</Collapse.Panel>
|
||||
|
|
Loading…
Reference in New Issue