Skip to content

Commit

Permalink
fix sorting unpack jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitathomas committed May 30, 2024
1 parent 01b44e8 commit 1953a07
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/controller/bundle/bundle_unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,16 @@ func sortUnpackJobs(jobs []*batchv1.Job, maxRetainedJobs int) (latest *batchv1.J
if failedI != failedJ {
return !failedI // non-failed job goes first
}
// sort multiple jobs without the Failed condition
if condI == nil && condJ == nil {
return jobs[i].CreationTimestamp.After(jobs[j].CreationTimestamp.Time)
}
if condI == nil {
return true
}
if condJ == nil {
return false
}
return condI.LastTransitionTime.After(condJ.LastTransitionTime.Time)
})
latest = jobs[0]
Expand Down

0 comments on commit 1953a07

Please sign in to comment.