frontend: use #40827 to provide the src-cli version and download endpoints
Created by: LawnGnome
This PR uses the sourcegraph.com API added in #40827 to implement the /.api/src-cli/version
and /.api/src-cli/{download}
endpoints, rather than calling out to GitHub directly.
There's also some new caching added that should mean that Sourcegraph instances don't hammer sourcegraph.com with these requests either.
If the API is unavailable or unreachable, the previous behaviour of falling back to the MinimumVersion
constant is preserved. This is mostly going to come into play with any early rollouts of Sourcegraph 4.0 that occur before sourcegraph.com is upgraded to 4.0, but I don't think the behavioural change is significant enough to be a problem.
There's going to be a small merge conflict after #40827 is merged due to both adding the same scoped logger to httpapi.NewHandler
, but that will be trivial to resolve.
Fixes #39468.
Test plan
There's good test coverage, and I've done a bunch of testing locally of the various scenarios, monitoring the requests with ngrok to ensure that the cache behaves as expected and the sourcegraph.com API isn't hit more often than expected.