New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check Docker-Distribution-API-Version header in v2 check #5676
Check Docker-Distribution-API-Version header in v2 check #5676
Conversation
a34e39d
to
1550d1f
Compare
[test] |
1550d1f
to
ab88919
Compare
@@ -311,6 +318,11 @@ func (c *connection) checkV2() (bool, error) { | |||
// handle auth challenges on individual repositories | |||
case code >= 300 || resp.StatusCode < 200: | |||
return false, nil | |||
default: | |||
if mediatype, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")); err == nil && mediatype != "application/json" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're sure all registries return content type correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All v2 registries that I can find (all 2 of them) do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec doesn't say that there is any content. Unfortunately, quay.io violates the spec.
Actually, going to make this docker distribution header. One sec.
ab88919
to
cc4cadd
Compare
if err != nil { | ||
return spec | ||
} | ||
if ref.Registry != "v1.docker.io" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flip to show special handling of v1.docker.io
?:
if err == nil && ref.Registry == "v1.docker.io" {
ref.Registry = ""
return ref.Exact()
}
return spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flipped. Make a call now.
cc4cadd
to
c6cce85
Compare
"Docker-Distribution-API-Version" check is fine, I want more time to think about the v1.docker.io change |
c6cce85
to
97cc976
Compare
like quay.io started doing today. Reverts skipping quay.io
97cc976
to
2de8fcf
Compare
LGTM, clean unit and integration test locally before merging |
Evaluated for origin test up to 2de8fcf |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6899/) |
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6899/) (Image: devenv-rhel7_2638) |
Evaluated for origin merge up to 2de8fcf |
Guard against servers that return non-json for the /v2/ check like
quay.io started doing today. Reverts skipping quay.io