Skip to content

Commit

Permalink
fix: show serial and parallel step field
Browse files Browse the repository at this point in the history
  • Loading branch information
jahvon committed Sep 28, 2024
1 parent d99081e commit 2bc8ffb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
6 changes: 1 addition & 5 deletions internal/runner/exec/exec.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package exec

import (
"github.com/jahvon/tuikit/io"
"github.com/pkg/errors"

"github.com/jahvon/flow/internal/context"
Expand Down Expand Up @@ -53,10 +52,7 @@ func (r *execRunner) Exec(ctx *context.Context, e *executable.Executable, inputE
}

logMode := execSpec.LogMode
var logFields map[string]interface{}
if logMode == io.JSON || logMode == io.Logfmt {
logFields = execSpec.GetLogFields()
}
logFields := execSpec.GetLogFields()

switch {
case execSpec.Cmd == "" && execSpec.File == "":
Expand Down
16 changes: 6 additions & 10 deletions internal/runner/parallel/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ func handleExecRef(
return err
}

if exec.Exec != nil {
fields := map[string]interface{}{
"e": exec.ID(),
}
exec.Exec.SetLogFields(fields)
fields := map[string]interface{}{
"step": exec.ID(),
}
exec.Exec.SetLogFields(fields)

group.Go(func() error {
if parallelSpec.FailFast {
Expand Down Expand Up @@ -142,12 +140,10 @@ func handleExec(
maps.Copy(execPromptedEnv, a)
}

if exec.Exec != nil {
fields := map[string]interface{}{
"e": exec.ID(),
}
exec.Exec.SetLogFields(fields)
fields := map[string]interface{}{
"step": exec.ID(),
}
exec.Exec.SetLogFields(fields)

group.Go(func() error {
var attempts int
Expand Down
13 changes: 8 additions & 5 deletions internal/runner/serial/serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ func handleExecRef(
return fmt.Errorf("unable to find e with reference %s", executableRef)
}

if exec.Exec != nil {
fields := map[string]interface{}{
"e": exec.ID(),
}
exec.Exec.SetLogFields(fields)
fields := map[string]interface{}{
"step": exec.ID(),
}
exec.Exec.SetLogFields(fields)

if err := runner.Exec(ctx, exec, promptedEnv); err != nil {
if serialSpec.FailFast {
Expand Down Expand Up @@ -121,6 +119,11 @@ func handleExec(
maps.Copy(execPromptedEnv, a)
}

fields := map[string]interface{}{
"step": exec.ID(),
}
exec.Exec.SetLogFields(fields)

var attempts int
retryLoop:
for {
Expand Down

0 comments on commit 2bc8ffb

Please sign in to comment.