Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
68bd8992
Commit
68bd8992
authored
Jan 14, 2020
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle invalid repositories in Docker Registry correctly
parent
22e4f0c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
changelogs/unreleased/196158-fix-tags-nil.yml
changelogs/unreleased/196158-fix-tags-nil.yml
+5
-0
ee/app/services/geo/container_repository_sync.rb
ee/app/services/geo/container_repository_sync.rb
+4
-3
ee/spec/services/geo/container_repository_sync_spec.rb
ee/spec/services/geo/container_repository_sync_spec.rb
+15
-0
No files found.
changelogs/unreleased/196158-fix-tags-nil.yml
0 → 100644
View file @
68bd8992
---
title
:
'
Geo:
Handle
repositories
in
Docker
Registry
with
no
tags
gracefully'
merge_request
:
23022
author
:
type
:
fixed
ee/app/services/geo/container_repository_sync.rb
View file @
68bd8992
...
...
@@ -55,10 +55,11 @@ module Geo
def
primary_tags
@primary_tags
||=
begin
tags
=
client
.
repository_tags
(
name
)[
'tags'
]
return
[]
if
tags
.
nil?
manifest
=
client
.
repository_tags
(
name
)
tags
.
map
do
|
tag
|
return
[]
unless
manifest
&&
manifest
[
'tags'
]
manifest
[
'tags'
].
map
do
|
tag
|
{
name:
tag
,
digest:
client
.
repository_tag_digest
(
name
,
tag
)
}
end
end
...
...
ee/spec/services/geo/container_repository_sync_spec.rb
View file @
68bd8992
...
...
@@ -84,5 +84,20 @@ describe Geo::ContainerRepositorySync, :geo do
described_class
.
new
(
container_repository
).
execute
end
context
'when primary repository has no tags'
do
it
'considers the primary repository empty and does not fail'
do
stub_request
(
:get
,
"http://primary.registry.gitlab/v2/group/test/my_image/tags/list"
)
.
with
(
headers:
{
'Authorization'
=>
'bearer pull-token'
})
.
to_return
(
status:
200
,
headers:
{
'Content-Type'
=>
'application/json'
})
expect
(
container_repository
).
to
receive
(
:delete_tag_by_digest
).
with
(
'sha256:aaaaa'
)
described_class
.
new
(
container_repository
).
execute
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment