Открыть боковую панель
nt_test134
nt_project_qgddddf2ot8w
Коммиты
77cb8ec4
Коммит
77cb8ec4
создал
Июн 01, 2016
по автору
Kamil Trzcinski
Просмотр файлов
Introduce container_registry_path_with_namespace
владелец
d1fdefee
Изменения
2
Скрыть пробелы
Построчно
Рядом
app/models/project.rb
Просмотр файла @
77cb8ec4
...
@@ -309,21 +309,25 @@ def repository
...
@@ -309,21 +309,25 @@ def repository
@repository
||=
Repository
.
new
(
path_with_namespace
,
self
)
@repository
||=
Repository
.
new
(
path_with_namespace
,
self
)
end
end
def
container_registry_path_with_namespace
path_with_namespace
.
downcase
end
def
container_registry_repository
def
container_registry_repository
return
unless
Gitlab
.
config
.
registry
.
enabled
return
unless
Gitlab
.
config
.
registry
.
enabled
@container_registry_repository
||=
begin
@container_registry_repository
||=
begin
token
=
Auth
::
ContainerRegistryAuthenticationService
.
full_access_token
(
path_with_namespace
.
downcase
)
token
=
Auth
::
ContainerRegistryAuthenticationService
.
full_access_token
(
container_registry_
path_with_namespace
)
url
=
Gitlab
.
config
.
registry
.
api_url
url
=
Gitlab
.
config
.
registry
.
api_url
host_port
=
Gitlab
.
config
.
registry
.
host_port
host_port
=
Gitlab
.
config
.
registry
.
host_port
registry
=
ContainerRegistry
::
Registry
.
new
(
url
,
token:
token
,
path:
host_port
)
registry
=
ContainerRegistry
::
Registry
.
new
(
url
,
token:
token
,
path:
host_port
)
registry
.
repository
(
path_with_namespace
.
downcase
)
registry
.
repository
(
container_registry_
path_with_namespace
)
end
end
end
end
def
container_registry_repository_url
def
container_registry_repository_url
if
Gitlab
.
config
.
registry
.
enabled
if
Gitlab
.
config
.
registry
.
enabled
"
#{
Gitlab
.
config
.
registry
.
host_port
}
/
#{
path_with_namespace
.
downcase
}
"
"
#{
Gitlab
.
config
.
registry
.
host_port
}
/
#{
container_registry_
path_with_namespace
}
"
end
end
end
end
...
...
spec/models/project_spec.rb
Просмотр файла @
77cb8ec4
...
@@ -784,6 +784,15 @@
...
@@ -784,6 +784,15 @@
end
end
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
describe
'#container_registry_repository'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
...
@@ -792,13 +801,6 @@
...
@@ -792,13 +801,6 @@
subject
{
project
.
container_registry_repository
}
subject
{
project
.
container_registry_repository
}
it
{
is_expected
.
not_to
be_nil
}
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
end
describe
'#container_registry_repository_url'
do
describe
'#container_registry_repository_url'
do
...
@@ -817,13 +819,6 @@
...
@@ -817,13 +819,6 @@
end
end
it
{
is_expected
.
not_to
be_nil
}
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
end
context
'for disabled registry'
do
context
'for disabled registry'
do
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать