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
77cb8ec4
Commit
77cb8ec4
authored
Jun 01, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce container_registry_path_with_namespace
parent
d1fdefee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
app/models/project.rb
app/models/project.rb
+7
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+9
-14
No files found.
app/models/project.rb
View file @
77cb8ec4
...
...
@@ -309,21 +309,25 @@ class Project < ActiveRecord::Base
@repository
||=
Repository
.
new
(
path_with_namespace
,
self
)
end
def
container_registry_path_with_namespace
path_with_namespace
.
downcase
end
def
container_registry_repository
return
unless
Gitlab
.
config
.
registry
.
enabled
@container_registry_repository
||=
begin
token
=
Auth
::
ContainerRegistryAuthenticationService
.
full_access_token
(
path_with_namespace
.
downcas
e
)
token
=
Auth
::
ContainerRegistryAuthenticationService
.
full_access_token
(
container_registry_path_with_namespac
e
)
url
=
Gitlab
.
config
.
registry
.
api_url
host_port
=
Gitlab
.
config
.
registry
.
host_port
registry
=
ContainerRegistry
::
Registry
.
new
(
url
,
token:
token
,
path:
host_port
)
registry
.
repository
(
path_with_namespace
.
downcas
e
)
registry
.
repository
(
container_registry_path_with_namespac
e
)
end
end
def
container_registry_repository_url
if
Gitlab
.
config
.
registry
.
enabled
"
#{
Gitlab
.
config
.
registry
.
host_port
}
/
#{
path_with_namespace
.
downcas
e
}
"
"
#{
Gitlab
.
config
.
registry
.
host_port
}
/
#{
container_registry_path_with_namespac
e
}
"
end
end
...
...
spec/models/project_spec.rb
View file @
77cb8ec4
...
...
@@ -784,6 +784,15 @@ describe Project, models: true do
end
end
describe
'#container_registry_path_with_namespace'
do
let
(
:project
)
{
create
(
:empty_project
,
path:
'PROJECT'
)
}
subject
{
project
.
container_registry_path_with_namespace
}
it
{
is_expected
.
not_to
eq
(
project
.
path_with_namespace
)
}
it
{
is_expected
.
to
eq
(
project
.
path_with_namespace
.
downcase
)
}
end
describe
'#container_registry_repository'
do
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
@@ -792,13 +801,6 @@ describe Project, models: true do
subject
{
project
.
container_registry_repository
}
it
{
is_expected
.
not_to
be_nil
}
context
'for uppercase project path'
do
let
(
:project
)
{
create
(
:empty_project
,
path:
'PROJECT'
)
}
it
{
expect
(
subject
.
path
).
not_to
end_with
(
project
.
path
)
}
it
{
expect
(
subject
.
path
).
to
end_with
(
project
.
path
.
downcase
)
}
end
end
describe
'#container_registry_repository_url'
do
...
...
@@ -817,13 +819,6 @@ describe Project, models: true do
end
it
{
is_expected
.
not_to
be_nil
}
context
'for uppercase project path'
do
let
(
:project
)
{
create
(
:empty_project
,
path:
'PROJECT'
)
}
it
{
is_expected
.
not_to
end_with
(
project
.
path
)
}
it
{
is_expected
.
to
end_with
(
project
.
path
.
downcase
)
}
end
end
context
'for disabled registry'
do
...
...
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