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.
https://gitlab.com/gitlab-org/gitlab-ce/issues/25993#note_20429761
ok, I think markglenfletchera is correct in https://gitlab.com/gitlab-com/support-forum/issues/1394#note_20399939 that
Project#latest_successful_builds_for
is giving oldest pipeline rather than latest pipeline. This is a regression introduced by !7333 (merged) whereorder(id: :desc)
was removed causing this. The offending change was: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7333/diffs#b22732e5f3 9e176c7c719fe485847d0fb0564275_92_108The confusion was caused by the
latest
name implication, which actually didn't order anything, and I think we should addorder(id: :desc)
toCi::Pipeline.latest
otherwise it's confusing that it's not actually ordered.
Closes #25993 (closed) Closes #26031 (closed)