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
Jérome Perrin
gitlab-ce
Commits
5fbeb73a
Commit
5fbeb73a
authored
Apr 10, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method that returns a registry repository location
parent
3d1cade1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
app/models/container_repository.rb
app/models/container_repository.rb
+4
-0
spec/models/container_repository_spec.rb
spec/models/container_repository_spec.rb
+15
-0
No files found.
app/models/container_repository.rb
View file @
5fbeb73a
...
@@ -23,6 +23,10 @@ class ContainerRepository < ActiveRecord::Base
...
@@ -23,6 +23,10 @@ class ContainerRepository < ActiveRecord::Base
@path
||=
[
project
.
full_path
,
name
].
select
(
&
:present?
).
join
(
'/'
)
@path
||=
[
project
.
full_path
,
name
].
select
(
&
:present?
).
join
(
'/'
)
end
end
def
location
File
.
join
(
registry
.
path
,
path
)
end
def
tag
(
tag
)
def
tag
(
tag
)
ContainerRegistry
::
Tag
.
new
(
self
,
tag
)
ContainerRegistry
::
Tag
.
new
(
self
,
tag
)
end
end
...
...
spec/models/container_repository_spec.rb
View file @
5fbeb73a
...
@@ -91,6 +91,21 @@ describe ContainerRepository do
...
@@ -91,6 +91,21 @@ describe ContainerRepository do
end
end
end
end
describe
'#location'
do
context
'when registry is running on a custom port'
do
before
do
stub_container_registry_config
(
enabled:
true
,
api_url:
'http://registry.gitlab:5000'
,
host_port:
'registry.gitlab:5000'
)
end
it
'returns a full location of the repository'
do
expect
(
container_repository
.
location
)
.
to
eq
'registry.gitlab:5000/group/test/my_image'
end
end
end
describe
'#root_repository?'
do
describe
'#root_repository?'
do
context
'when repository is a root repository'
do
context
'when repository is a root repository'
do
let
(
:repository
)
{
create
(
:container_repository
,
:root
)
}
let
(
:repository
)
{
create
(
:container_repository
,
:root
)
}
...
...
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