diff --git a/Gopkg.lock b/Gopkg.lock index f6fd8e41..da5bd82d 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -442,7 +442,7 @@ branch = "master" name = "github.com/rusenask/docker-registry-client" packages = ["registry"] - revision = "2f0bd62922f141c5301ccbd30d93528ebbe73f41" + revision = "f41c43a13c3852213e225cc2476800c8f734d777" [[projects]] branch = "master" diff --git a/registry/registry_test.go b/registry/registry_test.go index 1098f34b..fa92ebad 100644 --- a/registry/registry_test.go +++ b/registry/registry_test.go @@ -7,6 +7,8 @@ import ( "github.com/keel-hq/keel/constants" + "github.com/rusenask/docker-registry-client/registry" + "fmt" "os" "testing" @@ -302,3 +304,15 @@ var tagsResp = `{ "master-3945" ] }` + + func TestGetDockerHubManyTags(t *testing.T) { + client := registry.New("https://quay.io", "", "") + tags, err := client.Tags("coreos/prometheus-operator") + if err != nil { + t.Errorf("error while getting repo: %s", err) + } + fmt.Println(tags) + } + + + \ No newline at end of file diff --git a/vendor/github.com/rusenask/docker-registry-client/registry/json.go b/vendor/github.com/rusenask/docker-registry-client/registry/json.go index 865057ec..0789d656 100644 --- a/vendor/github.com/rusenask/docker-registry-client/registry/json.go +++ b/vendor/github.com/rusenask/docker-registry-client/registry/json.go @@ -3,8 +3,10 @@ package registry import ( "encoding/json" "errors" + "fmt" "net/http" "regexp" + "strings" ) var ( @@ -31,6 +33,7 @@ func (registry *Registry) getJson(url string, response interface{}) error { // next page URL while updating pointed-to variable with a parsed JSON // value. When there are no more pages it returns `ErrNoMorePages`. func (registry *Registry) getPaginatedJson(url string, response interface{}) (string, error) { + fmt.Println("getting: ", url) resp, err := registry.Client.Get(url) if err != nil { return "", err @@ -42,7 +45,16 @@ func (registry *Registry) getPaginatedJson(url string, response interface{}) (st if err != nil { return "", err } - return getNextLink(resp) + next, err := getNextLink(resp) + if err != nil { + return "", err + } + + if !strings.HasPrefix(next, registry.URL) { + next = registry.URL + next + } + + return next, nil } // Matches an RFC 5988 (https://tools.ietf.org/html/rfc5988#section-5)