From b342822fa6596a29af8208524b7a8429e4563b61 Mon Sep 17 00:00:00 2001 From: vapao Date: Sat, 18 Jun 2022 22:39:47 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=8E=E5=8F=91=E5=B8=83=E9=85=8D=E7=BD=AE=E7=9A=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=95=B0=E9=87=8F=E7=9B=B8=E5=90=8C=E7=9A=84=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E7=BA=AA=E5=BD=95=E4=BB=A5=E6=94=B9=E5=96=84=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E7=A9=BA=E9=97=B4=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/deploy/views.py | 4 ++++ spug_api/apps/schedule/builtin.py | 7 +++++++ spug_web/src/pages/deploy/app/Ext1Setup3.js | 2 +- spug_web/src/pages/deploy/request/Rollback.js | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/spug_api/apps/deploy/views.py b/spug_api/apps/deploy/views.py index 3665b85..e505eb7 100644 --- a/spug_api/apps/deploy/views.py +++ b/spug_api/apps/deploy/views.py @@ -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'] diff --git a/spug_api/apps/schedule/builtin.py b/spug_api/apps/schedule/builtin.py index 54effa2..a4bd8d3 100644 --- a/spug_api/apps/schedule/builtin.py +++ b/spug_api/apps/schedule/builtin.py @@ -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() diff --git a/spug_web/src/pages/deploy/app/Ext1Setup3.js b/spug_web/src/pages/deploy/app/Ext1Setup3.js index 7a96caa..cead84c 100644 --- a/spug_web/src/pages/deploy/app/Ext1Setup3.js +++ b/spug_web/src/pages/deploy/app/Ext1Setup3.js @@ -46,7 +46,7 @@ export default observer(function () { - + info['versions'] = e.target.value} placeholder="请输入保存的版本数量"/> diff --git a/spug_web/src/pages/deploy/request/Rollback.js b/spug_web/src/pages/deploy/request/Rollback.js index 4e9003f..795c3d7 100644 --- a/spug_web/src/pages/deploy/request/Rollback.js +++ b/spug_web/src/pages/deploy/request/Rollback.js @@ -55,12 +55,12 @@ export default observer(function () { - +