Commit 1e60ea99 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '293845-allow-nullable-digest' into 'master'

Set registry fields to nullable

See merge request gitlab-org/gitlab!50362
parents e9a0e26c ca154ab0
...@@ -11,11 +11,11 @@ module Types ...@@ -11,11 +11,11 @@ module Types
field :name, GraphQL::STRING_TYPE, null: false, description: 'Name of the tag.' field :name, GraphQL::STRING_TYPE, null: false, description: 'Name of the tag.'
field :path, GraphQL::STRING_TYPE, null: false, description: 'Path of the tag.' field :path, GraphQL::STRING_TYPE, null: false, description: 'Path of the tag.'
field :location, GraphQL::STRING_TYPE, null: false, description: 'URL of the tag.' field :location, GraphQL::STRING_TYPE, null: false, description: 'URL of the tag.'
field :digest, GraphQL::STRING_TYPE, null: false, description: 'Digest of the tag.' field :digest, GraphQL::STRING_TYPE, null: true, description: 'Digest of the tag.'
field :revision, GraphQL::STRING_TYPE, null: false, description: 'Revision of the tag.' field :revision, GraphQL::STRING_TYPE, null: true, description: 'Revision of the tag.'
field :short_revision, GraphQL::STRING_TYPE, null: false, description: 'Short revision of the tag.' field :short_revision, GraphQL::STRING_TYPE, null: true, description: 'Short revision of the tag.'
field :total_size, GraphQL::INT_TYPE, null: false, description: 'The size of the tag.' field :total_size, GraphQL::INT_TYPE, null: true, description: 'The size of the tag.'
field :created_at, Types::TimeType, null: false, description: 'Timestamp when the tag was created.' field :created_at, Types::TimeType, null: true, description: 'Timestamp when the tag was created.'
field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete this tag.' field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete this tag.'
def can_delete def can_delete
......
---
title: Fix viewing container repositories with tags with corrupted manifest
merge_request: 50362
author:
type: fixed
...@@ -4023,12 +4023,12 @@ type ContainerRepositoryTag { ...@@ -4023,12 +4023,12 @@ type ContainerRepositoryTag {
""" """
Timestamp when the tag was created. Timestamp when the tag was created.
""" """
createdAt: Time! createdAt: Time
""" """
Digest of the tag. Digest of the tag.
""" """
digest: String! digest: String
""" """
URL of the tag. URL of the tag.
...@@ -4048,17 +4048,17 @@ type ContainerRepositoryTag { ...@@ -4048,17 +4048,17 @@ type ContainerRepositoryTag {
""" """
Revision of the tag. Revision of the tag.
""" """
revision: String! revision: String
""" """
Short revision of the tag. Short revision of the tag.
""" """
shortRevision: String! shortRevision: String
""" """
The size of the tag. The size of the tag.
""" """
totalSize: Int! totalSize: Int
} }
""" """
......
...@@ -10286,13 +10286,9 @@ ...@@ -10286,13 +10286,9 @@
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "SCALAR",
"name": null, "name": "Time",
"ofType": { "ofType": null
"kind": "SCALAR",
"name": "Time",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
...@@ -10350,13 +10346,9 @@ ...@@ -10350,13 +10346,9 @@
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
...@@ -10368,13 +10360,9 @@ ...@@ -10368,13 +10360,9 @@
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
...@@ -10386,13 +10374,9 @@ ...@@ -10386,13 +10374,9 @@
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
...@@ -10436,13 +10420,9 @@ ...@@ -10436,13 +10420,9 @@
], ],
"type": { "type": {
"kind": "NON_NULL", "kind": "SCALAR",
"name": null, "name": "Int",
"ofType": { "ofType": null
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
}, },
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
...@@ -633,14 +633,14 @@ A tag from a container repository. ...@@ -633,14 +633,14 @@ A tag from a container repository.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `canDelete` | Boolean! | Can the current user delete this tag. | | `canDelete` | Boolean! | Can the current user delete this tag. |
| `createdAt` | Time! | Timestamp when the tag was created. | | `createdAt` | Time | Timestamp when the tag was created. |
| `digest` | String! | Digest of the tag. | | `digest` | String | Digest of the tag. |
| `location` | String! | URL of the tag. | | `location` | String! | URL of the tag. |
| `name` | String! | Name of the tag. | | `name` | String! | Name of the tag. |
| `path` | String! | Path of the tag. | | `path` | String! | Path of the tag. |
| `revision` | String! | Revision of the tag. | | `revision` | String | Revision of the tag. |
| `shortRevision` | String! | Short revision of the tag. | | `shortRevision` | String | Short revision of the tag. |
| `totalSize` | Int! | The size of the tag. | | `totalSize` | Int | The size of the tag. |
### CreateAlertIssuePayload ### CreateAlertIssuePayload
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Container Registry', :js do RSpec.describe 'Container Registry', :js do
include_context 'container registry tags'
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
...@@ -99,6 +101,20 @@ RSpec.describe 'Container Registry', :js do ...@@ -99,6 +101,20 @@ RSpec.describe 'Container Registry', :js do
expect(page).to have_content '20' expect(page).to have_content '20'
end end
end end
describe 'with a tag missing digest' do
before do
stub_container_registry_tags(repository: %r{my/image}, tags: %w[latest stable])
stub_next_container_registry_tags_call(:digest, nil)
visit_container_registry_details 'my/image'
end
it 'renders the tags list correctly' do
expect(page).to have_content('latest')
expect(page).to have_content('stable')
expect(page).to have_content('Digest: N/A')
end
end
end end
describe 'image repo details when image has no name' do describe 'image repo details when image has no name' do
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "type": "object",
"required": ["name", "path", "location", "digest", "revision", "shortRevision", "totalSize", "createdAt", "canDelete"], "required": ["name", "path", "location", "canDelete"],
"properties": { "properties": {
"name": { "name": {
"type": "string" "type": "string"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'container repository details' do RSpec.describe 'container repository details' do
include_context 'container registry tags'
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
include GraphqlHelpers include GraphqlHelpers
...@@ -105,4 +106,20 @@ RSpec.describe 'container repository details' do ...@@ -105,4 +106,20 @@ RSpec.describe 'container repository details' do
expect(tags_response.size).to eq(limit) expect(tags_response.size).to eq(limit)
end end
end end
context 'with tags without a manifest' do
let(:tags_response) { container_repository_details_response.dig('tags', 'nodes') }
let(:errors) { container_repository_details_response.dig('errors') }
%i[digest revision short_revision total_size created_at].each do |nilable_field|
it "returns a list of tags with a nil #{nilable_field}" do
stub_next_container_registry_tags_call(nilable_field, nil)
subject
expect(tags_response.size).to eq(tags.size)
expect(graphql_errors).to eq(nil)
end
end
end
end end
# frozen_string_literal: true
RSpec.shared_context 'container registry tags' do
def stub_next_container_registry_tags_call(method_name, mock_value)
allow_next_instance_of(ContainerRegistry::Tag) do |tag|
allow(tag).to receive(method_name).and_return(mock_value)
end
end
end
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