aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2024-08-02 08:42:08 +0800
committerGitHub <noreply@github.com>2024-08-02 00:42:08 +0000
commit687c1182482ad9443a5911c068b317a91c91d586 (patch)
treecd47e85e58f7cd985aa1fe3ca0d64cd8b22724e2 /routers/web/repo
parente3678356e1c0e50de96a3a142d703c8797c1476f (diff)
downloadgitea-687c1182482ad9443a5911c068b317a91c91d586.tar.gz
gitea-687c1182482ad9443a5911c068b317a91c91d586.zip
Clear up old Actions logs (#31735)
Part of #24256. Clear up old action logs to free up storage space. Users will see a message indicating that the log has been cleared if they view old tasks. <img width="1361" alt="image" src="https://github.com/user-attachments/assets/9f0f3a3a-bc5a-402f-90ca-49282d196c22"> Docs: https://gitea.com/gitea/docs/pulls/40 --------- Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'routers/web/repo')
-rw-r--r--routers/web/repo/actions/view.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index 2c62c8d9ec..84319fc860 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -222,6 +222,27 @@ func ViewPost(ctx *context_module.Context) {
step := steps[cursor.Step]
+ // if task log is expired, return a consistent log line
+ if task.LogExpired {
+ if cursor.Cursor == 0 {
+ resp.Logs.StepsLog = append(resp.Logs.StepsLog, &ViewStepLog{
+ Step: cursor.Step,
+ Cursor: 1,
+ Lines: []*ViewStepLogLine{
+ {
+ Index: 1,
+ Message: ctx.Locale.TrString("actions.runs.expire_log_message"),
+ // Timestamp doesn't mean anything when the log is expired.
+ // Set it to the task's updated time since it's probably the time when the log has expired.
+ Timestamp: float64(task.Updated.AsTime().UnixNano()) / float64(time.Second),
+ },
+ },
+ Started: int64(step.Started),
+ })
+ }
+ continue
+ }
+
logLines := make([]*ViewStepLogLine, 0) // marshal to '[]' instead fo 'null' in json
index := step.LogIndex + cursor.Cursor