mirror of https://github.com/openspug/spug
U 优化保留与发布配置的版本数量相同的构建纪录以改善磁盘空间占用
parent
c0f8aeb405
commit
b342822fa6
|
@ -130,6 +130,10 @@ class RequestDetailView(View):
|
|||
outputs[item['key']]['status'] = item['status']
|
||||
data = rds.lrange(key, counter, counter + 9)
|
||||
response['index'] = counter
|
||||
if counter == 0:
|
||||
for item in outputs:
|
||||
outputs[item]['data'] += '\r\n\r\n未读取到数据,Spug 仅保存最近2周的日志信息。'
|
||||
|
||||
if req.is_quick_deploy:
|
||||
if outputs['local']['data']:
|
||||
outputs['local']['data'] = f'{human_time()} 读取数据... ' + outputs['local']['data']
|
||||
|
|
|
@ -6,6 +6,7 @@ from apps.account.models import History
|
|||
from apps.alarm.models import Alarm
|
||||
from apps.schedule.models import Task, History as TaskHistory
|
||||
from apps.deploy.models import DeployRequest
|
||||
from apps.app.models import DeployExtend1
|
||||
from apps.exec.models import ExecHistory
|
||||
from apps.notify.models import Notify
|
||||
from apps.deploy.utils import dispatch
|
||||
|
@ -21,6 +22,12 @@ def auto_run_by_day():
|
|||
History.objects.filter(created_at__lt=date_30).delete()
|
||||
Notify.objects.filter(created_at__lt=date_7, unread=False).delete()
|
||||
Alarm.objects.filter(created_at__lt=date_30).delete()
|
||||
for item in DeployExtend1.objects.all():
|
||||
index = 0
|
||||
for req in DeployRequest.objects.filter(deploy_id=item.deploy_id, repository_id__isnull=False):
|
||||
if index > item.versions and req.repository_id:
|
||||
req.repository.delete()
|
||||
index += 1
|
||||
try:
|
||||
record = ExecHistory.objects.all()[50]
|
||||
ExecHistory.objects.filter(id__lt=record.id).delete()
|
||||
|
|
|
@ -46,7 +46,7 @@ export default observer(function () {
|
|||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={10}>
|
||||
<Form.Item required label="版本数量" tooltip="早于指定数量的历史版本会被删除,以释放磁盘空间。">
|
||||
<Form.Item required label="版本数量" tooltip="早于指定数量的构建纪录及历史版本会被删除,以释放磁盘空间。">
|
||||
<Input value={info['versions']} onChange={e => info['versions'] = e.target.value} placeholder="请输入保存的版本数量"/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
|
|
|
@ -55,12 +55,12 @@ export default observer(function () {
|
|||
<Form.Item required name="name" label="申请标题">
|
||||
<Input placeholder="请输入申请标题"/>
|
||||
</Form.Item>
|
||||
<Form.Item required name="request_id" label="选择版本">
|
||||
<Form.Item required name="request_id" label="选择版本" tooltip="可选择回滚版本与发布配置中的版本数量配置相关。">
|
||||
<Select
|
||||
showSearch
|
||||
placeholder="请选择回滚至哪个版本"
|
||||
filterOption={(input, option) => includes(option.props.children, input)}>
|
||||
{store.records.filter(x => x.deploy_id === deploy_id && ['3', '-3'].includes(x.status)).map((item, index) => (
|
||||
{store.records.filter(x => x.repository_id && x.deploy_id === deploy_id && ['3', '-3'].includes(x.status)).map((item, index) => (
|
||||
<Select.Option key={item.id} value={item.id} record={item} disabled={index === 0}>
|
||||
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
||||
<span>{`${item.name} (${item.version})`}</span>
|
||||
|
|
Loading…
Reference in New Issue