Kaynağa Gözat

Merge pull request #1918 from porter-dev/staging

Alt GCR hostnames fix -> production
abelanger5 4 yıl önce
ebeveyn
işleme
f55f862177
1 değiştirilmiş dosya ile 14 ekleme ve 1 silme
  1. 14 1
      internal/registry/registry.go

+ 14 - 1
internal/registry/registry.go

@@ -129,9 +129,22 @@ func (r *Registry) listGCRRepositories(
 	// for oauth. This also prevents us from making more requests.
 	client := &http.Client{}
 
+	regURL := r.URL
+
+	if !strings.HasPrefix(regURL, "http") {
+		regURL = fmt.Sprintf("https://%s", regURL)
+	}
+
+	regURLParsed, err := url.Parse(regURL)
+	regHostname := "gcr.io"
+
+	if err == nil {
+		regHostname = regURLParsed.Host
+	}
+
 	req, err := http.NewRequest(
 		"GET",
-		"https://gcr.io/v2/_catalog",
+		fmt.Sprintf("https://%s/v2/_catalog", regHostname),
 		nil,
 	)