Skip to content

Commit 1953a07

Browse files
committed
fix sorting unpack jobs
1 parent 01b44e8 commit 1953a07

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: pkg/controller/bundle/bundle_unpacker.go

+10
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,16 @@ func sortUnpackJobs(jobs []*batchv1.Job, maxRetainedJobs int) (latest *batchv1.J
868868
if failedI != failedJ {
869869
return !failedI // non-failed job goes first
870870
}
871+
// sort multiple jobs without the Failed condition
872+
if condI == nil && condJ == nil {
873+
return jobs[i].CreationTimestamp.After(jobs[j].CreationTimestamp.Time)
874+
}
875+
if condI == nil {
876+
return true
877+
}
878+
if condJ == nil {
879+
return false
880+
}
871881
return condI.LastTransitionTime.After(condJ.LastTransitionTime.Time)
872882
})
873883
latest = jobs[0]

0 commit comments

Comments
 (0)