GitLabgitlab-org
cli
main
1//go:build !integration
3package login
5import (
6 "encoding/json"
7 "errors"
8 "os"
9 "path/filepath"
10 "runtime"
11 "strings"
12 "testing"
14 "github.com/stretchr/testify/assert"
15 "github.com/stretchr/testify/require"
17 "gitlab.com/gitlab-org/cli/internal/config"
18 "gitlab.com/gitlab-org/cli/internal/glinstance"
19 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
20)
22const testHostname = "gitlab.example.com"
24// writeFakeGlab drops an executable file named "glab" (or "glab.exe" on
25// Windows) into dir, so exec.LookPath("glab") succeeds against a PATH
26// containing dir, without depending on a real glab build.
27func writeFakeGlab(t *testing.T, dir string) {
28 t.Helper()
30 name := "glab"
31 if runtime.GOOS == "windows" {
32 name = "glab.exe"
33 }
34 require.NoError(t, os.WriteFile(filepath.Join(dir, name), []byte("#!/bin/sh\n"), 0o755))
35}
37// setPath points PATH (and only PATH) at dirs, so exec.LookPath("glab")
38// resolves exclusively against the fake binaries the test controls.
39func setPath(t *testing.T, dirs ...string) {
40 t.Helper()
41 t.Setenv("PATH", strings.Join(dirs, string(os.PathListSeparator)))
42}
44// setHome points HOME (and USERPROFILE, for Windows parity) at dir.
45func setHome(t *testing.T, dir string) {
46 t.Helper()
47 t.Setenv("HOME", dir)
48 t.Setenv("USERPROFILE", dir)
49 // dockercredhelper.ConfigDir prefers $DOCKER_CONFIG over HOME, so clear
50 // it: an ambient value in the developer's shell would otherwise send
51 // loginDocker's writes outside the sandbox this helper sets up.
52 t.Setenv("DOCKER_CONFIG", "")
53 // The same hazard for the other writers: each prefers its own variable
54 // over the home directory, so a developer who has one set would have this
55 // package's tests write into their real gradle.properties or .npmrc, and
56 // fail. make test clears VISUAL, EDITOR, PAGER and GITLAB_TOKEN, not
57 // these. The two tests that exercise an override set it after this helper
58 // has run.
59 t.Setenv("GRADLE_USER_HOME", "")
60 t.Setenv("npm_config_userconfig", "")
61 t.Setenv("NPM_CONFIG_USERCONFIG", "")
62 t.Setenv("SBT_CONFIG_HOME", "")
63 t.Setenv("XDG_CONFIG_HOME", "")
64 t.Setenv("LOCALAPPDATA", "")
65}
67// failingConfig wraps a config.Config and makes reads of failKey return err,
68// standing in for the failures a config read surfaces in production: a
69// structurally broken host entry, or a keyring that is locked or denies
70// access.
71type failingConfig struct {
72 config.Config
73 failKey string
74 err error
75}
77func (c failingConfig) GetWithSource(hostname, key string, searchENVVars bool) (string, string, error) {
78 if key == c.failKey {
79 return "", "", c.err
80 }
81 return c.Config.GetWithSource(hostname, key, searchENVVars)
82}
84func (c failingConfig) Get(hostname, key string) (string, error) {
85 if key == c.failKey {
86 return "", c.err
87 }
88 return c.Config.Get(hostname, key)
89}
91// writeFailingConfig wraps a config.Config whose Write fails, standing in for
92// an unwritable configuration file: a read-only directory, or a full disk.
93type writeFailingConfig struct {
94 config.Config
95 err error
96}
98func (c writeFailingConfig) Write() error { return c.err }
100func newFixtureConfig(t *testing.T) config.Config {
101 t.Helper()
102 return config.NewFromString(`
103---
104hosts:
105 ` + testHostname + `:
106 token: token1
107`)
108}
110func readDockerConfig(t *testing.T, home string) map[string]any {
111 t.Helper()
112 data, err := os.ReadFile(filepath.Join(home, ".docker", "config.json"))
113 require.NoError(t, err)
115 var parsed map[string]any
116 require.NoError(t, json.Unmarshal(data, &parsed))
117 return parsed
118}
120func TestLoginDocker_InstallsShim(t *testing.T) {
121 binDir := t.TempDir()
122 home := t.TempDir()
123 writeFakeGlab(t, binDir)
124 setPath(t, binDir)
125 setHome(t, home)
127 ios, _, _, _ := cmdtest.TestIOStreams()
128 cfg := newFixtureConfig(t)
130 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
131 require.NoError(t, err)
133 shimPath := filepath.Join(binDir, "docker-credential-glab")
134 info, statErr := os.Stat(shimPath)
135 require.NoError(t, statErr)
136 assert.Equal(t, os.FileMode(0o700), info.Mode().Perm())
138 content, readErr := os.ReadFile(shimPath)
139 require.NoError(t, readErr)
140 assert.Equal(t, "#!/bin/sh -eu\nexec glab auth docker-helper \"$@\"\n", string(content))
141}
143// TestLoginDocker_WarnsWhenTheShimIsNotOnPath is the last-resort install:
144// nothing on PATH is writable, so the shim lands where Docker cannot resolve
145// it and the command has to say so.
146func TestLoginDocker_WarnsWhenTheShimIsNotOnPath(t *testing.T) {
147 if runtime.GOOS == "windows" {
148 t.Skip("POSIX directory modes not enforced on Windows")
149 }
150 if os.Geteuid() == 0 {
151 t.Skip("root bypasses the directory mode this test relies on")
152 }
154 binDir := t.TempDir()
155 writeFakeGlab(t, binDir)
156 require.NoError(t, os.Chmod(binDir, 0o555))
157 t.Cleanup(func() { _ = os.Chmod(binDir, 0o755) })
159 home := t.TempDir()
160 setPath(t, binDir)
161 setHome(t, home)
163 ios, _, _, errOut := cmdtest.TestIOStreams()
164 cfg := newFixtureConfig(t)
166 require.NoError(t, loginDocker(ios, cfg, testHostname, "registry.example.com"))
168 localBin := filepath.Join(home, ".local", "bin")
169 assert.FileExists(t, filepath.Join(localBin, "docker-credential-glab"))
170 assert.Contains(t, errOut.String(), localBin)
171 assert.Contains(t, errOut.String(), "not on your PATH")
172}
174func TestLoginDocker_WritesCredHelpers(t *testing.T) {
175 binDir := t.TempDir()
176 home := t.TempDir()
177 writeFakeGlab(t, binDir)
178 setPath(t, binDir)
179 setHome(t, home)
181 ios, _, _, _ := cmdtest.TestIOStreams()
182 cfg := newFixtureConfig(t)
184 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
185 require.NoError(t, err)
187 dockerCfg := readDockerConfig(t, home)
188 credHelpers, ok := dockerCfg["credHelpers"].(map[string]any)
189 require.True(t, ok, "credHelpers should be present in ~/.docker/config.json")
190 assert.Equal(t, "glab", credHelpers["registry.example.com"])
191}
193func TestLoginDocker_WritesCredHelpersToDockerConfigEnv(t *testing.T) {
194 binDir := t.TempDir()
195 home := t.TempDir()
196 dockerDir := t.TempDir()
197 writeFakeGlab(t, binDir)
198 setPath(t, binDir)
199 setHome(t, home)
200 t.Setenv("DOCKER_CONFIG", dockerDir)
202 ios, _, _, _ := cmdtest.TestIOStreams()
203 cfg := newFixtureConfig(t)
205 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
206 require.NoError(t, err)
208 data, readErr := os.ReadFile(filepath.Join(dockerDir, "config.json"))
209 require.NoError(t, readErr)
211 var parsed map[string]any
212 require.NoError(t, json.Unmarshal(data, &parsed))
214 credHelpers, ok := parsed["credHelpers"].(map[string]any)
215 require.True(t, ok, "credHelpers should be present in $DOCKER_CONFIG/config.json")
216 assert.Equal(t, "glab", credHelpers["registry.example.com"])
218 // $DOCKER_CONFIG wins outright: the HOME-derived path is where Docker
219 // would not look, so writing there instead would fail silently.
220 _, statErr := os.Stat(filepath.Join(home, ".docker", "config.json"))
221 assert.True(t, os.IsNotExist(statErr), "~/.docker/config.json should not have been created")
222}
224func TestLoginDocker_RegistersArtifactRegistryDomain(t *testing.T) {
225 binDir := t.TempDir()
226 home := t.TempDir()
227 writeFakeGlab(t, binDir)
228 setPath(t, binDir)
229 setHome(t, home)
231 ios, _, _, _ := cmdtest.TestIOStreams()
232 cfg := newFixtureConfig(t)
234 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
235 require.NoError(t, err)
237 domains, getErr := cfg.Get(testHostname, "artifact_registry_domains")
238 require.NoError(t, getErr)
239 assert.Contains(t, domains, "registry.example.com")
240}
242func TestLoginDocker_GlabNotOnPath(t *testing.T) {
243 emptyBinDir := t.TempDir()
244 home := t.TempDir()
245 setPath(t, emptyBinDir)
246 setHome(t, home)
248 ios, _, _, _ := cmdtest.TestIOStreams()
249 cfg := newFixtureConfig(t)
251 preDomains, err := cfg.Get(testHostname, "artifact_registry_domains")
252 require.NoError(t, err)
254 err = loginDocker(ios, cfg, testHostname, "registry.example.com")
255 require.Error(t, err)
257 // Partial-failure guard: nothing should have been written.
258 _, statErr := os.Stat(filepath.Join(home, ".docker", "config.json"))
259 assert.True(t, os.IsNotExist(statErr), "docker config.json should not have been created")
261 postDomains, err := cfg.Get(testHostname, "artifact_registry_domains")
262 require.NoError(t, err)
263 assert.Equal(t, preDomains, postDomains)
264}
266func TestLoginDocker_RunningTwiceDoesNotDuplicateDomain(t *testing.T) {
267 binDir := t.TempDir()
268 home := t.TempDir()
269 writeFakeGlab(t, binDir)
270 setPath(t, binDir)
271 setHome(t, home)
273 ios, _, _, _ := cmdtest.TestIOStreams()
274 cfg := newFixtureConfig(t)
276 require.NoError(t, loginDocker(ios, cfg, testHostname, "registry.example.com"))
277 require.NoError(t, loginDocker(ios, cfg, testHostname, "registry.example.com"))
279 domains, err := cfg.Get(testHostname, "artifact_registry_domains")
280 require.NoError(t, err)
282 count := 0
283 for _, d := range config.ParseDomains(domains) {
284 if d == "registry.example.com" {
285 count++
286 }
287 }
288 assert.Equal(t, 1, count, "registry.example.com should appear exactly once in %q", domains)
289}
291// TestLoginDocker_AlreadyRecordedDomainSkipsTheWrite pins that a re-login
292// whose domain is already recorded writes nothing: the config write is skipped,
293// not just the append. Rewriting the file from a snapshot taken before a
294// concurrent login would drop the entry that login had added.
295//
296// The config's Write fails, so the test passes only if it was never called.
297func TestLoginDocker_AlreadyRecordedDomainSkipsTheWrite(t *testing.T) {
298 binDir := t.TempDir()
299 home := t.TempDir()
300 writeFakeGlab(t, binDir)
301 setPath(t, binDir)
302 setHome(t, home)
304 ios, _, _, _ := cmdtest.TestIOStreams()
305 cfg := writeFailingConfig{
306 Config: config.NewFromString(`
307---
308hosts:
309 ` + testHostname + `:
310 token: token1
311 artifact_registry_domains: registry.example.com
312`),
313 err: errors.New("disk is full"),
314 }
316 require.NoError(t, loginDocker(ios, cfg, testHostname, "registry.example.com"))
317}
319// TestLoginDocker_WarnsOnShadowedDockerLogin covers the credential `docker
320// login` left in config.json. Docker consults credHelpers ahead of it, so it is
321// now dead weight the user has to be told about, or they will keep believing
322// that stored credential is what authenticates their pulls.
323func TestLoginDocker_WarnsOnShadowedDockerLogin(t *testing.T) {
324 binDir := t.TempDir()
325 home := t.TempDir()
326 writeFakeGlab(t, binDir)
327 setPath(t, binDir)
328 setHome(t, home)
330 dockerDir := filepath.Join(home, ".docker")
331 require.NoError(t, os.MkdirAll(dockerDir, 0o700))
332 require.NoError(t, os.WriteFile(filepath.Join(dockerDir, "config.json"),
333 []byte(`{"auths":{"registry.example.com":{"auth":"dXNlcjpwYXNzd29yZA=="}}}`), 0o600))
335 ios, _, _, errOut := cmdtest.TestIOStreams()
336 cfg := newFixtureConfig(t)
338 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
339 require.NoError(t, err)
340 assert.Contains(t, errOut.String(), "registry.example.com already had credentials from `docker login`")
341 assert.Contains(t, errOut.String(), "docker logout registry.example.com")
342}
344func TestLoginDocker_NoShadowedLoginWarningWithoutStoredCredentials(t *testing.T) {
345 binDir := t.TempDir()
346 home := t.TempDir()
347 writeFakeGlab(t, binDir)
348 setPath(t, binDir)
349 setHome(t, home)
351 ios, _, _, errOut := cmdtest.TestIOStreams()
352 cfg := newFixtureConfig(t)
354 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
355 require.NoError(t, err)
356 assert.NotContains(t, errOut.String(), "already had credentials from `docker login`")
357}
359// TestLoginDocker_WarnsWhenAnotherHostResolvesTheRegistry covers a domain
360// already recorded under an earlier host. artifact_registry_domains is per-host,
361// but the credential helper takes the first host that lists the domain, so this
362// login would otherwise report success while `docker pull` keeps authenticating
363// against the other host.
364func TestLoginDocker_WarnsWhenAnotherHostResolvesTheRegistry(t *testing.T) {
365 binDir := t.TempDir()
366 home := t.TempDir()
367 writeFakeGlab(t, binDir)
368 setPath(t, binDir)
369 setHome(t, home)
371 ios, _, _, errOut := cmdtest.TestIOStreams()
372 // cfg.Hosts() hoists gitlab.com to the front whatever the file's order, so
373 // it is the host the credential helper resolves the domain through.
374 cfg := config.NewFromString(`
375---
376hosts:
377 ` + testHostname + `:
378 token: token1
379 ` + glinstance.DefaultHostname + `:
380 token: token0
381 artifact_registry_domains: registry.example.com
382`)
384 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
385 require.NoError(t, err)
386 assert.Contains(t, errOut.String(), "also listed in artifact_registry_domains for "+glinstance.DefaultHostname)
387 assert.Contains(t, errOut.String(), "docker pull authenticates against "+glinstance.DefaultHostname+", not "+testHostname)
388}
390// TestLoginDocker_NoCrossHostWarningWhenThisHostResolvesFirst is the case that
391// must stay quiet: another host lists the domain too, but the host being
392// configured comes first, so it is the one Docker resolves.
393func TestLoginDocker_NoCrossHostWarningWhenThisHostResolvesFirst(t *testing.T) {
394 binDir := t.TempDir()
395 home := t.TempDir()
396 writeFakeGlab(t, binDir)
397 setPath(t, binDir)
398 setHome(t, home)
400 ios, _, _, errOut := cmdtest.TestIOStreams()
401 cfg := config.NewFromString(`
402---
403hosts:
404 ` + glinstance.DefaultHostname + `:
405 token: token0
406 ` + testHostname + `:
407 token: token1
408 artifact_registry_domains: registry.example.com
409`)
411 err := loginDocker(ios, cfg, glinstance.DefaultHostname, "registry.example.com")
412 require.NoError(t, err)
413 assert.NotContains(t, errOut.String(), "also listed in artifact_registry_domains")
414}
416func TestLoginDocker_RefusesToReplaceAnotherHelper(t *testing.T) {
417 binDir := t.TempDir()
418 home := t.TempDir()
419 writeFakeGlab(t, binDir)
420 setPath(t, binDir)
421 setHome(t, home)
423 dockerDir := filepath.Join(home, ".docker")
424 require.NoError(t, os.MkdirAll(dockerDir, 0o700))
425 require.NoError(t, os.WriteFile(filepath.Join(dockerDir, "config.json"),
426 []byte(`{"credHelpers":{"registry.example.com":"ecr-login"}}`), 0o600))
428 ios, _, _, _ := cmdtest.TestIOStreams()
429 cfg := newFixtureConfig(t)
431 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
432 require.Error(t, err)
433 assert.Contains(t, err.Error(), "ecr-login")
435 dockerCfg := readDockerConfig(t, home)
436 credHelpers, ok := dockerCfg["credHelpers"].(map[string]any)
437 require.True(t, ok)
438 assert.Equal(t, "ecr-login", credHelpers["registry.example.com"], "the existing helper must survive the refusal")
440 domains, getErr := cfg.Get(testHostname, "artifact_registry_domains")
441 require.NoError(t, getErr)
442 assert.Empty(t, domains, "artifact_registry_domains must not be written when the Docker write is refused")
443}
445// TestLoginDocker_DomainReadFailureNamesTheUnrecordedRegistry covers the read
446// that sits between Register and the config write. It leaves exactly the state
447// a failed write leaves, so it has to report it the same way.
448func TestLoginDocker_DomainReadFailureNamesTheUnrecordedRegistry(t *testing.T) {
449 binDir := t.TempDir()
450 home := t.TempDir()
451 writeFakeGlab(t, binDir)
452 setPath(t, binDir)
453 setHome(t, home)
455 ios, _, _, _ := cmdtest.TestIOStreams()
456 cfg := failingConfig{
457 Config: newFixtureConfig(t),
458 failKey: "artifact_registry_domains",
459 err: errors.New("keyring is locked"),
460 }
462 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
463 require.Error(t, err)
464 assert.Contains(t, err.Error(), "keyring is locked")
465 assert.Contains(t, err.Error(), "docker pull fails against it until this command is rerun")
466}
468// TestLoginDocker_ConfigWriteFailureNamesTheUnrecordedRegistry covers the state
469// left when the config write fails after credHelpers already points at glab:
470// Docker calls the helper, which cannot resolve the registry. The error has to
471// say so, since a bare write failure reads as if nothing had changed.
472func TestLoginDocker_ConfigWriteFailureNamesTheUnrecordedRegistry(t *testing.T) {
473 binDir := t.TempDir()
474 home := t.TempDir()
475 writeFakeGlab(t, binDir)
476 setPath(t, binDir)
477 setHome(t, home)
479 ios, _, _, _ := cmdtest.TestIOStreams()
480 cfg := writeFailingConfig{Config: newFixtureConfig(t), err: errors.New("disk is full")}
482 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
483 require.Error(t, err)
484 assert.Contains(t, err.Error(), "disk is full")
485 assert.Contains(t, err.Error(), "docker pull fails against it until this command is rerun")
487 credHelpers, ok := readDockerConfig(t, home)["credHelpers"].(map[string]any)
488 require.True(t, ok)
489 assert.Equal(t, "glab", credHelpers["registry.example.com"], "the error describes a credHelpers entry that is really there")
490}
492// TestLoginDocker_WarnsOnDualListedDomain covers the dual-listing the default
493// `glab auth login` config creates: registry.gitlab.com in
494// container_registry_domains, then registered here as an artifact registry.
495// The warning has to say the container-registry fallback will not fire, since
496// run only reaches loginDocker once the exchange has succeeded, and it has to
497// lead with undoing this login rather than with dropping the
498// container_registry_domains entry.
499func TestLoginDocker_WarnsOnDualListedDomain(t *testing.T) {
500 binDir := t.TempDir()
501 home := t.TempDir()
502 writeFakeGlab(t, binDir)
503 setPath(t, binDir)
504 setHome(t, home)
506 ios, _, _, errOut := cmdtest.TestIOStreams()
507 cfg := config.NewFromString(`
508---
509hosts:
510 ` + testHostname + `:
511 token: token1
512 container_registry_domains: registry.example.com
513`)
515 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
516 require.NoError(t, err)
518 warning := errOut.String()
519 assert.Contains(t, warning, "also listed in container_registry_domains")
520 assert.Contains(t, warning, "the fallback will not fire")
522 undo := strings.Index(warning, "glab config set artifact_registry_domains <remaining domains> --host "+testHostname)
523 drop := strings.Index(warning, "glab config set container_registry_domains <remaining domains> --host "+testHostname)
524 require.NotEqual(t, -1, undo, "the warning must offer undoing this login")
525 require.NotEqual(t, -1, drop, "the warning must keep the container_registry_domains remedy")
526 assert.Less(t, undo, drop, "the remedy for a container registry comes first: that is the case where docker pull just broke")
527}
529// TestLoginDocker_DualListedWarningNamesEachHost pins that the two remedies
530// name the host each key is set on. container_registry_domains is read across
531// every host, so the domain can be listed under one host while this login
532// records it under another, and a single --host would send one of the two
533// `glab config set` commands to the wrong file.
534func TestLoginDocker_DualListedWarningNamesEachHost(t *testing.T) {
535 const otherHostname = "gitlab.other.example.com"
537 binDir := t.TempDir()
538 home := t.TempDir()
539 writeFakeGlab(t, binDir)
540 setPath(t, binDir)
541 setHome(t, home)
543 ios, _, _, errOut := cmdtest.TestIOStreams()
544 cfg := config.NewFromString(`
545---
546hosts:
547 ` + testHostname + `:
548 token: token1
549 ` + otherHostname + `:
550 token: token2
551 container_registry_domains: registry.example.com
552`)
554 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
555 require.NoError(t, err)
557 warning := errOut.String()
558 assert.Contains(t, warning, "glab config set artifact_registry_domains <remaining domains> --host "+testHostname)
559 assert.Contains(t, warning, "glab config set container_registry_domains <remaining domains> --host "+otherHostname)
560}
562func TestLoginDocker_NoDualListedWarningWhenNotShared(t *testing.T) {
563 binDir := t.TempDir()
564 home := t.TempDir()
565 writeFakeGlab(t, binDir)
566 setPath(t, binDir)
567 setHome(t, home)
569 ios, _, _, errOut := cmdtest.TestIOStreams()
570 cfg := newFixtureConfig(t)
572 err := loginDocker(ios, cfg, testHostname, "registry.example.com")
573 require.NoError(t, err)
574 assert.NotContains(t, errOut.String(), "also listed in container_registry_domains")
575}
Diagnostics8 git calls · 34 ms
CallStatusSizeTime034 ms
discover200185 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 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 · hit2 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=2 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=44Open pack map
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit3 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=4273 git.response.cache=HIT git.response.duration_ms=3 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 · hit2 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=1857 git.response.cache=HIT git.response.duration_ms=2 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=fb03183b7909876778f740d196d7516811003517Open pack map
fetchtree:0200242 B · hit3 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=242 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=5da85e254ab77f5f6e7e1419be57d524a9f8208e 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=242 git.pkt.payload.max=215 git.sideband.band1.bytes=215 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=215 git.pack.trailer=bd426fb1ae09d9fdcf755902c6903cd2eea819b2Open pack map
fetchtree:0200494 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=21 git.response.bytes=494 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=400358373377bb8e4922d8b821520ebdf8130c4d 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=494 git.pkt.payload.max=467 git.sideband.band1.bytes=467 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=467 git.pack.trailer=363b27e4d94209a9331c11b44fe1ce6e5f4e6e81Open pack map
fetch2004.5 KiB · hit21 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=4607 git.response.cache=HIT git.response.duration_ms=21 git.fetch.wants=ad86420095849a6c41f7cb19ecfe7feca260fc0f 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=4607 git.pkt.payload.max=4580 git.sideband.band1.bytes=4580 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
- a5e2d423bc1c689d
- Request
- 49a486f7…
- 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