Skip to content

Commit

Permalink
GCB project IDs guessing to support Artifact Registry (#6093)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Jun 28, 2021
1 parent e85b2f8 commit 7dad6fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/skaffold/gcp/projectid.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func ExtractProjectID(imageName string) (string, error) {
}

registry := ref.Context().Registry.Name()
if registry == "gcr.io" || strings.HasSuffix(registry, ".gcr.io") {
if registry == "gcr.io" || strings.HasSuffix(registry, ".gcr.io") || strings.HasSuffix(registry, "-docker.pkg.dev") {
parts := strings.Split(imageName, "/")
if len(parts) >= 2 {
return parts[1], nil
Expand Down
5 changes: 5 additions & 0 deletions pkg/skaffold/gcp/projectid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func TestExtractProjectID(t *testing.T) {
imageName: "gcr.io/project/image",
expected: "project",
},
{
description: "us-east1-docker.pkg.dev",
imageName: "us-east1-docker.pkg.dev/project/yyy/go-hello-world:latest",
expected: "project",
},
{
description: "docker hub",
imageName: "project/image",
Expand Down

0 comments on commit 7dad6fa

Please sign in to comment.