QA Tests for git protocol v2 support fail consistently
Example: https://gitlab.com/charts/gitlab/-/jobs/138006358
With gitlab-org/build/CNG!175 (merged), we added v2 support for gitlab-shell. But QA jobs are failing.
PS: QA_CAN_TEST_GIT_PROTOCOL_V2
env variable controls whether QA should be even running these tests or not. Used to disable the jobs in instances without v2 support.
Summary of Git Protocol Detection Failure
The git protocol guarantees that, when a handshake is made to initiate the connection, the version of the protocol to be used is passed in the connection headers.
The initial test used a feature that, at some point in the past, may have sent back that information but it is no longer present. The fix is to use a combination of GIT_TRACE_CURL
and GIT_TRACE_CURL_NO_DATA
to see those headers with minimal extra information.
man page excerpt
GIT_TRACE_CURL
Enables a curl full trace dump of all incoming and outgoing
data, including descriptive information, of the git transport
protocol. This is similar to doing curl --trace-ascii on the
command line. This option overrides setting the GIT_CURL_VERBOSE
environment variable. See GIT_TRACE for available trace output options.
GIT_TRACE_CURL_NO_DATA
When a curl trace is enabled (see GIT_TRACE_CURL above), do not dump
data (that is, only dump info lines and headers).
We can then see the version which appears in the header in the format => Send header: Git-Protocol: version=2
.