feat: support post step log
This commit is contained in:
parent
cab56996b7
commit
ab4e06f977
2
go.mod
2
go.mod
|
@ -72,4 +72,4 @@ require (
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/nektos/act => gitea.com/gitea/act v0.0.0-20221116100712-3caee171b716
|
replace github.com/nektos/act => gitea.com/gitea/act v0.0.0-20221117110915-c92dcb7b0a01
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -23,8 +23,8 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy
|
||||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
gitea.com/gitea/act v0.0.0-20221116100712-3caee171b716 h1:wPFBAjfK5OFBruaX9BNSdPoRcVdEbsjviSpryVjFZjY=
|
gitea.com/gitea/act v0.0.0-20221117110915-c92dcb7b0a01 h1:7bwzZWEL0cvSRxeNN0N+4earbjfhgzSJ/zBYRFEnXL0=
|
||||||
gitea.com/gitea/act v0.0.0-20221116100712-3caee171b716/go.mod h1:lpzib6X73FHLSaTqTakan1xcsCAVhlZvPSpLns7jkRo=
|
gitea.com/gitea/act v0.0.0-20221117110915-c92dcb7b0a01/go.mod h1:lpzib6X73FHLSaTqTakan1xcsCAVhlZvPSpLns7jkRo=
|
||||||
gitea.com/gitea/proto-go v0.0.0-20221028125601-35c4f6b05835 h1:27PhT7Nli/pgRo1bDYVZ+hlCKuF9cfFuo+y9muaPVJY=
|
gitea.com/gitea/proto-go v0.0.0-20221028125601-35c4f6b05835 h1:27PhT7Nli/pgRo1bDYVZ+hlCKuF9cfFuo+y9muaPVJY=
|
||||||
gitea.com/gitea/proto-go v0.0.0-20221028125601-35c4f6b05835/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
|
gitea.com/gitea/proto-go v0.0.0-20221028125601-35c4f6b05835/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
|
||||||
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||||
|
|
|
@ -70,19 +70,16 @@ func (r *Reporter) Fire(entry *log.Entry) error {
|
||||||
r.stateM.Lock()
|
r.stateM.Lock()
|
||||||
defer r.stateM.Unlock()
|
defer r.stateM.Unlock()
|
||||||
|
|
||||||
|
log.WithFields(entry.Data).Trace(entry.Message)
|
||||||
|
|
||||||
timestamp := entry.Time
|
timestamp := entry.Time
|
||||||
if r.state.StartedAt == nil {
|
if r.state.StartedAt == nil {
|
||||||
r.state.StartedAt = timestamppb.New(timestamp)
|
r.state.StartedAt = timestamppb.New(timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
var step *runnerv1.StepState
|
stage := entry.Data["stage"]
|
||||||
if v, ok := entry.Data["stepNumber"]; ok {
|
|
||||||
if v, ok := v.(int); ok {
|
|
||||||
step = r.state.Steps[v]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if step == nil {
|
if stage != "Main" {
|
||||||
if v, ok := entry.Data["jobResult"]; ok {
|
if v, ok := entry.Data["jobResult"]; ok {
|
||||||
if jobResult, ok := r.parseResult(v); ok {
|
if jobResult, ok := r.parseResult(v); ok {
|
||||||
r.state.Result = jobResult
|
r.state.Result = jobResult
|
||||||
|
@ -100,10 +97,22 @@ func (r *Reporter) Fire(entry *log.Entry) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var step *runnerv1.StepState
|
||||||
|
if v, ok := entry.Data["stepNumber"]; ok {
|
||||||
|
if v, ok := v.(int); ok {
|
||||||
|
step = r.state.Steps[v]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if step == nil {
|
||||||
|
if !r.duringSteps() {
|
||||||
|
r.logRows = append(r.logRows, r.parseLogRow(entry))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if step.StartedAt == nil {
|
if step.StartedAt == nil {
|
||||||
step.StartedAt = timestamppb.New(timestamp)
|
step.StartedAt = timestamppb.New(timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := entry.Data["raw_output"]; ok {
|
if v, ok := entry.Data["raw_output"]; ok {
|
||||||
if rawOutput, ok := v.(bool); ok && rawOutput {
|
if rawOutput, ok := v.(bool); ok && rawOutput {
|
||||||
if step.LogLength == 0 {
|
if step.LogLength == 0 {
|
||||||
|
@ -111,10 +120,10 @@ func (r *Reporter) Fire(entry *log.Entry) error {
|
||||||
}
|
}
|
||||||
step.LogLength++
|
step.LogLength++
|
||||||
r.logRows = append(r.logRows, r.parseLogRow(entry))
|
r.logRows = append(r.logRows, r.parseLogRow(entry))
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
} else if !r.duringSteps() {
|
||||||
|
r.logRows = append(r.logRows, r.parseLogRow(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := entry.Data["stepResult"]; ok {
|
if v, ok := entry.Data["stepResult"]; ok {
|
||||||
if stepResult, ok := r.parseResult(v); ok {
|
if stepResult, ok := r.parseResult(v); ok {
|
||||||
if step.LogLength == 0 {
|
if step.LogLength == 0 {
|
||||||
|
|
Loading…
Reference in New Issue