diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-07-25 13:12:24 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-07-25 13:12:24 +0000 |
commit | 29f2903d161c2b93468a997f704a81adebcc9f58 (patch) | |
tree | ade1b612562de45eb0c9b2675a85d41a73225629 /lib | |
parent | 0674d1274bb53c3c075acf4adc10d9f65be3db32 (diff) | |
parent | a40116065e2a761f6fa8dc7d569cb3e39025f6d3 (diff) | |
download | gitlab-ce-29f2903d161c2b93468a997f704a81adebcc9f58.tar.gz |
Merge branch 'sh-support-docker-oci-images' into 'master'
Support Docker OCI images
Closes gitlab-ee#12877 and #58685
See merge request gitlab-org/gitlab-ce!31127
Diffstat (limited to 'lib')
-rw-r--r-- | lib/container_registry/client.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/container_registry/client.rb b/lib/container_registry/client.rb index c80f49f5ae0..c3a19af7a94 100644 --- a/lib/container_registry/client.rb +++ b/lib/container_registry/client.rb @@ -7,7 +7,9 @@ module ContainerRegistry class Client attr_accessor :uri - MANIFEST_VERSION = 'application/vnd.docker.distribution.manifest.v2+json'.freeze + DOCKER_DISTRIBUTION_MANIFEST_V2_TYPE = 'application/vnd.docker.distribution.manifest.v2+json' + OCI_MANIFEST_V1_TYPE = 'application/vnd.oci.image.manifest.v1+json' + ACCEPTED_TYPES = [DOCKER_DISTRIBUTION_MANIFEST_V2_TYPE, OCI_MANIFEST_V1_TYPE].freeze # Taken from: FaradayMiddleware::FollowRedirects REDIRECT_CODES = Set.new [301, 302, 303, 307] @@ -60,12 +62,13 @@ module ContainerRegistry end def accept_manifest(conn) - conn.headers['Accept'] = MANIFEST_VERSION + conn.headers['Accept'] = ACCEPTED_TYPES 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+json' - conn.response :json, content_type: 'application/vnd.docker.distribution.manifest.v2+json' + conn.response :json, content_type: DOCKER_DISTRIBUTION_MANIFEST_V2_TYPE + conn.response :json, content_type: OCI_MANIFEST_V1_TYPE end def response_body(response, allow_redirect: false) |