Fix regression introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4669
When requesting tags a `application/json` is used.
This commit is contained in:
parent
faee4763f7
commit
04ffd71e53
|
@ -15,11 +15,13 @@ module ContainerRegistry
|
||||||
end
|
end
|
||||||
|
|
||||||
def repository_tags(name)
|
def repository_tags(name)
|
||||||
@faraday.get("/v2/#{name}/tags/list").body
|
response = @faraday.get("/v2/#{name}/tags/list")
|
||||||
|
response.body if response.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
def repository_manifest(name, reference)
|
def repository_manifest(name, reference)
|
||||||
@faraday.get("/v2/#{name}/manifests/#{reference}").body
|
response = @faraday.get("/v2/#{name}/manifests/#{reference}")
|
||||||
|
response.body if response.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
def repository_tag_digest(name, reference)
|
def repository_tag_digest(name, reference)
|
||||||
|
@ -34,7 +36,8 @@ module ContainerRegistry
|
||||||
def blob(name, digest, type = nil)
|
def blob(name, digest, type = nil)
|
||||||
headers = {}
|
headers = {}
|
||||||
headers['Accept'] = type if type
|
headers['Accept'] = type if type
|
||||||
@faraday.get("/v2/#{name}/blobs/#{digest}", nil, headers).body
|
response = @faraday.get("/v2/#{name}/blobs/#{digest}", nil, headers)
|
||||||
|
response.body if response.success?
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_blob(name, digest)
|
def delete_blob(name, digest)
|
||||||
|
@ -47,6 +50,7 @@ module ContainerRegistry
|
||||||
conn.request :json
|
conn.request :json
|
||||||
conn.headers['Accept'] = MANIFEST_VERSION
|
conn.headers['Accept'] = MANIFEST_VERSION
|
||||||
|
|
||||||
|
conn.response :json, content_type: 'application/json'
|
||||||
conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v1+prettyjws'
|
conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v1+prettyjws'
|
||||||
conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v1+json'
|
conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v1+json'
|
||||||
conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v2+json'
|
conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v2+json'
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe ContainerRegistry::Repository do
|
||||||
to_return(
|
to_return(
|
||||||
status: 200,
|
status: 200,
|
||||||
body: JSON.dump(tags: ['test']),
|
body: JSON.dump(tags: ['test']),
|
||||||
headers: { 'Content-Type' => 'application/vnd.docker.distribution.manifest.v2+json' })
|
headers: { 'Content-Type' => 'application/json' })
|
||||||
end
|
end
|
||||||
|
|
||||||
context '#manifest' do
|
context '#manifest' do
|
||||||
|
|
Loading…
Reference in New Issue