Skip to content

Commit

Permalink
Add more detail to pipeline run failure errors
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Nov 19, 2024
1 parent cf277b8 commit 2636441
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions core/services/pipeline/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,21 @@ func (r *runner) run(ctx context.Context, pipeline *Pipeline, run *Run, vars Var
)
}
l = l.With("run.State", run.State, "fatal", run.HasFatalErrors(), "runTime", runTime)
if run.HasFatalErrors() {
// This will also log at error level in OCR if it fails Observe so the
// level is appropriate
l = l.With("run.FatalErrors", run.FatalErrors)
l.Debugw("Completed pipeline run with fatal errors")
} else if run.HasErrors() {
l = l.With("run.AllErrors", run.AllErrors)
l.Debugw("Completed pipeline run with errors")
if run.HasFatalErrors() || run.HasErrors() {
var errorsWithID []string
for _, taskRun := range run.PipelineTaskRuns {
if taskRun.Error.Valid {
err := fmt.Sprintf("%s(%s); %s", taskRun.DotID, taskRun.Type, taskRun.Error.ValueOrZero())
errorsWithID = append(errorsWithID, err)

Check failure on line 518 in core/services/pipeline/runner.go

View workflow job for this annotation

GitHub Actions / lint

SA4010: this result of append is never used, except maybe in other appends (staticcheck)
}
}
if run.HasFatalErrors() {
l = l.With("run.FatalErrors", run.FatalErrors)
l.Debugw("Completed pipeline run with fatal errors")
} else if run.HasErrors() {
l = l.With("run.AllErrors", run.AllErrors)
l.Debugw("Completed pipeline run with errors")
}
} else if r.config.VerboseLogging() {
l.Debugw("Completed pipeline run successfully")
}
Expand Down

0 comments on commit 2636441

Please sign in to comment.