func ExtractGCRRepoFromImage()

in images/controller/pkg/util.go [127:138]


func ExtractGCRRepoFromImage(image string) string {
	gcrRepo := ""

	if len(regexp.MustCompile(GCRImageWithTagPattern).FindAllString(image, -1)) > 0 {
		// Extract just the repo/image format from the image, excluding any tag at the end.
		gcrRepo = strings.Split(strings.ReplaceAll(image, "gcr.io/", ""), ":")[0]
	} else if len(regexp.MustCompile(GCRImageWithDigestPattern).FindAllString(image, -1)) > 0 {
		// Extract just the repo/image format from the image, excluding the digest at the end.
		gcrRepo = strings.Split(strings.ReplaceAll(image, "gcr.io/", ""), "@")[0]
	}
	return gcrRepo
}