2023-02-28 10:44:46 +00:00
|
|
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2023-04-04 14:32:04 +01:00
|
|
|
package report
|
2022-09-25 11:54:00 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2023-04-27 05:32:48 +01:00
|
|
|
"regexp"
|
2022-09-25 11:54:00 +01:00
|
|
|
"strings"
|
|
|
|
"sync"
|
|
|
|
"time"
|
|
|
|
|
2022-12-06 08:37:38 +00:00
|
|
|
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
|
2024-07-31 05:02:21 +01:00
|
|
|
"connectrpc.com/connect"
|
2022-12-06 08:37:38 +00:00
|
|
|
retry "github.com/avast/retry-go/v4"
|
2022-09-25 11:54:00 +01:00
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
2023-04-04 14:32:04 +01:00
|
|
|
|
|
|
|
"gitea.com/gitea/act_runner/internal/pkg/client"
|
2022-09-25 11:54:00 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type Reporter struct {
|
2022-10-29 05:26:27 +01:00
|
|
|
ctx context.Context
|
|
|
|
cancel context.CancelFunc
|
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
closed bool
|
|
|
|
client client.Client
|
|
|
|
clientM sync.Mutex
|
|
|
|
|
2024-07-27 15:51:45 +01:00
|
|
|
logOffset int
|
|
|
|
logRows []*runnerv1.LogRow
|
|
|
|
logReplacer *strings.Replacer
|
|
|
|
oldnew []string
|
|
|
|
reportInterval time.Duration
|
2023-04-20 16:27:46 +01:00
|
|
|
|
|
|
|
state *runnerv1.TaskState
|
|
|
|
stateMu sync.RWMutex
|
|
|
|
outputs sync.Map
|
2023-04-27 05:32:48 +01:00
|
|
|
|
|
|
|
debugOutputEnabled bool
|
|
|
|
stopCommandEndToken string
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
2024-07-27 15:51:45 +01:00
|
|
|
func NewReporter(ctx context.Context, cancel context.CancelFunc, client client.Client, task *runnerv1.Task, reportInterval time.Duration) *Reporter {
|
2022-11-02 04:12:45 +00:00
|
|
|
var oldnew []string
|
|
|
|
if v := task.Context.Fields["token"].GetStringValue(); v != "" {
|
|
|
|
oldnew = append(oldnew, v, "***")
|
|
|
|
}
|
2024-02-08 02:43:39 +00:00
|
|
|
if v := task.Context.Fields["gitea_runtime_token"].GetStringValue(); v != "" {
|
|
|
|
oldnew = append(oldnew, v, "***")
|
|
|
|
}
|
2022-11-02 04:12:45 +00:00
|
|
|
for _, v := range task.Secrets {
|
|
|
|
oldnew = append(oldnew, v, "***")
|
|
|
|
}
|
|
|
|
|
2023-04-27 05:32:48 +01:00
|
|
|
rv := &Reporter{
|
2024-07-27 15:51:45 +01:00
|
|
|
ctx: ctx,
|
|
|
|
cancel: cancel,
|
|
|
|
client: client,
|
|
|
|
oldnew: oldnew,
|
|
|
|
reportInterval: reportInterval,
|
|
|
|
logReplacer: strings.NewReplacer(oldnew...),
|
2022-09-25 11:54:00 +01:00
|
|
|
state: &runnerv1.TaskState{
|
2022-11-02 04:12:45 +00:00
|
|
|
Id: task.Id,
|
2022-09-25 11:54:00 +01:00
|
|
|
},
|
|
|
|
}
|
2023-04-27 05:32:48 +01:00
|
|
|
|
|
|
|
if task.Secrets["ACTIONS_STEP_DEBUG"] == "true" {
|
|
|
|
rv.debugOutputEnabled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) ResetSteps(l int) {
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Lock()
|
|
|
|
defer r.stateMu.Unlock()
|
2022-09-25 11:54:00 +01:00
|
|
|
for i := 0; i < l; i++ {
|
|
|
|
r.state.Steps = append(r.state.Steps, &runnerv1.StepState{
|
|
|
|
Id: int64(i),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) Levels() []log.Level {
|
|
|
|
return log.AllLevels
|
|
|
|
}
|
|
|
|
|
2023-04-27 05:32:48 +01:00
|
|
|
func appendIfNotNil[T any](s []*T, v *T) []*T {
|
|
|
|
if v != nil {
|
|
|
|
return append(s, v)
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
func (r *Reporter) Fire(entry *log.Entry) error {
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Lock()
|
|
|
|
defer r.stateMu.Unlock()
|
2022-09-25 11:54:00 +01:00
|
|
|
|
2022-11-17 11:14:51 +00:00
|
|
|
log.WithFields(entry.Data).Trace(entry.Message)
|
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
timestamp := entry.Time
|
|
|
|
if r.state.StartedAt == nil {
|
2022-10-20 08:29:23 +01:00
|
|
|
r.state.StartedAt = timestamppb.New(timestamp)
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
2022-11-17 11:14:51 +00:00
|
|
|
stage := entry.Data["stage"]
|
2022-09-25 11:54:00 +01:00
|
|
|
|
2022-11-17 11:14:51 +00:00
|
|
|
if stage != "Main" {
|
2022-09-25 11:54:00 +01:00
|
|
|
if v, ok := entry.Data["jobResult"]; ok {
|
2022-10-20 08:28:21 +01:00
|
|
|
if jobResult, ok := r.parseResult(v); ok {
|
2022-10-20 08:29:23 +01:00
|
|
|
r.state.Result = jobResult
|
|
|
|
r.state.StoppedAt = timestamppb.New(timestamp)
|
|
|
|
for _, s := range r.state.Steps {
|
|
|
|
if s.Result == runnerv1.Result_RESULT_UNSPECIFIED {
|
|
|
|
s.Result = runnerv1.Result_RESULT_CANCELLED
|
2024-03-01 08:33:32 +00:00
|
|
|
if jobResult == runnerv1.Result_RESULT_SKIPPED {
|
|
|
|
s.Result = runnerv1.Result_RESULT_SKIPPED
|
|
|
|
}
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
2022-10-20 08:29:23 +01:00
|
|
|
}
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if !r.duringSteps() {
|
2023-04-27 05:32:48 +01:00
|
|
|
r.logRows = appendIfNotNil(r.logRows, r.parseLogRow(entry))
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-11-17 11:14:51 +00:00
|
|
|
var step *runnerv1.StepState
|
|
|
|
if v, ok := entry.Data["stepNumber"]; ok {
|
2023-03-28 04:49:09 +01:00
|
|
|
if v, ok := v.(int); ok && len(r.state.Steps) > v {
|
2022-11-17 11:14:51 +00:00
|
|
|
step = r.state.Steps[v]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if step == nil {
|
|
|
|
if !r.duringSteps() {
|
2023-04-27 05:32:48 +01:00
|
|
|
r.logRows = appendIfNotNil(r.logRows, r.parseLogRow(entry))
|
2022-11-17 11:14:51 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
if step.StartedAt == nil {
|
2022-10-20 08:29:23 +01:00
|
|
|
step.StartedAt = timestamppb.New(timestamp)
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
if v, ok := entry.Data["raw_output"]; ok {
|
|
|
|
if rawOutput, ok := v.(bool); ok && rawOutput {
|
2023-05-06 10:00:52 +01:00
|
|
|
if row := r.parseLogRow(entry); row != nil {
|
|
|
|
if step.LogLength == 0 {
|
|
|
|
step.LogIndex = int64(r.logOffset + len(r.logRows))
|
|
|
|
}
|
|
|
|
step.LogLength++
|
|
|
|
r.logRows = append(r.logRows, row)
|
2022-10-20 08:29:23 +01:00
|
|
|
}
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
2022-11-17 11:14:51 +00:00
|
|
|
} else if !r.duringSteps() {
|
2023-04-27 05:32:48 +01:00
|
|
|
r.logRows = appendIfNotNil(r.logRows, r.parseLogRow(entry))
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
if v, ok := entry.Data["stepResult"]; ok {
|
2022-10-20 08:28:21 +01:00
|
|
|
if stepResult, ok := r.parseResult(v); ok {
|
2022-10-20 08:29:23 +01:00
|
|
|
if step.LogLength == 0 {
|
|
|
|
step.LogIndex = int64(r.logOffset + len(r.logRows))
|
|
|
|
}
|
|
|
|
step.Result = stepResult
|
|
|
|
step.StoppedAt = timestamppb.New(timestamp)
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) RunDaemon() {
|
|
|
|
if r.closed {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if r.ctx.Err() != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
_ = r.ReportLog(false)
|
|
|
|
_ = r.ReportState()
|
|
|
|
|
2024-07-27 15:51:45 +01:00
|
|
|
time.AfterFunc(r.reportInterval, r.RunDaemon)
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) Logf(format string, a ...interface{}) {
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Lock()
|
|
|
|
defer r.stateMu.Unlock()
|
|
|
|
|
|
|
|
r.logf(format, a...)
|
|
|
|
}
|
2022-09-25 11:54:00 +01:00
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
func (r *Reporter) logf(format string, a ...interface{}) {
|
2022-09-25 11:54:00 +01:00
|
|
|
if !r.duringSteps() {
|
|
|
|
r.logRows = append(r.logRows, &runnerv1.LogRow{
|
|
|
|
Time: timestamppb.Now(),
|
|
|
|
Content: fmt.Sprintf(format, a...),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
func (r *Reporter) SetOutputs(outputs map[string]string) {
|
|
|
|
r.stateMu.Lock()
|
|
|
|
defer r.stateMu.Unlock()
|
|
|
|
|
|
|
|
for k, v := range outputs {
|
|
|
|
if len(k) > 255 {
|
|
|
|
r.logf("ignore output because the key is too long: %q", k)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if l := len(v); l > 1024*1024 {
|
|
|
|
log.Println("ignore output because the value is too long:", k, l)
|
|
|
|
r.logf("ignore output because the value %q is too long: %d", k, l)
|
|
|
|
}
|
|
|
|
if _, ok := r.outputs.Load(k); ok {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
r.outputs.Store(k, v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
func (r *Reporter) Close(lastWords string) error {
|
|
|
|
r.closed = true
|
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Lock()
|
2022-09-25 11:54:00 +01:00
|
|
|
if r.state.Result == runnerv1.Result_RESULT_UNSPECIFIED {
|
|
|
|
if lastWords == "" {
|
|
|
|
lastWords = "Early termination"
|
|
|
|
}
|
|
|
|
for _, v := range r.state.Steps {
|
|
|
|
if v.Result == runnerv1.Result_RESULT_UNSPECIFIED {
|
|
|
|
v.Result = runnerv1.Result_RESULT_CANCELLED
|
|
|
|
}
|
|
|
|
}
|
2023-04-04 14:32:04 +01:00
|
|
|
r.state.Result = runnerv1.Result_RESULT_FAILURE
|
2022-09-25 11:54:00 +01:00
|
|
|
r.logRows = append(r.logRows, &runnerv1.LogRow{
|
|
|
|
Time: timestamppb.Now(),
|
|
|
|
Content: lastWords,
|
|
|
|
})
|
2023-04-19 04:17:49 +01:00
|
|
|
r.state.StoppedAt = timestamppb.Now()
|
2022-09-25 11:54:00 +01:00
|
|
|
} else if lastWords != "" {
|
|
|
|
r.logRows = append(r.logRows, &runnerv1.LogRow{
|
|
|
|
Time: timestamppb.Now(),
|
|
|
|
Content: lastWords,
|
|
|
|
})
|
|
|
|
}
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Unlock()
|
2022-09-25 11:54:00 +01:00
|
|
|
|
2022-10-14 03:55:49 +01:00
|
|
|
return retry.Do(func() error {
|
2022-09-25 11:54:00 +01:00
|
|
|
if err := r.ReportLog(true); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return r.ReportState()
|
2022-10-14 03:55:49 +01:00
|
|
|
}, retry.Context(r.ctx))
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) ReportLog(noMore bool) error {
|
|
|
|
r.clientM.Lock()
|
|
|
|
defer r.clientM.Unlock()
|
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.RLock()
|
2022-09-25 11:54:00 +01:00
|
|
|
rows := r.logRows
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.RUnlock()
|
2022-09-25 11:54:00 +01:00
|
|
|
|
|
|
|
resp, err := r.client.UpdateLog(r.ctx, connect.NewRequest(&runnerv1.UpdateLogRequest{
|
|
|
|
TaskId: r.state.Id,
|
|
|
|
Index: int64(r.logOffset),
|
|
|
|
Rows: rows,
|
|
|
|
NoMore: noMore,
|
|
|
|
}))
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
ack := int(resp.Msg.AckIndex)
|
|
|
|
if ack < r.logOffset {
|
|
|
|
return fmt.Errorf("submitted logs are lost")
|
|
|
|
}
|
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Lock()
|
2022-09-25 11:54:00 +01:00
|
|
|
r.logRows = r.logRows[ack-r.logOffset:]
|
|
|
|
r.logOffset = ack
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.Unlock()
|
2022-09-25 11:54:00 +01:00
|
|
|
|
|
|
|
if noMore && ack < r.logOffset+len(rows) {
|
|
|
|
return fmt.Errorf("not all logs are submitted")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) ReportState() error {
|
|
|
|
r.clientM.Lock()
|
|
|
|
defer r.clientM.Unlock()
|
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.RLock()
|
2022-09-25 11:54:00 +01:00
|
|
|
state := proto.Clone(r.state).(*runnerv1.TaskState)
|
2023-04-20 16:27:46 +01:00
|
|
|
r.stateMu.RUnlock()
|
|
|
|
|
|
|
|
outputs := make(map[string]string)
|
|
|
|
r.outputs.Range(func(k, v interface{}) bool {
|
|
|
|
if val, ok := v.(string); ok {
|
|
|
|
outputs[k.(string)] = val
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
})
|
2022-09-25 11:54:00 +01:00
|
|
|
|
2022-10-29 05:26:27 +01:00
|
|
|
resp, err := r.client.UpdateTask(r.ctx, connect.NewRequest(&runnerv1.UpdateTaskRequest{
|
2023-04-20 16:27:46 +01:00
|
|
|
State: state,
|
|
|
|
Outputs: outputs,
|
2022-09-25 11:54:00 +01:00
|
|
|
}))
|
2022-10-30 03:47:06 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-10-29 05:26:27 +01:00
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
for _, k := range resp.Msg.SentOutputs {
|
|
|
|
r.outputs.Store(k, struct{}{})
|
|
|
|
}
|
|
|
|
|
2022-10-30 03:47:06 +00:00
|
|
|
if resp.Msg.State != nil && resp.Msg.State.Result == runnerv1.Result_RESULT_CANCELLED {
|
2022-10-29 05:26:27 +01:00
|
|
|
r.cancel()
|
|
|
|
}
|
|
|
|
|
2023-04-20 16:27:46 +01:00
|
|
|
var noSent []string
|
|
|
|
r.outputs.Range(func(k, v interface{}) bool {
|
|
|
|
if _, ok := v.(string); ok {
|
|
|
|
noSent = append(noSent, k.(string))
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
if len(noSent) > 0 {
|
|
|
|
return fmt.Errorf("there are still outputs that have not been sent: %v", noSent)
|
|
|
|
}
|
|
|
|
|
2022-10-30 03:47:06 +00:00
|
|
|
return nil
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Reporter) duringSteps() bool {
|
|
|
|
if steps := r.state.Steps; len(steps) == 0 {
|
|
|
|
return false
|
|
|
|
} else if first := steps[0]; first.Result == runnerv1.Result_RESULT_UNSPECIFIED && first.LogLength == 0 {
|
|
|
|
return false
|
|
|
|
} else if last := steps[len(steps)-1]; last.Result != runnerv1.Result_RESULT_UNSPECIFIED {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2022-10-29 05:26:27 +01:00
|
|
|
var stringToResult = map[string]runnerv1.Result{
|
|
|
|
"success": runnerv1.Result_RESULT_SUCCESS,
|
|
|
|
"failure": runnerv1.Result_RESULT_FAILURE,
|
|
|
|
"skipped": runnerv1.Result_RESULT_SKIPPED,
|
|
|
|
"cancelled": runnerv1.Result_RESULT_CANCELLED,
|
|
|
|
}
|
2022-10-20 08:28:21 +01:00
|
|
|
|
|
|
|
func (r *Reporter) parseResult(result interface{}) (runnerv1.Result, bool) {
|
|
|
|
str := ""
|
|
|
|
if v, ok := result.(string); ok { // for jobResult
|
|
|
|
str = v
|
|
|
|
} else if v, ok := result.(fmt.Stringer); ok { // for stepResult
|
|
|
|
str = v.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
ret, ok := stringToResult[str]
|
|
|
|
return ret, ok
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
|
2023-04-27 05:32:48 +01:00
|
|
|
var cmdRegex = regexp.MustCompile(`^::([^ :]+)( .*)?::(.*)$`)
|
|
|
|
|
|
|
|
func (r *Reporter) handleCommand(originalContent, command, parameters, value string) *string {
|
|
|
|
if r.stopCommandEndToken != "" && command != r.stopCommandEndToken {
|
|
|
|
return &originalContent
|
|
|
|
}
|
|
|
|
|
|
|
|
switch command {
|
|
|
|
case "add-mask":
|
|
|
|
r.addMask(value)
|
|
|
|
return nil
|
|
|
|
case "debug":
|
|
|
|
if r.debugOutputEnabled {
|
|
|
|
return &value
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
|
|
|
|
case "notice":
|
|
|
|
// Not implemented yet, so just return the original content.
|
|
|
|
return &originalContent
|
|
|
|
case "warning":
|
|
|
|
// Not implemented yet, so just return the original content.
|
|
|
|
return &originalContent
|
|
|
|
case "error":
|
|
|
|
// Not implemented yet, so just return the original content.
|
|
|
|
return &originalContent
|
|
|
|
case "group":
|
2024-04-20 03:41:52 +01:00
|
|
|
// Rewriting into ##[] syntax which the frontend understands
|
|
|
|
content := "##[group]" + value
|
|
|
|
return &content
|
2023-04-27 05:32:48 +01:00
|
|
|
case "endgroup":
|
|
|
|
// Ditto
|
2024-04-20 03:41:52 +01:00
|
|
|
content := "##[endgroup]"
|
|
|
|
return &content
|
2023-04-27 05:32:48 +01:00
|
|
|
case "stop-commands":
|
|
|
|
r.stopCommandEndToken = value
|
|
|
|
return nil
|
|
|
|
case r.stopCommandEndToken:
|
|
|
|
r.stopCommandEndToken = ""
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &originalContent
|
|
|
|
}
|
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
func (r *Reporter) parseLogRow(entry *log.Entry) *runnerv1.LogRow {
|
2022-12-02 08:07:23 +00:00
|
|
|
content := strings.TrimRightFunc(entry.Message, func(r rune) bool { return r == '\r' || r == '\n' })
|
2023-04-27 05:32:48 +01:00
|
|
|
|
|
|
|
matches := cmdRegex.FindStringSubmatch(content)
|
|
|
|
if matches != nil {
|
|
|
|
if output := r.handleCommand(content, matches[1], matches[2], matches[3]); output != nil {
|
|
|
|
content = *output
|
|
|
|
} else {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-02 04:12:45 +00:00
|
|
|
content = r.logReplacer.Replace(content)
|
2023-04-27 05:32:48 +01:00
|
|
|
|
2022-09-25 11:54:00 +01:00
|
|
|
return &runnerv1.LogRow{
|
|
|
|
Time: timestamppb.New(entry.Time),
|
2023-12-20 07:06:46 +00:00
|
|
|
Content: strings.ToValidUTF8(content, "?"),
|
2022-09-25 11:54:00 +01:00
|
|
|
}
|
|
|
|
}
|
2023-04-27 05:32:48 +01:00
|
|
|
|
|
|
|
func (r *Reporter) addMask(msg string) {
|
|
|
|
r.oldnew = append(r.oldnew, msg, "***")
|
|
|
|
r.logReplacer = strings.NewReplacer(r.oldnew...)
|
|
|
|
}
|