feat: add log.job.dir (#1165)

`log.job.dir` makes the runner write a copy of every task's log to that directory, as `<start time>-task-<id>.log`: the rows exactly as Gitea received them, with the same masking and the job's result on the last line. Off by default, and what Gitea shows does not change.

`log.job.retention` (default `168h`) and `log.job.max_size` (default `1GB`) bound the directory. Documented in the README.

---------

Co-authored-by: silverwind <me@silverwind.io>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1165
Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com>
This commit is contained in:
bircni
2026-08-21 07:25:11 +00:00
parent dfe979e1d0
commit a0c4de79f7
8 changed files with 314 additions and 37 deletions
+7 -12
View File
@@ -1041,18 +1041,13 @@ func TestReporter_StopHeartbeats(t *testing.T) {
"Close() must still send a final UpdateTask after StopHeartbeats")
}
func TestAppendIfNotNil(t *testing.T) {
var s []*int
s = appendIfNotNil(s, nil)
assert.Empty(t, s)
v := 7
s = appendIfNotNil(s, &v)
require.Len(t, s, 1)
assert.Equal(t, &v, s[0])
s = appendIfNotNil(s, nil)
require.Len(t, s, 1)
func TestAppendLogRow(t *testing.T) {
r := &Reporter{}
row := &runnerv1.LogRow{Time: timestamppb.Now(), Content: "hello"}
r.appendLogRow(nil)
r.appendLogRow(row)
r.appendLogRow(nil)
assert.Equal(t, []*runnerv1.LogRow{row}, r.logRows)
}
func TestReporter_Levels(t *testing.T) {