From 2636441f719ac095a942a8ad329019d3e052d133 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Tue, 19 Nov 2024 10:43:35 -0500 Subject: [PATCH] Add more detail to pipeline run failure errors --- core/services/pipeline/runner.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/core/services/pipeline/runner.go b/core/services/pipeline/runner.go index 8722b1371e0..181a1305e4b 100644 --- a/core/services/pipeline/runner.go +++ b/core/services/pipeline/runner.go @@ -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) + } + } + 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") }