Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

feat(sg): use us-docker.pkg.dev/sourcegraph-public-images instead of dockerhub for sg ops update-images #64470

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dev/sg/internal/images/gcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"

"github.com/opencontainers/go-digest"

"github.com/sourcegraph/sourcegraph/lib/errors"
)

Expand Down Expand Up @@ -38,9 +39,8 @@ func (r *GCR) Org() string {
}

// Public returns if the registry is used for public purposes or not.
// Right now, we never use GCR for public releases, so it's always false.
func (r *GCR) Public() bool {
return false
return r.Org() == "sourcegraph-public-images"
}

// LoadToken gets the access-token to reach GCR through the environment.
Expand Down Expand Up @@ -76,7 +76,6 @@ func (r *GCR) fetchDigest(repo string, tag string) (digest.Digest, error) {
return "", err
}
return g, nil

}

// GetByTag returns a container repository, on that registry, for a given service at
Expand Down
6 changes: 3 additions & 3 deletions dev/sg/sg_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ var OpsUpdateImagesCommand = &cli.Command{
&cli.StringFlag{
Name: "registry",
Usage: `Sets the registry we want images to update to. If you specify "public" or "internal" as a value it will use:
- docker.io (public)
- us.gcr.io (internal)
- us-docker.pkg.dev/sourcegraph-public-images/sourcegraph-public-images (public)
- us.gcr.io/sourcegraph-dev (internal)
Alternatively, you can provide a custom registry of the format '<host>/<org>'.
`,
Value: "public",
Expand Down Expand Up @@ -194,7 +194,7 @@ func opsUpdateImages(
}
registry = gcr
case "public":
registry = images.NewDockerHub("sourcegraph", dockerUsername, dockerPassword)
registry = images.NewGCR("us-docker.pkg.dev", "sourcegraph-public-images/sourcegraph-public-images")
default:
parts := strings.SplitN(registryType, "/", 2)
if len(parts) < 2 {
Expand Down
Loading