diff --git a/pkg/registry/image.go b/pkg/registry/image.go index eac77971..4a823c47 100644 --- a/pkg/registry/image.go +++ b/pkg/registry/image.go @@ -119,6 +119,10 @@ func (i Image) hubLink() (string, error) { return fmt.Sprintf("https://github.com/%s/packages", filepath.ToSlash(filepath.Dir(i.Path))), nil case "gcr.io": return fmt.Sprintf("https://%s/%s", i.Domain, i.Path), nil + case "ghcr.io": + ref := strings.Split(i.Path, "/") + ghUser, ghPackage := ref[0], ref[1] + return fmt.Sprintf("https://github.com/users/%s/packages/container/package/%s", ghUser, ghPackage), nil case "quay.io": return fmt.Sprintf("https://quay.io/repository/%s", i.Path), nil case "registry.access.redhat.com": diff --git a/pkg/registry/image_test.go b/pkg/registry/image_test.go index 25ec0ca7..d9fcdfd7 100644 --- a/pkg/registry/image_test.go +++ b/pkg/registry/image_test.go @@ -101,6 +101,28 @@ func TestParseImage(t *testing.T) { Tag: "latest", }, }, + { + desc: "ghcr ddns-route53", + parseOpts: registry.ParseImageOptions{ + Name: "ghcr.io/crazy-max/ddns-route53", + }, + expected: registry.Image{ + Domain: "ghcr.io", + Path: "crazy-max/ddns-route53", + Tag: "latest", + }, + }, + { + desc: "ghcr radarr", + parseOpts: registry.ParseImageOptions{ + Name: "ghcr.io/linuxserver/radarr", + }, + expected: registry.Image{ + Domain: "ghcr.io", + Path: "linuxserver/radarr", + Tag: "latest", + }, + }, } for _, tt := range testCases { @@ -185,6 +207,20 @@ func TestHubLink(t *testing.T) { }, expected: "https://quay.io/repository/coreos/hyperkube", }, + { + desc: "ghcr ddns-route53", + parseOpts: registry.ParseImageOptions{ + Name: "ghcr.io/crazy-max/ddns-route53", + }, + expected: "https://github.com/users/crazy-max/packages/container/package/ddns-route53", + }, + { + desc: "ghcr radarr", + parseOpts: registry.ParseImageOptions{ + Name: "ghcr.io/linuxserver/radarr", + }, + expected: "https://github.com/users/linuxserver/packages/container/package/radarr", + }, { desc: "redhat etcd", parseOpts: registry.ParseImageOptions{