From dddefa3f4c8cec79194c04e607b3e759f61f881f Mon Sep 17 00:00:00 2001 From: Suleiman Dibirov Date: Thu, 28 Nov 2024 07:33:34 +0200 Subject: [PATCH] feat(verify.go): Add pod fail reason and message to output Signed-off-by: Suleiman Dibirov --- pkg/skaffold/verify/k8sjob/verify.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/skaffold/verify/k8sjob/verify.go b/pkg/skaffold/verify/k8sjob/verify.go index 4911b69794a..332dfe511d6 100644 --- a/pkg/skaffold/verify/k8sjob/verify.go +++ b/pkg/skaffold/verify/k8sjob/verify.go @@ -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 = "" + } + + failMessage := pod.Status.Message + if failMessage == "" { + failMessage = "" + } + + podErr = errors.New(fmt.Sprintf( + "%q running job %q errored during run: reason=%q, message=%q", + tc.Name, job.Name, failReason, failMessage, + )) break }