From 77ed4c37e030ac1564b1cd93b7a14e969a8e77dd Mon Sep 17 00:00:00 2001 From: Urvashi Date: Tue, 22 Apr 2025 13:41:24 -0400 Subject: [PATCH] Fix interrupt state to account for failure correctly If the job hasn't completely failed but some of the pods have failed and we deleted the job we weren't setting the MOSB to interrupted as expected. This was because we had a wrong check for failure state. This patch fixes that. Signed-off-by: Urvashi --- pkg/controller/build/imagebuilder/jobimagebuilder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/build/imagebuilder/jobimagebuilder.go b/pkg/controller/build/imagebuilder/jobimagebuilder.go index 8b61cbddc3..15b28fc588 100644 --- a/pkg/controller/build/imagebuilder/jobimagebuilder.go +++ b/pkg/controller/build/imagebuilder/jobimagebuilder.go @@ -329,7 +329,7 @@ func (j *jobImageBuilder) validateBuilderType(builder buildrequest.Builder) erro func MapJobStatusToBuildStatus(job *batchv1.Job) (mcfgv1.BuildProgress, []metav1.Condition) { // If the job is being deleted and it was not in either a successful or failed state // then the MachineOSBuild should be considered "interrupted" - if job.DeletionTimestamp != nil && job.Status.Succeeded == 0 && job.Status.Failed == 0 { + if job.DeletionTimestamp != nil && job.Status.Succeeded == 0 && job.Status.Failed < constants.JobMaxRetries+1 { return mcfgv1.MachineOSBuildInterrupted, apihelpers.MachineOSBuildInterruptedConditions() }