Skip to content

Commit

Permalink
chore(status): Handling terminated containers (#552)
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Chaudhary <shubham.chaudhary@harness.io>
  • Loading branch information
ispeakc0de committed Sep 5, 2022
1 parent 158c9a8 commit 718e8a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/status/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@ func WaitForCompletion(appNs, appLabel string, clients clients.ClientSets, durat
log.Infof("helper pod status: %v", podStatus)
if podStatus != "Succeeded" && podStatus != "Failed" {
for _, container := range pod.Status.ContainerStatuses {
if container.Name == containerName && container.Ready {
return errors.Errorf("Container is not completed yet")
if container.Name == containerName {
if container.Ready {
return errors.Errorf("Container is not completed yet")
} else if container.State.Terminated != nil && container.State.Terminated.ExitCode == 1 {
podStatus = "Failed"
break
}
}
}
}
Expand Down

0 comments on commit 718e8a8

Please sign in to comment.