BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8d0cae3f
Commit
8d0cae3f
authored
Apr 19, 2017
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/gb/container-registry-repository-paths' into 'master'
Fix duplicated container repository names Closes #31117 See merge request !10771
parents
18da66a5
5c92c4dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
9 deletions
+33
-9
path.rb
lib/container_registry/path.rb
+8
-2
path_spec.rb
spec/lib/container_registry/path_spec.rb
+25
-7
No files found.
lib/container_registry/path.rb
View file @
8d0cae3f
...
@@ -48,7 +48,7 @@ module ContainerRegistry
...
@@ -48,7 +48,7 @@ module ContainerRegistry
end
end
def
root_repository?
def
root_repository?
@path
==
repository_project
.
full
_path
@path
==
project
_path
end
end
def
repository_project
def
repository_project
...
@@ -60,7 +60,13 @@ module ContainerRegistry
...
@@ -60,7 +60,13 @@ module ContainerRegistry
def
repository_name
def
repository_name
return
unless
has_project?
return
unless
has_project?
@path
.
remove
(
%r(^
#{
Regexp
.
escape
(
repository_project
.
full_path
)
}
/?)
)
@path
.
remove
(
%r(^
#{
Regexp
.
escape
(
project_path
)
}
/?)
)
end
def
project_path
return
unless
has_project?
repository_project
.
full_path
.
downcase
end
end
def
to_s
def
to_s
...
...
spec/lib/container_registry/path_spec.rb
View file @
8d0cae3f
...
@@ -189,15 +189,10 @@ describe ContainerRegistry::Path do
...
@@ -189,15 +189,10 @@ describe ContainerRegistry::Path do
end
end
context
'when project exists'
do
context
'when project exists'
do
let
(
:group
)
{
create
(
:group
,
path:
'some_group'
)
}
let
(
:group
)
{
create
(
:group
,
path:
'Some_Group'
)
}
let
(
:project
)
do
create
(
:empty_project
,
group:
group
,
name:
'some_project'
)
end
before
do
before
do
allow
(
path
).
to
receive
(
:repository_project
)
create
(
:empty_project
,
group:
group
,
name:
'some_project'
)
.
and_return
(
project
)
end
end
context
'when project path equal repository path'
do
context
'when project path equal repository path'
do
...
@@ -225,4 +220,27 @@ describe ContainerRegistry::Path do
...
@@ -225,4 +220,27 @@ describe ContainerRegistry::Path do
end
end
end
end
end
end
describe
'#project_path'
do
context
'when project does not exist'
do
let
(
:path
)
{
'some/name'
}
it
'returns nil'
do
expect
(
subject
.
project_path
).
to
be_nil
end
end
context
'when project with uppercase characters in path exists'
do
let
(
:path
)
{
'somegroup/myproject/my/image'
}
let
(
:group
)
{
create
(
:group
,
path:
'SomeGroup'
)
}
before
do
create
(
:empty_project
,
group:
group
,
name:
'MyProject'
)
end
it
'returns downcased project path'
do
expect
(
subject
.
project_path
).
to
eq
'somegroup/myproject'
end
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