Explorar o código

add project id to request

Alexander Belanger %!s(int64=5) %!d(string=hai) anos
pai
achega
324594111f
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      internal/registry/registry.go

+ 10 - 1
internal/registry/registry.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"net/http"
 	"net/url"
+	"strings"
 	"time"
 
 	"github.com/aws/aws-sdk-go/service/ecr"
@@ -282,9 +283,17 @@ func (r *Registry) listGCRImages(repoName string, repo repository.Repository) ([
 	// use JWT token to request catalog
 	client := &http.Client{}
 
+	parsedURL, err := url.Parse(r.URL)
+
+	if err != nil {
+		return nil, err
+	}
+
+	trimmedPath := strings.Trim(parsedURL.Path, "/")
+
 	req, err := http.NewRequest(
 		"GET",
-		fmt.Sprintf("https://gcr.io/v2/%s/tags/list", repoName),
+		fmt.Sprintf("https://gcr.io/v2/%s/%s/tags/list", trimmedPath, repoName),
 		nil,
 	)