mirror of
https://github.com/go-gitea/gitea.git
synced 2025-05-18 00:49:09 -04:00
fix: distribute log files to folders
This commit is contained in:
parent
6a0614f4a5
commit
3c7fce0d37
@ -13,6 +13,7 @@ import (
|
||||
"io"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/modules/bots"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
||||
@ -253,7 +254,7 @@ func CreateTaskForRunner(ctx context.Context, runner *Runner) (*Task, bool, erro
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
task.LogFilename = fmt.Sprintf("%s/%d.log", job.Run.Repo.FullName(), task.ID)
|
||||
task.LogFilename = bots.LogFileName(job.Run.Repo.FullName(), task.ID)
|
||||
if _, err := e.ID(task.ID).Cols("log_filename").Update(task); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
@ -148,3 +148,7 @@ func ParseLog(in string) (timestamp time.Time, content string, err error) {
|
||||
content = in[index+1:]
|
||||
return
|
||||
}
|
||||
|
||||
func LogFileName(repoFullName string, taskID int64) string {
|
||||
return fmt.Sprintf("%s/%02x/%d.log", repoFullName, taskID%256, taskID)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user