Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include container name in error message. Fixes #10007 #13790

Merged
merged 9 commits into from
Nov 5, 2024
2 changes: 1 addition & 1 deletion test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,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, "Error (exit code 1) in main", status.Nodes.FindByDisplayName("print").Message)
tooptoop4 marked this conversation as resolved.
Show resolved Hide resolved
})
}

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 (exit code %d): %s in %s", c.State.Terminated.Reason, exitCode, c.State.Terminated.Message, c.Name)
tooptoop4 marked this conversation as resolved.
Show resolved Hide resolved
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 in %s", msg, ctr.Name)
tooptoop4 marked this conversation as resolved.
Show resolved Hide resolved

switch {
case ctr.Name == common.InitContainerName:
Expand Down
Loading