GitLabgitlab-org

cli

main
ply8 git calls224 ms102 KiB6 cachedprotocol v2
439 lines16 KiBRaw
1//go:build !integration
3package dfcmd
5import (
6 "context"
7 "crypto/ecdsa"
8 "crypto/elliptic"
9 "crypto/rand"
10 "crypto/tls"
11 "crypto/x509"
12 "crypto/x509/pkix"
13 "encoding/pem"
14 "errors"
15 "fmt"
16 "io"
17 "math/big"
18 "net/http"
19 "net/http/httptest"
20 "net/url"
21 "os"
22 "os/exec"
23 "path/filepath"
24 "strings"
25 "testing"
26 "time"
28 "github.com/MakeNowJust/heredoc/v2"
29 "github.com/spf13/cobra"
30 "github.com/stretchr/testify/assert"
31 "github.com/stretchr/testify/require"
32 "software.sslmate.com/src/go-pkcs12"
34 "gitlab.com/gitlab-org/cli/internal/cmdutils"
35 "gitlab.com/gitlab-org/cli/internal/config"
36 "gitlab.com/gitlab-org/cli/internal/dependencyfirewall/pm"
37 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
40type fakeExecutor struct {
41 gotName string
42 gotArgs []string
43 gotEnv []string
44 exitErr error
47func (f *fakeExecutor) LookPath(file string) (string, error) { return "/usr/bin/" + file, nil }
49func (f *fakeExecutor) Exec(ctx context.Context, name string, args, env []string) error {
50 return nil
53func (f *fakeExecutor) ExecWithCombinedOutput(ctx context.Context, name string, args, env []string) ([]byte, error) {
54 return nil, nil
57func (f *fakeExecutor) ExecWithIO(ctx context.Context, name string, args, env []string, stdin io.Reader, stdout, stderr io.Writer) error {
58 f.gotName = name
59 f.gotArgs = args
60 f.gotEnv = env
61 return f.exitErr
64var _ cmdutils.Executor = (*fakeExecutor)(nil)
66func envValue(env []string, prefix string) string {
67 for _, e := range env {
68 if strings.HasPrefix(e, prefix) {
69 return e
70 }
71 }
72 return ""
75func testSpec() ProxySpec {
76 return ProxySpec{
77 Manager: pm.NPM,
78 Use: "npm <npm args>",
79 Short: "Run npm through the GitLab Dependency Firewall.",
80 Long: heredoc.Doc("Run npm behind the firewall."),
81 Example: heredoc.Doc("glab dependency-firewall npm ..."),
82 }
85func newTestCmd(f cmdutils.Factory) *cobra.Command { return NewProxyCmd(f, testSpec()) }
87func TestEnvironmentHelp(t *testing.T) {
88 t.Parallel()
89 t.Run("when the spec sets no environment help", func(t *testing.T) {
90 t.Parallel()
91 spec := testSpec()
92 spec.Manager, spec.Use = pm.Pip, "pip <pip args>"
93 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
94 assert.Contains(t, cmd.Annotations["help:environment"], "HTTP_PROXY: outbound proxy for plain-HTTP registries. When it's unset, glab uses HTTPS_PROXY.")
95 })
96 t.Run("when the manager sends plain HTTP through HTTPS_PROXY", func(t *testing.T) {
97 t.Parallel()
98 help := newTestCmd(cmdtest.NewTestFactory(nil)).Annotations["help:environment"]
99 assert.Contains(t, help, "HTTP_PROXY: outbound proxy for plain-HTTP registries when HTTPS_PROXY is unset.")
100 assert.NotContains(t, help, "When it's unset, glab uses HTTPS_PROXY.")
101 })
102 t.Run("when the manager reads several proxy variables of its own", func(t *testing.T) {
103 t.Parallel()
104 cmd := newTestCmd(cmdtest.NewTestFactory(nil))
105 assert.Contains(t, cmd.Annotations["help:environment"], "npm_config_https_proxy, npm_config_proxy: proxy settings for npm. glab reads them first, so the outbound proxy can differ from HTTPS_PROXY and HTTP_PROXY. glab also reads the same settings from your user and global config files (~/.npmrc, $PREFIX/etc/npmrc). glab doesn't read proxy settings from files inside the project.\n")
106 })
107 t.Run("when the manager reads one proxy variable of its own", func(t *testing.T) {
108 t.Parallel()
109 spec := testSpec()
110 spec.Manager, spec.Use = pm.Pip, "pip <pip args>"
111 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
112 assert.Contains(t, cmd.Annotations["help:environment"], "PIP_PROXY: proxy setting for pip. glab reads it first, so the outbound proxy can differ from HTTPS_PROXY and HTTP_PROXY. glab also reads the same settings from your user and global config files (pip.conf, $PIP_CONFIG_FILE). glab doesn't read proxy settings from files inside the project. glab reads pip's --proxy option ahead of all of these.\n")
113 })
114 t.Run("when only some versions of the manager read a setting", func(t *testing.T) {
115 t.Parallel()
116 spec := testSpec()
117 spec.Manager, spec.Use = pm.Yarn, "yarn <yarn args>"
118 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
119 assert.Contains(t, cmd.Annotations["help:environment"], "glab doesn't read proxy settings from files inside the project. For Yarn 2 and later, glab reads only YARN_HTTPS_PROXY and ~/.yarnrc.yml.\n")
120 })
121 t.Run("when the manager is pipenv, which has no --proxy to take", func(t *testing.T) {
122 t.Parallel()
123 spec := testSpec()
124 spec.Manager, spec.Use = pm.Pipenv, "pipenv <pipenv args>"
125 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
126 assert.NotContains(t, cmd.Annotations["help:environment"], "--proxy")
127 })
128 t.Run("when the manager reads no config file of its own", func(t *testing.T) {
129 t.Parallel()
130 spec := testSpec()
131 spec.Manager, spec.Use = pm.Pnpm, "pnpm <pnpm args>"
132 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
133 assert.Contains(t, cmd.Annotations["help:environment"], "npm_config_https_proxy, npm_config_proxy: proxy settings for pnpm. glab reads them first, so the outbound proxy can differ from HTTPS_PROXY and HTTP_PROXY.\n")
134 })
135 t.Run("when the manager reads config files but no proxy variable of its own", func(t *testing.T) {
136 t.Parallel()
137 spec := testSpec()
138 spec.Manager, spec.Use = pm.Maven, "maven <mvn args>"
139 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
140 assert.Contains(t, cmd.Annotations["help:environment"], "NO_PROXY: hosts glab reaches directly instead of through an outbound proxy.\nglab reads the proxy settings for maven from your user and global config files first (~/.m2/settings.xml, ${maven.home}/conf/settings.xml), so the outbound proxy can differ from HTTPS_PROXY and HTTP_PROXY. glab doesn't read proxy settings from files inside the project. glab doesn't support proxy passwords encrypted with settings-security.xml.\n")
141 })
142 t.Run("when the manager reads no proxy variable of its own", func(t *testing.T) {
143 t.Parallel()
144 spec := testSpec()
145 spec.Manager, spec.Use = pm.Poetry, "poetry <poetry args>"
146 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
147 assert.NotContains(t, cmd.Annotations["help:environment"], "reads it first")
148 assert.NotContains(t, cmd.Annotations["help:environment"], "reads them first")
149 })
150 t.Run("when the spec sets its own environment help", func(t *testing.T) {
151 t.Parallel()
152 spec := testSpec()
153 spec.Environment = "GOPROXY: module proxy.\n"
154 cmd := NewProxyCmd(cmdtest.NewTestFactory(nil), spec)
155 assert.Equal(t, "GOPROXY: module proxy.\n", cmd.Annotations["help:environment"])
156 })
159func TestForwardsArgsAndRoutesThroughProxy(t *testing.T) {
160 t.Chdir(t.TempDir())
161 fe := &fakeExecutor{}
162 run := cmdtest.SetupCmdForTest(
163 t,
164 newTestCmd,
165 false,
166 cmdtest.WithExecutor(fe),
167 cmdtest.WithBaseRepo("g", "p", "gitlab.com"),
168 )
170 _, err := run("install --save-dev left-pad")
171 require.NoError(t, err)
173 assert.Equal(t, "/usr/bin/npm", fe.gotName)
174 assert.Equal(t, []string{"install", "--save-dev", "left-pad"}, fe.gotArgs)
175 v := envValue(fe.gotEnv, "HTTPS_PROXY=")
176 require.NotEmpty(t, v, "child env must set HTTPS_PROXY")
177 assert.Contains(t, v, "127.0.0.1", "HTTPS_PROXY must route through the local inspection proxy, got %q", v)
180func TestExitErrorPropagates(t *testing.T) {
181 t.Chdir(t.TempDir())
183 badCmd := exec.Command("sh", "-c", "exit 3")
184 realErr := badCmd.Run()
185 var ee *exec.ExitError
186 require.ErrorAs(t, realErr, &ee)
188 fe := &fakeExecutor{exitErr: realErr}
189 run := cmdtest.SetupCmdForTest(
190 t,
191 newTestCmd,
192 false,
193 cmdtest.WithExecutor(fe),
194 cmdtest.WithBaseRepo("g", "p", "gitlab.com"),
195 )
197 _, err := run("install --save-dev left-pad")
198 require.Error(t, err)
200 var cmdErr *cmdutils.ExitError
201 require.ErrorAs(t, err, &cmdErr)
202 assert.Equal(t, 3, cmdErr.Code)
204 // The Dependency Firewall summary already explains the failure, so the
205 // wrapper must not also trigger fang's ERROR block. Wrapping SilentError
206 // preserves the exit code while suppressing that duplicate output.
207 assert.ErrorIs(t, err, cmdutils.SilentError, "wrapper failure must be silent so no ERROR block prints after the summary")
210// TestChildNeverRanErrorIsNotSilenced covers the path where the package
211// manager never actually executed (e.g. fork/exec failure). No summary box is
212// rendered in that case, so the error must stay visible — silencing it would
213// exit non-zero with nothing printed.
214func TestChildNeverRanErrorIsNotSilenced(t *testing.T) {
215 t.Chdir(t.TempDir())
217 // A plain error (not an *exec.ExitError) models the child never running.
218 fe := &fakeExecutor{exitErr: errors.New("fork/exec /usr/bin/npm: permission denied")}
219 run := cmdtest.SetupCmdForTest(
220 t,
221 newTestCmd,
222 false,
223 cmdtest.WithExecutor(fe),
224 cmdtest.WithBaseRepo("g", "p", "gitlab.com"),
225 )
227 _, err := run("install --save-dev left-pad")
228 require.Error(t, err)
230 var cmdErr *cmdutils.ExitError
231 require.ErrorAs(t, err, &cmdErr)
232 assert.Equal(t, 1, cmdErr.Code, "a generic run failure maps to exit code 1")
233 assert.NotErrorIs(t, err, cmdutils.SilentError, "a child that never ran must surface a visible error, not be silenced")
236// fetchingExecutor GETs url through the inspection proxy the child is handed,
237// so the test observes whether the proxy trusted the registry. The proxy's
238// leaf for an IP authority carries a DNS SAN only, so this child skips
239// hostname verification on its own hop to the proxy.
240type fetchingExecutor struct {
241 fakeExecutor
242 url string
243 status int
246func (f *fetchingExecutor) ExecWithIO(ctx context.Context, _ string, _ []string, env []string, _ io.Reader, _, _ io.Writer) error {
247 proxyURL, err := url.Parse(strings.TrimPrefix(envValue(env, "HTTPS_PROXY="), "HTTPS_PROXY="))
248 if err != nil {
249 return err
250 }
251 client := &http.Client{Transport: &http.Transport{
252 Proxy: http.ProxyURL(proxyURL),
253 TLSClientConfig: &tls.Config{MinVersion: tls.VersionTLS12, InsecureSkipVerify: true}, //nolint:gosec // child -> inspection proxy hop only
254 }}
255 req, err := http.NewRequestWithContext(ctx, http.MethodGet, f.url, http.NoBody)
256 if err != nil {
257 return err
258 }
259 resp, err := client.Do(req)
260 if err != nil {
261 return err
262 }
263 defer resp.Body.Close()
264 _, _ = io.Copy(io.Discard, resp.Body)
265 f.status = resp.StatusCode
266 return nil
269func TestRegistryTrustsCACertForRepoHost(t *testing.T) {
270 t.Chdir(t.TempDir())
271 t.Setenv("GITLAB_CI", "")
272 t.Setenv("GLAB_DF_FAKE_BLOCK", "npm:left-pad@1.3.0")
274 upstream := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
275 _, _ = io.WriteString(w, "ok")
276 }))
277 t.Cleanup(upstream.Close)
278 caPath := filepath.Join(t.TempDir(), "ca.pem")
279 require.NoError(t, os.WriteFile(caPath, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: upstream.Certificate().Raw}), 0o600))
281 cfg := config.NewFromString(heredoc.Docf(`
282 hosts:
283 gitlab.example.com:
284 ca_cert: %s
285 `, caPath))
286 fe := &fetchingExecutor{url: upstream.URL + "/ping"}
287 run := cmdtest.SetupCmdForTest(
288 t,
289 newTestCmd,
290 false,
291 cmdtest.WithExecutor(fe),
292 cmdtest.WithConfig(cfg),
293 cmdtest.WithBaseRepo("g", "p", "gitlab.example.com"),
294 )
296 _, err := run("install")
297 require.NoError(t, err)
298 assert.Equal(t, http.StatusOK, fe.status, "the inspection proxy must trust the registry via ca_cert")
301func TestRunFailsWhenClientCertForRepoHostCannotBeLoaded(t *testing.T) {
302 t.Chdir(t.TempDir())
303 t.Setenv("GITLAB_CI", "")
305 dir := t.TempDir()
306 certPath := filepath.Join(dir, "client.pem")
307 keyPath := filepath.Join(dir, "client-key.pem")
308 require.NoError(t, os.WriteFile(certPath, []byte("not a certificate"), 0o600))
309 require.NoError(t, os.WriteFile(keyPath, []byte("not a key"), 0o600))
310 cfg := config.NewFromString(heredoc.Docf(`
311 hosts:
312 gitlab.example.com:
313 client_cert: %s
314 client_key: %s
315 `, certPath, keyPath))
316 fe := &fakeExecutor{}
317 run := cmdtest.SetupCmdForTest(
318 t,
319 newTestCmd,
320 false,
321 cmdtest.WithExecutor(fe),
322 cmdtest.WithConfig(cfg),
323 cmdtest.WithBaseRepo("g", "p", "gitlab.example.com"),
324 )
326 _, err := run("install")
327 require.ErrorContains(t, err, "failed to load client certificate")
328 assert.Empty(t, fe.gotName, "npm must not run without the outbound proxy client certificate")
331func newClientIdentity(t *testing.T) (*ecdsa.PrivateKey, *x509.Certificate) {
332 t.Helper()
333 key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
334 require.NoError(t, err)
335 template := &x509.Certificate{
336 SerialNumber: big.NewInt(1),
337 Subject: pkix.Name{CommonName: "glab client"},
338 NotBefore: time.Now().Add(-time.Hour),
339 NotAfter: time.Now().Add(time.Hour),
340 ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
341 }
342 der, err := x509.CreateCertificate(rand.Reader, template, template, key.Public(), key)
343 require.NoError(t, err)
344 cert, err := x509.ParseCertificate(der)
345 require.NoError(t, err)
346 return key, cert
349func runInstallWithHostConfig(t *testing.T, hostConfig string) (*fakeExecutor, error) {
350 t.Helper()
351 t.Chdir(t.TempDir())
352 t.Setenv("GITLAB_CI", "")
353 cfg := config.NewFromString("hosts:\n gitlab.example.com:\n" + hostConfig)
354 fe := &fakeExecutor{}
355 run := cmdtest.SetupCmdForTest(
356 t,
357 newTestCmd,
358 false,
359 cmdtest.WithExecutor(fe),
360 cmdtest.WithConfig(cfg),
361 cmdtest.WithBaseRepo("g", "p", "gitlab.example.com"),
362 )
363 _, err := run("install")
364 return fe, err
367func TestRunAcceptsDERClientCertForRepoHost(t *testing.T) {
368 key, cert := newClientIdentity(t)
369 keyDER, err := x509.MarshalPKCS8PrivateKey(key)
370 require.NoError(t, err)
371 dir := t.TempDir()
372 certPath := filepath.Join(dir, "client.der")
373 keyPath := filepath.Join(dir, "client-key.der")
374 require.NoError(t, os.WriteFile(certPath, cert.Raw, 0o600))
375 require.NoError(t, os.WriteFile(keyPath, keyDER, 0o600))
377 fe, err := runInstallWithHostConfig(t, fmt.Sprintf(" client_cert: %s\n client_key: %s\n", certPath, keyPath))
378 require.NoError(t, err)
379 assert.Equal(t, "/usr/bin/npm", fe.gotName, "a DER pair that the API client accepts must not stop the run")
382func TestRunLoadsPKCS12ClientCertForRepoHost(t *testing.T) {
383 key, cert := newClientIdentity(t)
384 bundle, err := pkcs12.Modern.Encode(key, cert, nil, "secret")
385 require.NoError(t, err)
386 bundlePath := filepath.Join(t.TempDir(), "client.p12")
387 require.NoError(t, os.WriteFile(bundlePath, bundle, 0o600))
389 t.Run("correct password", func(t *testing.T) {
390 fe, err := runInstallWithHostConfig(t, fmt.Sprintf(" client_cert: %s\n client_cert_password: secret\n", bundlePath))
391 require.NoError(t, err)
392 assert.Equal(t, "/usr/bin/npm", fe.gotName)
393 })
395 t.Run("wrong password", func(t *testing.T) {
396 fe, err := runInstallWithHostConfig(t, fmt.Sprintf(" client_cert: %s\n client_cert_password: wrong\n", bundlePath))
397 require.ErrorContains(t, err, "incorrect password for the PKCS#12 client certificate")
398 assert.Empty(t, fe.gotName, "npm must not run when the PKCS#12 client certificate cannot be opened")
399 })
402func TestRunIgnoresClientCertWithoutKeyThatIsNotPKCS12(t *testing.T) {
403 _, cert := newClientIdentity(t)
404 certPath := filepath.Join(t.TempDir(), "client.pem")
405 require.NoError(t, os.WriteFile(certPath, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}), 0o600))
407 fe, err := runInstallWithHostConfig(t, fmt.Sprintf(" client_cert: %s\n", certPath))
408 require.NoError(t, err)
409 assert.Equal(t, "/usr/bin/npm", fe.gotName, "a lone client_cert is ignored, as the API client ignores it")
412type noGitExecutor struct{ fakeExecutor }
414func (e *noGitExecutor) LookPath(file string) (string, error) { return "", exec.ErrNotFound }
416func TestBaseRepoErrorSaysGitIsRequired(t *testing.T) {
417 t.Chdir(t.TempDir())
418 fe := &noGitExecutor{}
419 run := cmdtest.SetupCmdForTest(t, newTestCmd, false,
420 cmdtest.WithExecutor(fe),
421 cmdtest.WithBaseRepoError(errors.New("no GitLab remote found")))
423 _, err := run("ci")
425 require.EqualError(t, err, "no GitLab remote found. git is required")
426 assert.Empty(t, fe.gotName)
429func TestBaseRepoErrorWithGitInstalledHasNoGitHint(t *testing.T) {
430 t.Chdir(t.TempDir())
431 run := cmdtest.SetupCmdForTest(t, newTestCmd, false,
432 cmdtest.WithExecutor(&fakeExecutor{}),
433 cmdtest.WithBaseRepoError(errors.New("no GitLab remote found")))
435 _, err := run("ci")
437 require.Error(t, err)
438 assert.NotContains(t, err.Error(), "git is required")
Diagnostics8 git calls · 224 ms
CallStatusSizeTime0224 ms
discover200185 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=59849
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchtree:0 · deepen 1020032 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:02001.8 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=1857
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=dce174ff8c632a19d17eea99c8a9b7c37fb2b592
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1857
git.pkt.payload.max=1830
git.sideband.band1.bytes=1830
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=1830
git.pack.trailer=fb03183b7909876778f740d196d7516811003517
Open pack map
fetchtree:0200650 B · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=650
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=cdbc4acb219224e81172d025f80739e1e383a784
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=650
git.pkt.payload.max=623
git.sideband.band1.bytes=623
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=623
git.pack.trailer=aabedefb11d4348efc4e1168413c6ec52cbf90d2
Open pack map
fetchtree:0200137 B · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=137
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=3947fb0e8a44818807ba9856d1845e66c13cb330
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=137
git.pkt.payload.max=110
git.sideband.band1.bytes=110
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=110
git.pack.trailer=aebb7cefb2477189231b1c8f14034a2fd1f41ce4
Open pack map
fetch2004.4 KiB208 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=208
git.response.bytes=4505
git.response.cache=MISS
git.response.duration_ms=208
git.fetch.wants=820a1fd89da089b46b959f3b266eb90a15bb0a2d
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=4505
git.pkt.payload.max=4478
git.sideband.band1.bytes=4478
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e278e93fa0d806
Request
1d4dfd4c…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format