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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
08396be6
Commit
08396be6
authored
May 09, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ImageRegistry to ContainerRegistry
parent
565a5e36
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
22 deletions
+21
-22
app/controllers/projects/container_registry_controller.rb
app/controllers/projects/container_registry_controller.rb
+3
-6
app/models/project.rb
app/models/project.rb
+5
-3
lib/container_registry/blob.rb
lib/container_registry/blob.rb
+1
-1
lib/container_registry/client.rb
lib/container_registry/client.rb
+1
-1
lib/container_registry/config.rb
lib/container_registry/config.rb
+1
-1
lib/container_registry/registry.rb
lib/container_registry/registry.rb
+3
-3
lib/container_registry/repository.rb
lib/container_registry/repository.rb
+3
-3
lib/container_registry/tag.rb
lib/container_registry/tag.rb
+4
-4
No files found.
app/controllers/projects/container_registry_controller.rb
View file @
08396be6
...
@@ -5,10 +5,7 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
...
@@ -5,10 +5,7 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
layout
'project'
layout
'project'
def
index
def
index
@tags
=
container_registry
.
tags
@tags
=
container_registry_repository
.
tags
other_repository
=
container_registry
.
registry
[
"gitlab/gitlab-test3"
]
container_registry
.
copy_to
(
other_repository
)
end
end
def
destroy
def
destroy
...
@@ -21,8 +18,8 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
...
@@ -21,8 +18,8 @@ class Projects::ContainerRegistryController < Projects::ApplicationController
private
private
def
container_registry
def
container_registry
_repository
@container_registry
||=
project
.
container_regist
ry
@container_registry
_repository
||=
project
.
container_registry_reposito
ry
end
end
def
tag
def
tag
...
...
app/models/project.rb
View file @
08396be6
...
@@ -376,9 +376,11 @@ class Project < ActiveRecord::Base
...
@@ -376,9 +376,11 @@ class Project < ActiveRecord::Base
end
end
def
container_registry
def
container_registry
@registry_token
||=
Jwt
::
DockerAuthenticationService
.
full_access_token
(
path_with_namespace
)
@container_registry_repository
||=
begin
@registry
||=
ImageRegistry
::
Registry
.
new
(
Gitlab
.
config
.
registry
.
api_url
,
token:
@registry_token
)
token
=
Jwt
::
ContainerRegistryAuthenticationService
.
full_access_token
(
path_with_namespace
)
@container_registry
||=
ImageRegistry
::
Repository
.
new
(
@registry
,
path_with_namespace
)
registry
=
ContainerRegistry
::
Registry
.
new
(
Gitlab
.
config
.
registry
.
api_url
,
token:
token
)
registry
[
path_with_namespace
]
end
end
end
def
container_registry_url
def
container_registry_url
...
...
lib/
image
_registry/blob.rb
→
lib/
container
_registry/blob.rb
View file @
08396be6
module
Image
Registry
module
Container
Registry
class
Blob
class
Blob
attr_reader
:repository
,
:config
attr_reader
:repository
,
:config
...
...
lib/
image
_registry/client.rb
→
lib/
container
_registry/client.rb
View file @
08396be6
require
'faraday'
require
'faraday'
require
'faraday_middleware'
require
'faraday_middleware'
module
Image
Registry
module
Container
Registry
class
Client
class
Client
attr_accessor
:uri
attr_accessor
:uri
...
...
lib/
image
_registry/config.rb
→
lib/
container
_registry/config.rb
View file @
08396be6
module
Image
Registry
module
Container
Registry
class
Config
class
Config
attr_reader
:tag
,
:blob
,
:data
attr_reader
:tag
,
:blob
,
:data
...
...
lib/
image
_registry/registry.rb
→
lib/
container
_registry/registry.rb
View file @
08396be6
module
Image
Registry
module
Container
Registry
class
Registry
class
Registry
attr_reader
:uri
,
:client
attr_reader
:uri
,
:client
def
initialize
(
uri
,
options
=
{})
def
initialize
(
uri
,
options
=
{})
@uri
=
URI
.
parse
(
uri
)
@uri
=
URI
.
parse
(
uri
)
@client
=
Image
Registry
::
Client
.
new
(
uri
,
options
)
@client
=
Container
Registry
::
Client
.
new
(
uri
,
options
)
end
end
def
[]
(
name
)
def
[]
(
name
)
Image
Registry
::
Repository
.
new
(
self
,
name
)
Container
Registry
::
Repository
.
new
(
self
,
name
)
end
end
end
end
end
end
lib/
image
_registry/repository.rb
→
lib/
container
_registry/repository.rb
View file @
08396be6
module
Image
Registry
module
Container
Registry
class
Repository
class
Repository
attr_reader
:registry
,
:name
attr_reader
:registry
,
:name
...
@@ -11,7 +11,7 @@ module ImageRegistry
...
@@ -11,7 +11,7 @@ module ImageRegistry
end
end
def
[]
(
tag
)
def
[]
(
tag
)
Image
Registry
::
Tag
.
new
(
self
,
tag
)
Container
Registry
::
Tag
.
new
(
self
,
tag
)
end
end
def
manifest
def
manifest
...
@@ -27,7 +27,7 @@ module ImageRegistry
...
@@ -27,7 +27,7 @@ module ImageRegistry
return
@tags
if
defined?
(
@tags
)
return
@tags
if
defined?
(
@tags
)
return
[]
unless
manifest
&&
manifest
[
'tags'
]
return
[]
unless
manifest
&&
manifest
[
'tags'
]
@tags
=
manifest
[
'tags'
].
map
do
|
tag
|
@tags
=
manifest
[
'tags'
].
map
do
|
tag
|
Image
Registry
::
Tag
.
new
(
self
,
tag
)
Container
Registry
::
Tag
.
new
(
self
,
tag
)
end
end
@tags
||=
[]
@tags
||=
[]
end
end
...
...
lib/
image
_registry/tag.rb
→
lib/
container
_registry/tag.rb
View file @
08396be6
module
Image
Registry
module
Container
Registry
class
Tag
class
Tag
attr_reader
:repository
,
:name
attr_reader
:repository
,
:name
...
@@ -28,12 +28,12 @@ module ImageRegistry
...
@@ -28,12 +28,12 @@ module ImageRegistry
def
config_blob
def
config_blob
return
@config_blob
if
defined?
(
@config_blob
)
return
@config_blob
if
defined?
(
@config_blob
)
return
unless
manifest
&&
manifest
[
'config'
]
return
unless
manifest
&&
manifest
[
'config'
]
@config_blob
=
Image
Registry
::
Blob
.
new
(
repository
,
manifest
[
'config'
])
@config_blob
=
Container
Registry
::
Blob
.
new
(
repository
,
manifest
[
'config'
])
end
end
def
config
def
config
return
unless
config_blob
return
unless
config_blob
@config
||=
Image
Registry
::
Config
.
new
(
self
,
config_blob
)
@config
||=
Container
Registry
::
Config
.
new
(
self
,
config_blob
)
end
end
def
created_at
def
created_at
...
@@ -45,7 +45,7 @@ module ImageRegistry
...
@@ -45,7 +45,7 @@ module ImageRegistry
return
@layers
if
defined?
(
@layers
)
return
@layers
if
defined?
(
@layers
)
return
unless
manifest
return
unless
manifest
@layers
=
manifest
[
'layers'
].
map
do
|
layer
|
@layers
=
manifest
[
'layers'
].
map
do
|
layer
|
Image
Registry
::
Blob
.
new
(
repository
,
layer
)
Container
Registry
::
Blob
.
new
(
repository
,
layer
)
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