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
4 changes: 4 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ To disable this set `metricsConfig.secure` to `false`.
When returning a map or array in an expression, you would get a Golang representation.
This now returns plain JSON.

### Container name in error messages
tooptoop4 marked this conversation as resolved.
Show resolved Hide resolved

Error messages are prefixed with container name, you may need to adjust your `lastRetry.message` expressions or `TRANSIENT_ERROR_PATTERN` variable. See [Conditional retries](retries.md)
tooptoop4 marked this conversation as resolved.
Show resolved Hide resolved

### `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 @@ -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, "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
Loading