mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-24 15:55:03 +01:00
experiment
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -40,6 +41,8 @@ type Reporter struct {
|
||||
|
||||
debugOutputEnabled bool
|
||||
stopCommandEndToken string
|
||||
|
||||
stepIds []string
|
||||
}
|
||||
|
||||
func NewReporter(ctx context.Context, cancel context.CancelFunc, client client.Client, task *runnerv1.Task) *Reporter {
|
||||
@@ -82,6 +85,13 @@ func (r *Reporter) ResetSteps(l int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reporter) SetStepIdMapping(stepIDs ...string) {
|
||||
r.ResetSteps(len(stepIDs))
|
||||
r.stateMu.Lock()
|
||||
defer r.stateMu.Unlock()
|
||||
r.stepIds = stepIDs
|
||||
}
|
||||
|
||||
func (r *Reporter) Levels() []log.Level {
|
||||
return log.AllLevels
|
||||
}
|
||||
@@ -132,6 +142,12 @@ func (r *Reporter) Fire(entry *log.Entry) error {
|
||||
if v, ok := v.(int); ok && len(r.state.Steps) > v {
|
||||
step = r.state.Steps[v]
|
||||
}
|
||||
} else if v, ok := entry.Data["stepID"]; ok {
|
||||
if v, ok := v.([]string); ok && len(v) >= 1 {
|
||||
if no := slices.Index(r.stepIds, v[0]); no >= 0 && len(r.state.Steps) > no {
|
||||
step = r.state.Steps[no]
|
||||
}
|
||||
}
|
||||
}
|
||||
if step == nil {
|
||||
if !r.duringSteps() {
|
||||
|
||||
Reference in New Issue
Block a user