mirror of https://github.com/openspug/spug
A web update
parent
d65307d751
commit
26e3c103ce
|
@ -59,8 +59,16 @@ def _ext1_deploy(request, req, helper, env):
|
||||||
helper.send_step('local', 4, f'{human_time()} 检出后任务...\r\n')
|
helper.send_step('local', 4, f'{human_time()} 检出后任务...\r\n')
|
||||||
helper.local(f'cd {os.path.join(REPOS_DIR, env.VERSION)} && {extend.hook_post_server}', env)
|
helper.local(f'cd {os.path.join(REPOS_DIR, env.VERSION)} && {extend.hook_post_server}', env)
|
||||||
|
|
||||||
helper.send_step('local', 5, f'\r\n{human_time()} ** 执行完毕 **')
|
helper.send_step('local', 5, f'\r\n{human_time()} 执行打包... ')
|
||||||
helper.local(f'cd {REPOS_DIR} && tar zcf {env.VERSION}.tar.gz {env.VERSION}')
|
filter_rule, exclude, contain = json.loads(extend.filter_rule), '', env.VERSION
|
||||||
|
files = helper.parse_filter_rule(filter_rule['data'])
|
||||||
|
if files:
|
||||||
|
if filter_rule['type'] == 'exclude':
|
||||||
|
exclude = ' '.join(f'--exclude={x}' for x in files)
|
||||||
|
else:
|
||||||
|
contain = ' '.join(f'{env.VERSION}/{x}' for x in files)
|
||||||
|
helper.local(f'cd {REPOS_DIR} && tar zcf {env.VERSION}.tar.gz {exclude} {contain}')
|
||||||
|
helper.send_step('local', 6, f'完成')
|
||||||
for h_id in json.loads(req.host_ids):
|
for h_id in json.loads(req.host_ids):
|
||||||
Thread(target=_deploy_host, args=(helper, h_id, extend, env)).start()
|
Thread(target=_deploy_host, args=(helper, h_id, extend, env)).start()
|
||||||
|
|
||||||
|
@ -116,6 +124,15 @@ class Helper:
|
||||||
self.rds = rds
|
self.rds = rds
|
||||||
self.token = token
|
self.token = token
|
||||||
|
|
||||||
|
def parse_filter_rule(self, data: str):
|
||||||
|
data, files = data.strip(), []
|
||||||
|
if data:
|
||||||
|
for line in data.split('\n'):
|
||||||
|
line = line.strip()
|
||||||
|
if line and not line.startswith('#'):
|
||||||
|
files.append(line)
|
||||||
|
return files
|
||||||
|
|
||||||
def send_info(self, key, message):
|
def send_info(self, key, message):
|
||||||
self.rds.rpush(self.token, json.dumps({'key': key, 'status': 'info', 'data': message}))
|
self.rds.rpush(self.token, json.dumps({'key': key, 'status': 'info', 'data': message}))
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Index extends React.Component {
|
||||||
|
|
||||||
getStatusAlias = () => {
|
getStatusAlias = () => {
|
||||||
if (store.targets.length !== 0) {
|
if (store.targets.length !== 0) {
|
||||||
for (let item of store.targets) {
|
for (let item of [{id: 'local'}, ...store.targets]) {
|
||||||
if (lds.get(store.outputs, `${item.id}.status`) === 'error') {
|
if (lds.get(store.outputs, `${item.id}.status`) === 'error') {
|
||||||
return <Tag color="orange">发布异常</Tag>
|
return <Tag color="orange">发布异常</Tag>
|
||||||
} else if (lds.get(store.outputs, `${item.id}.step`, -1) < 5) {
|
} else if (lds.get(store.outputs, `${item.id}.step`, -1) < 5) {
|
||||||
|
@ -105,6 +105,7 @@ class Index extends React.Component {
|
||||||
<Steps.Step {...this.getStatus('local', 2)} title="检出前任务"/>
|
<Steps.Step {...this.getStatus('local', 2)} title="检出前任务"/>
|
||||||
<Steps.Step {...this.getStatus('local', 3)} title="执行检出"/>
|
<Steps.Step {...this.getStatus('local', 3)} title="执行检出"/>
|
||||||
<Steps.Step {...this.getStatus('local', 4)} title="检出后任务"/>
|
<Steps.Step {...this.getStatus('local', 4)} title="检出后任务"/>
|
||||||
|
<Steps.Step {...this.getStatus('local', 5)} title="执行打包"/>
|
||||||
</Steps>}>
|
</Steps>}>
|
||||||
<pre className={styles.console}>{lds.get(store.outputs, 'local.data')}</pre>
|
<pre className={styles.console}>{lds.get(store.outputs, 'local.data')}</pre>
|
||||||
</Collapse.Panel>
|
</Collapse.Panel>
|
||||||
|
|
Loading…
Reference in New Issue