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
Boxiang Sun
gitlab-ce
Commits
714c408f
Commit
714c408f
authored
Apr 06, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add minor improvements to container registry code
parent
82dea6cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
app/controllers/projects/registry/tags_controller.rb
app/controllers/projects/registry/tags_controller.rb
+2
-4
lib/container_registry/path.rb
lib/container_registry/path.rb
+6
-2
No files found.
app/controllers/projects/registry/tags_controller.rb
View file @
714c408f
...
@@ -15,15 +15,13 @@ module Projects
...
@@ -15,15 +15,13 @@ module Projects
private
private
def
repository
def
image
@image
||=
project
.
container_repositories
@image
||=
project
.
container_repositories
.
find
(
params
[
:repository_id
])
.
find
(
params
[
:repository_id
])
end
end
def
tag
def
tag
return
render_404
unless
params
[
:id
].
present?
@tag
||=
image
.
tag
(
params
[
:id
])
@tag
||=
repository
.
tag
(
params
[
:id
])
end
end
end
end
end
end
...
...
lib/container_registry/path.rb
View file @
714c408f
module
ContainerRegistry
module
ContainerRegistry
##
##
# Class reponsible for extracting project and repository name from
# Class re
s
ponsible for extracting project and repository name from
# image repository path provided by a containers registry API response.
# image repository path provided by a containers registry API response.
#
#
# Example:
# Example:
...
@@ -12,6 +12,8 @@ module ContainerRegistry
...
@@ -12,6 +12,8 @@ module ContainerRegistry
class
Path
class
Path
InvalidRegistryPathError
=
Class
.
new
(
StandardError
)
InvalidRegistryPathError
=
Class
.
new
(
StandardError
)
LEVELS_SUPPORTED
=
3
def
initialize
(
path
)
def
initialize
(
path
)
@path
=
path
@path
=
path
end
end
...
@@ -50,7 +52,9 @@ module ContainerRegistry
...
@@ -50,7 +52,9 @@ module ContainerRegistry
end
end
def
repository_project
def
repository_project
@project
||=
Project
.
where_full_path_in
(
nodes
.
first
(
3
)).
first
@project
||=
Project
.
where_full_path_in
(
nodes
.
first
(
LEVELS_SUPPORTED
))
.
first
end
end
def
repository_name
def
repository_name
...
...
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