Fix code that selects latest pipelines
Ci::Pipeline.latest order by id DESC
The name latest implies that it's reverse chronological, and we did expect it that way.
ok, I think markglenfletchera is correct in gitlab-com/support-forum#1394 (comment 20399939) that
Project#latest_successful_builds_foris giving oldest pipeline rather than latest pipeline. This is a regression introduced by !7333 (merged) where
order(id: :desc)was removed causing this. The offending change was: !7333 (diffs) 9e176c7c719fe485847d0fb0564275_92_108
The confusion was caused by the
latestname implication, which actually didn't order anything, and I think we should add
Ci::Pipeline.latestotherwise it's confusing that it's not actually ordered.