Commit aef06bb8 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch...

Merge branch '37972-container-registry-tags-expect-oci-image-configs-to-have-created-field' into 'master'

Resolve "container registry tags expect OCI image configs to have `created` field"

Closes #37972

See merge request gitlab-org/gitlab!21381
parents 081aa0b8 068ed345
---
title: Fix crash registry contains helm charts
merge_request: 21381
author:
type: fixed
...@@ -83,6 +83,8 @@ module ContainerRegistry ...@@ -83,6 +83,8 @@ module ContainerRegistry
strong_memoize(:created_at) do strong_memoize(:created_at) do
DateTime.rfc3339(config['created']) DateTime.rfc3339(config['created'])
rescue ArgumentError
nil
end end
end end
......
{
"name": "mychart",
"version": "0.1.0",
"description": "A Helm chart for Kubernetes",
"apiVersion": "v2",
"appVersion": "1.16.0",
"type": "application"
}
{
"schemaVersion": 2,
"config": {
"mediaType": "application/vnd.cncf.helm.config.v1+json",
"digest": "sha256:65a07b841ece031e6d0ec5eb948eacb17aa6d7294cdeb01d5348e86242951487",
"size": 141
},
"layers": [
{
"mediaType": "application/tar+gzip",
"digest": "sha256:896935a875c8fe8f8b9b81e5862413de316f8da3d6d9a7e0f6f1e90f6204f551",
"size": 2801
}
]
}
...@@ -97,6 +97,29 @@ describe ContainerRegistry::Tag do ...@@ -97,6 +97,29 @@ describe ContainerRegistry::Tag do
end end
end end
context 'image is a helm chart' do
before do
stub_request(:get, 'http://registry.gitlab/v2/group/test/manifests/tag')
.with(headers: headers)
.to_return(
status: 200,
body: File.read(Rails.root + 'spec/fixtures/container_registry/tag_manifest_helm.json'),
headers: { 'Content-Type' => 'application/vnd.docker.distribution.manifest.v2+json' })
stub_request(:get, 'http://registry.gitlab/v2/group/test/blobs/sha256:65a07b841ece031e6d0ec5eb948eacb17aa6d7294cdeb01d5348e86242951487')
.with(headers: { 'Accept' => 'application/vnd.cncf.helm.config.v1+json' })
.to_return(
status: 200,
body: File.read(Rails.root + 'spec/fixtures/container_registry/config_blob_helm.json'))
end
context '#created_at' do
subject { tag.created_at }
it { is_expected.to be_nil }
end
end
context 'schema v2' do context 'schema v2' do
before do before do
stub_request(:get, 'http://registry.gitlab/v2/group/test/manifests/tag') stub_request(:get, 'http://registry.gitlab/v2/group/test/manifests/tag')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment