Skip to content

Commit

Permalink
feat(verify.go): Add pod fail reason and message to output
Browse files Browse the repository at this point in the history
Signed-off-by: Suleiman Dibirov <[email protected]>
  • Loading branch information
idsulik committed Nov 28, 2024
1 parent 8103806 commit dddefa3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/skaffold/verify/k8sjob/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,20 @@ func (v *Verifier) watchJob(ctx context.Context, clientset k8sclient.Interface,
break
}
if pod.Status.Phase == corev1.PodFailed {
podErr = errors.New(fmt.Sprintf("%q running job %q errored during run", tc.Name, job.Name))
failReason := pod.Status.Reason
if failReason == "" {
failReason = "<empty>"
}

failMessage := pod.Status.Message
if failMessage == "" {
failMessage = "<empty>"
}

podErr = errors.New(fmt.Sprintf(
"%q running job %q errored during run: reason=%q, message=%q",
tc.Name, job.Name, failReason, failMessage,
))
break
}

Expand Down

0 comments on commit dddefa3

Please sign in to comment.