sg: detect and use dockerhub registry (#61592)

This commit is contained in:
William Bezuidenhout 2024-04-04 16:25:29 +02:00 committed by GitHub
parent 5a370f22ba
commit eb588d7b13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -202,6 +202,13 @@ func opsUpdateImages(
return errors.Errorf("invalid custom registry %q", registryType)
}
// might have specified the public registry url without knowing, so we check and create dockrhub!
if strings.Contains(registryType, "index.docker.io") {
registry = images.NewDockerHub("sourcegraph", dockerUsername, dockerPassword)
std.Out.WriteNoticef("using Docker Hub registry %s/%s", registry.Host(), registry.Org())
break
}
// custom regisry is in the format <host>/<org>, so host = parts[0], org = parts[1]
gcr := images.NewGCR(parts[0], parts[1])
if err := gcr.LoadToken(); err != nil {