Skip to content

Commit

Permalink
feat: include container name in error message. Fixes #10007 (#13790)
Browse files Browse the repository at this point in the history
Signed-off-by: tooptoop4 <[email protected]>
Co-authored-by: Anton Gilgur <[email protected]>
  • Loading branch information
tooptoop4 and agilgur5 authored Nov 5, 2024
1 parent 2f3d6a6 commit f470fda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down
3 changes: 2 additions & 1 deletion workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f470fda

Please sign in to comment.