Skip to content

Commit

Permalink
feat(executor): Move exit code capture to controller. See #5251
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Collins <alex_collins@intuit.com>
  • Loading branch information
alexec committed Mar 2, 2021
1 parent f7fcfa4 commit 4e97d2a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,11 +1197,15 @@ func (woc *wfOperationCtx) assessNodeStatus(pod *apiv1.Pod, node *wfv1.NodeStatu
node.Phase = wfv1.NodeError
} else {
node.Outputs = &outputs
for _, c := range pod.Status.ContainerStatuses {
if c.Name == common.MainContainerName { // main container MUST bo terminated when outputs are set
node.Outputs.ExitCode = pointer.StringPtr(fmt.Sprint(c.State.Terminated.ExitCode))
}
}
}
for _, c := range pod.Status.ContainerStatuses {
if c.Name == common.MainContainerName && c.State.Terminated != nil {
if node.Outputs == nil {
node.Outputs = &wfv1.Outputs{}
}
node.Outputs.ExitCode = pointer.StringPtr(fmt.Sprint(c.State.Terminated.ExitCode))
updated = true
}
}
if node.Phase != newPhase {
Expand Down

0 comments on commit 4e97d2a

Please sign in to comment.