Skip to content

Commit

Permalink
Merge branch 'main' into fix-gitlab-inherited-permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Feb 5, 2024
2 parents b3d91b8 + c7467b9 commit 3606f02
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pipeline/backend/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,23 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
}

if isImagePullBackOffState(pod) {
return nil, fmt.Errorf("could not pull image for pod %s", pod.Name)
return nil, fmt.Errorf("could not pull image for pod %s", podName)
}

if len(pod.Status.ContainerStatuses) == 0 {
return nil, fmt.Errorf("no container statuses found for pod %s", podName)
}

cs := pod.Status.ContainerStatuses[0]

if cs.State.Terminated == nil {
err := fmt.Errorf("no terminated state found for container %s/%s", podName, cs.Name)
log.Error().Str("taskUUID", taskUUID).Str("pod", podName).Str("container", cs.Name).Interface("state", cs.State).Msg(err.Error())
return nil, err
}

bs := &types.State{
ExitCode: int(pod.Status.ContainerStatuses[0].State.Terminated.ExitCode),
ExitCode: int(cs.State.Terminated.ExitCode),
Exited: true,
OOMKilled: false,
}
Expand Down

0 comments on commit 3606f02

Please sign in to comment.