List latest 3 stable versions in the version check endpoint

Problem

In #344682 (closed) we are looking to include more information to admins to encourage upgrading for critical security updates.

One of the items we would like to see is:

A list of suggested versions will need to be provided by the Version Check API so that the instance knows which versions to suggest

Modal-idea-updated

Proposal

Include the lastest patch release of the last 3 feature releases in https://gitlab.com/gitlab-services/version-gitlab-com/-/blob/master/app/controllers/version_checks_controller.rb

Potentially exclude versions that are less/equal to the version information in the gitlab info.

NOTE: From discussion with the requesting party:

>Would it be enough to show Version.last(3)

No, I think it needs to be smarter, as if we do a critical security release, or a far-back backport (rare but happens), we don't want it returning those old patches.
From the latest 3 stable versions we expect them to be:

Each be a different feature release, latest 3 feature releases as determined via semver (not via release date)
Return only the latest semver path from those feature release.

So it's a bit complicated. The release-tools repo has some version files that have to do some similar work that might help as reference: https://gitlab.com/gitlab-org/release-tools/-/blob/master/lib/release_tools/version.rb and https://gitlab.com/gitlab-org/release-tools/-/blob/master/lib/release_tools/versions.rb

Result

GitLab UI is able to present more than just the latest version as a viable update target for critical security releases.

Edited by Amanda Rueda