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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
e1c8663a
Commit
e1c8663a
authored
May 04, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to copy all manifests from one container repository to another
parent
7168493e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
5 deletions
+38
-5
lib/image_registry/blob.rb
lib/image_registry/blob.rb
+4
-0
lib/image_registry/client.rb
lib/image_registry/client.rb
+1
-1
lib/image_registry/repository.rb
lib/image_registry/repository.rb
+16
-0
lib/image_registry/tag.rb
lib/image_registry/tag.rb
+17
-4
No files found.
lib/image_registry/blob.rb
View file @
e1c8663a
...
@@ -43,5 +43,9 @@ module ImageRegistry
...
@@ -43,5 +43,9 @@ module ImageRegistry
return
@data
if
defined?
(
@data
)
return
@data
if
defined?
(
@data
)
@data
||=
client
.
blob
(
repository
.
name
,
digest
,
type
)
@data
||=
client
.
blob
(
repository
.
name
,
digest
,
type
)
end
end
def
mount_to
(
to_repository
)
client
.
repository_mount_blob
(
to_repository
.
name
,
digest
,
repository
.
name
)
end
end
end
end
end
lib/image_registry/client.rb
View file @
e1c8663a
...
@@ -39,7 +39,7 @@ module ImageRegistry
...
@@ -39,7 +39,7 @@ module ImageRegistry
end
end
def
repository_mount_blob
(
name
,
digest
,
from
)
def
repository_mount_blob
(
name
,
digest
,
from
)
@faraday
.
post
(
"/v2/
#{
name
}
/blob
l
s/uploads/?mount=
#{
digest
}
&from=
#{
from
}
"
).
status
==
201
@faraday
.
post
(
"/v2/
#{
name
}
/blobs/uploads/?mount=
#{
digest
}
&from=
#{
from
}
"
).
status
==
201
end
end
def
repository_tag_digest
(
name
,
reference
)
def
repository_tag_digest
(
name
,
reference
)
...
...
lib/image_registry/repository.rb
View file @
e1c8663a
...
@@ -29,11 +29,27 @@ module ImageRegistry
...
@@ -29,11 +29,27 @@ module ImageRegistry
@tags
=
manifest
[
'tags'
].
map
do
|
tag
|
@tags
=
manifest
[
'tags'
].
map
do
|
tag
|
ImageRegistry
::
Tag
.
new
(
self
,
tag
)
ImageRegistry
::
Tag
.
new
(
self
,
tag
)
end
end
@tags
||=
[]
end
end
def
delete_tags
def
delete_tags
return
unless
tags
return
unless
tags
tags
.
each
(
:delete
)
tags
.
each
(
:delete
)
end
end
def
mount_blob
(
blob
)
return
unless
blob
client
.
repository_mount_blob
(
name
,
blob
.
digest
,
blob
.
repository
.
name
)
end
def
mount_manifest
(
tag
,
manifest
)
client
.
put_repository_manifest
(
name
,
tag
,
manifest
)
end
def
copy_to
(
other_repository
)
tags
.
all?
do
|
tag
|
tag
.
copy_to
(
other_repository
)
end
end
end
end
end
end
lib/image_registry/tag.rb
View file @
e1c8663a
...
@@ -25,11 +25,15 @@ module ImageRegistry
...
@@ -25,11 +25,15 @@ module ImageRegistry
@digest
=
client
.
repository_tag_digest
(
repository
.
name
,
name
)
@digest
=
client
.
repository_tag_digest
(
repository
.
name
,
name
)
end
end
def
config
def
config
_blob
return
@config
if
defined?
(
@config
)
return
@config
_blob
if
defined?
(
@config_blob
)
return
unless
manifest
&&
manifest
[
'config'
]
return
unless
manifest
&&
manifest
[
'config'
]
blob
=
ImageRegistry
::
Blob
.
new
(
repository
,
manifest
[
'config'
])
@config_blob
=
ImageRegistry
::
Blob
.
new
(
repository
,
manifest
[
'config'
])
@config
=
ImageRegistry
::
Config
.
new
(
self
,
blob
)
end
def
config
return
unless
config_blob
@config
||=
ImageRegistry
::
Config
.
new
(
self
,
config_blob
)
end
end
def
created_at
def
created_at
...
@@ -55,6 +59,15 @@ module ImageRegistry
...
@@ -55,6 +59,15 @@ module ImageRegistry
client
.
delete_repository_tag
(
repository
.
name
,
digest
)
client
.
delete_repository_tag
(
repository
.
name
,
digest
)
end
end
def
copy_to
(
repository
)
return
unless
manifest
layers
.
each
do
|
blob
|
repository
.
mount_blob
(
blob
)
end
repository
.
mount_blob
(
config_blob
)
repository
.
mount_manifest
(
name
,
manifest
.
to_json
)
end
def
client
def
client
@client
||=
repository
.
client
@client
||=
repository
.
client
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