diff --git a/docs/upgrading.md b/docs/upgrading.md index 3c8c3c859053..2eb57efeb145 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -150,6 +150,11 @@ It has been replaced with a link to the [Swagger UI in the versioned documentati When returning a map or array in an expression, you would get a Golang representation. This now returns plain JSON. +### Added container name to workflow node error messages + +Workflow node error messages are now prefixed with the container name. +If you are using [Conditional Retries](retries.md#conditional-retries), you may need to adjust your usage of `lastRetry.message` expressions or the `TRANSIENT_ERROR_PATTERN` environment variable. + ### `ARGO_TEMPLATE` removed from main container The environment variable `ARGO_TEMPLATE` which is an internal implementation detail is no longer available inside the `main` container of your workflow pods. diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index bfe327950138..267ed98ad48e 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -895,7 +895,7 @@ func (s *CLISuite) TestWorkflowRetryWithRecreatedPVC() { assert.Equal(t, wfv1.NodeFailed, status.Nodes.FindByDisplayName("print").Phase) // This step is failed intentionally to allow retry. The error message is not related to PVC that is deleted // previously since it is re-created during retry. - assert.Equal(t, "Error (exit code 1)", status.Nodes.FindByDisplayName("print").Message) + assert.Equal(t, "main: Error (exit code 1)", status.Nodes.FindByDisplayName("print").Message) }) } diff --git a/workflow/controller/operator.go b/workflow/controller/operator.go index 892e5f5e604a..c4120f0c6d2e 100644 --- a/workflow/controller/operator.go +++ b/workflow/controller/operator.go @@ -1406,7 +1406,7 @@ func (woc *wfOperationCtx) assessNodeStatus(ctx context.Context, pod *apiv1.Pod, woc.markNodePhase(ctrNodeName, wfv1.NodeRunning) case c.State.Terminated != nil: exitCode := int(c.State.Terminated.ExitCode) - message := fmt.Sprintf("%s (exit code %d): %s", c.State.Terminated.Reason, exitCode, c.State.Terminated.Message) + message := fmt.Sprintf("%s: %s (exit code %d): %s", c.Name, c.State.Terminated.Reason, exitCode, c.State.Terminated.Message) switch exitCode { case 0: woc.markNodePhase(ctrNodeName, wfv1.NodeSucceeded) @@ -1629,6 +1629,7 @@ func (woc *wfOperationCtx) inferFailedReason(pod *apiv1.Pod, tmpl *wfv1.Template if t.Message != "" { msg = fmt.Sprintf("%s: %s", msg, t.Message) } + msg = fmt.Sprintf("%s: %s", ctr.Name, msg) switch { case ctr.Name == common.InitContainerName: