mirror of https://github.com/openspug/spug
fix issue
parent
a2056edbbd
commit
c0d7db81b5
|
@ -47,7 +47,7 @@ class DeployRequest(models.Model, ModelMixin):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_quick_deploy(self):
|
def is_quick_deploy(self):
|
||||||
if self.extra:
|
if self.deploy.extend == '1' and self.extra:
|
||||||
extra = json.loads(self.extra)
|
extra = json.loads(self.extra)
|
||||||
return extra[0] in ('branch', 'tag')
|
return extra[0] in ('branch', 'tag')
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -181,7 +181,7 @@ def _deploy_ext1_host(req, helper, h_id, env):
|
||||||
try:
|
try:
|
||||||
ssh.put_file(os.path.join(REPOS_DIR, 'build', tar_gz_file), os.path.join(extend.dst_repo, tar_gz_file))
|
ssh.put_file(os.path.join(REPOS_DIR, 'build', tar_gz_file), os.path.join(extend.dst_repo, tar_gz_file))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
helper.send_error(host.id, f'exception: {e}')
|
helper.send_error(host.id, f'Exception: {e}')
|
||||||
|
|
||||||
command = f'cd {extend.dst_repo} && rm -rf {req.spug_version} && tar xf {tar_gz_file} && rm -f {req.deploy_id}_*.tar.gz'
|
command = f'cd {extend.dst_repo} && rm -rf {req.spug_version} && tar xf {tar_gz_file} && rm -f {req.deploy_id}_*.tar.gz'
|
||||||
helper.remote_raw(host.id, ssh, command)
|
helper.remote_raw(host.id, ssh, command)
|
||||||
|
@ -222,7 +222,7 @@ def _deploy_ext2_host(helper, h_id, actions, env, spug_version):
|
||||||
try:
|
try:
|
||||||
ssh.put_file(os.path.join(REPOS_DIR, env.SPUG_DEPLOY_ID, spug_version), action['dst'])
|
ssh.put_file(os.path.join(REPOS_DIR, env.SPUG_DEPLOY_ID, spug_version), action['dst'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
helper.send_error(host.id, f'exception: {e}')
|
helper.send_error(host.id, f'Exception: {e}')
|
||||||
helper.send_info(host.id, 'transfer completed\r\n')
|
helper.send_info(host.id, 'transfer completed\r\n')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
@ -231,7 +231,7 @@ def _deploy_ext2_host(helper, h_id, actions, env, spug_version):
|
||||||
try:
|
try:
|
||||||
ssh.put_file(os.path.join(sp_dir, tar_gz_file), f'/tmp/{tar_gz_file}')
|
ssh.put_file(os.path.join(sp_dir, tar_gz_file), f'/tmp/{tar_gz_file}')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
helper.send_error(host.id, f'exception: {e}')
|
helper.send_error(host.id, f'Exception: {e}')
|
||||||
|
|
||||||
command = f'mkdir -p /tmp/{spug_version} && tar xf /tmp/{tar_gz_file} -C /tmp/{spug_version}/ '
|
command = f'mkdir -p /tmp/{spug_version} && tar xf /tmp/{tar_gz_file} -C /tmp/{spug_version}/ '
|
||||||
command += f'&& rm -rf {action["dst"]} && mv /tmp/{spug_version}/{sd_dst} {action["dst"]} '
|
command += f'&& rm -rf {action["dst"]} && mv /tmp/{spug_version}/{sd_dst} {action["dst"]} '
|
||||||
|
|
|
@ -104,6 +104,6 @@ def _build(rep: Repository, helper, env):
|
||||||
exclude = ' '.join(excludes)
|
exclude = ' '.join(excludes)
|
||||||
else:
|
else:
|
||||||
contain = ' '.join(f'{rep.spug_version}/{x}' for x in files)
|
contain = ' '.join(f'{rep.spug_version}/{x}' for x in files)
|
||||||
helper.local(f'cd {REPOS_DIR} && tar zcf {tar_file} {exclude} {contain}')
|
helper.local(f'mkdir -p {BUILD_DIR} && cd {REPOS_DIR} && tar zcf {tar_file} {exclude} {contain}')
|
||||||
helper.send_step('local', 5, f'\033[32m完成√\033[0m')
|
helper.send_step('local', 5, f'\033[32m完成√\033[0m')
|
||||||
helper.send_step('local', 100, f'\r\n\r\n{human_time()} ** \033[32m构建成功\033[0m **')
|
helper.send_step('local', 100, f'\r\n\r\n{human_time()} ** \033[32m构建成功\033[0m **')
|
||||||
|
|
|
@ -55,6 +55,11 @@ export default observer(function Console() {
|
||||||
if (status !== undefined) setStatus(status);
|
if (status !== undefined) setStatus(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
socket.onerror = () => {
|
||||||
|
setStatus('error')
|
||||||
|
term.reset()
|
||||||
|
term.write('\u001b[31mWebsocket connection failed!\u001b[0m')
|
||||||
|
}
|
||||||
return socket
|
return socket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ function ComTable() {
|
||||||
<Action.Button
|
<Action.Button
|
||||||
auth="deploy.repository.build"
|
auth="deploy.repository.build"
|
||||||
loading={loading === info.id}
|
loading={loading === info.id}
|
||||||
|
disabled={info.remarks === 'SPUG AUTO MAKE'}
|
||||||
onClick={() => handleRebuild(info)}>构建</Action.Button>
|
onClick={() => handleRebuild(info)}>构建</Action.Button>
|
||||||
<Action.Button auth="deploy.repository.build" onClick={() => store.showConsole(info)}>日志</Action.Button>
|
<Action.Button auth="deploy.repository.build" onClick={() => store.showConsole(info)}>日志</Action.Button>
|
||||||
</Action>
|
</Action>
|
||||||
|
|
|
@ -63,6 +63,16 @@ function Ext1Console(props) {
|
||||||
if (status !== undefined) outputs[key].status = status;
|
if (status !== undefined) outputs[key].status = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
socket.onerror = () => {
|
||||||
|
for (let key of Object.keys(outputs)) {
|
||||||
|
outputs[key]['status'] = 'error'
|
||||||
|
outputs[key].data = '\u001b[31mWebsocket connection failed!\u001b[0m'
|
||||||
|
if (terms[key]) {
|
||||||
|
terms[key].reset()
|
||||||
|
terms[key].write('\u001b[31mWebsocket connection failed!\u001b[0m')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return socket
|
return socket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,16 @@ function Ext2Console(props) {
|
||||||
if (status !== undefined) outputs[key].status = status;
|
if (status !== undefined) outputs[key].status = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
socket.onerror = () => {
|
||||||
|
for (let key of Object.keys(outputs)) {
|
||||||
|
outputs[key]['status'] = 'error'
|
||||||
|
outputs[key].data = '\u001b[31mWebsocket connection failed!\u001b[0m'
|
||||||
|
if (terms[key]) {
|
||||||
|
terms[key].reset()
|
||||||
|
terms[key].write('\u001b[31mWebsocket connection failed!\u001b[0m')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return socket
|
return socket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,9 @@ class ExecConsole extends React.Component {
|
||||||
for (let key of Object.keys(store.outputs)) {
|
for (let key of Object.keys(store.outputs)) {
|
||||||
store.outputs[key]['status'] = 'websocket error'
|
store.outputs[key]['status'] = 'websocket error'
|
||||||
if (this.terms[key]) {
|
if (this.terms[key]) {
|
||||||
this.terms[key].write('Websocket connection failed!')
|
this.terms[key].write('\u001b[31mWebsocket connection failed!\u001b[0m')
|
||||||
} else {
|
} else {
|
||||||
this.outputs[key] = 'Websocket connection failed!'
|
this.outputs[key] = '\u001b[31mWebsocket connection failed!\u001b[0m'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue