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
01d159b4
Commit
01d159b4
authored
Mar 23, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename container image model to container repository
parent
bd8c8df6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
17 deletions
+14
-17
app/models/container_repository.rb
app/models/container_repository.rb
+7
-7
app/services/auth/container_registry_authentication_service.rb
...ervices/auth/container_registry_authentication_service.rb
+1
-1
db/migrate/20170322013926_create_container_repository.rb
db/migrate/20170322013926_create_container_repository.rb
+2
-3
db/schema.rb
db/schema.rb
+4
-6
No files found.
app/models/container_
image
.rb
→
app/models/container_
repository
.rb
View file @
01d159b4
class
Container
Image
<
ActiveRecord
::
Base
class
Container
Repository
<
ActiveRecord
::
Base
belongs_to
:project
delegate
:container_registry
,
to: :project
...
...
@@ -18,7 +18,7 @@ class ContainerImage < ActiveRecord::Base
end
def
manifest
@manifest
||=
client
.
repository_tags
(
name_with_namespace
)
@manifest
||=
client
.
repository_tags
(
self
.
path
)
end
def
tags
...
...
@@ -39,24 +39,24 @@ class ContainerImage < ActiveRecord::Base
digests
=
tags
.
map
{
|
tag
|
tag
.
digest
}.
to_set
digests
.
all?
do
|
digest
|
client
.
delete_repository_tag
(
name_with_namespace
,
digest
)
client
.
delete_repository_tag
(
self
.
path
,
digest
)
end
end
def
self
.
project_from_path
(
image
_path
)
return
unless
image
_path
.
include?
(
'/'
)
def
self
.
project_from_path
(
repository
_path
)
return
unless
repository
_path
.
include?
(
'/'
)
##
# Projects are always located inside a namespace, so we can remove
# the last node, and see if project with that path exists.
#
truncated_path
=
image_path
.
slice
(
0
...
image
_path
.
rindex
(
'/'
))
truncated_path
=
repository_path
.
slice
(
0
...
repository
_path
.
rindex
(
'/'
))
##
# We still make it possible to search projects by a full image path
# in order to maintain backwards compatibility.
#
Project
.
find_by_full_path
(
truncated_path
)
||
Project
.
find_by_full_path
(
image
_path
)
Project
.
find_by_full_path
(
repository
_path
)
end
end
app/services/auth/container_registry_authentication_service.rb
View file @
01d159b4
...
...
@@ -62,7 +62,7 @@ module Auth
end
def
process_repository_access
(
type
,
name
,
actions
)
requested_project
=
Container
Image
.
project_from_path
(
name
)
requested_project
=
Container
Repository
.
project_from_path
(
name
)
return
unless
requested_project
...
...
db/migrate/20170322013926_create_container_
image
.rb
→
db/migrate/20170322013926_create_container_
repository
.rb
View file @
01d159b4
class
CreateContainer
Image
<
ActiveRecord
::
Migration
class
CreateContainer
Repository
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
create_table
:container_
imag
es
do
|
t
|
create_table
:container_
repositori
es
do
|
t
|
t
.
integer
:project_id
t
.
string
:name
t
.
string
:path
end
end
...
...
db/schema.rb
View file @
01d159b4
...
...
@@ -61,7 +61,6 @@ ActiveRecord::Schema.define(version: 20170322013926) do
t
.
boolean
"shared_runners_enabled"
,
default:
true
,
null:
false
t
.
integer
"max_artifacts_size"
,
default:
100
,
null:
false
t
.
string
"runners_registration_token"
t
.
integer
"max_pages_size"
,
default:
100
,
null:
false
t
.
boolean
"require_two_factor_authentication"
,
default:
false
t
.
integer
"two_factor_grace_period"
,
default:
48
t
.
boolean
"metrics_enabled"
,
default:
false
...
...
@@ -111,6 +110,7 @@ ActiveRecord::Schema.define(version: 20170322013926) do
t
.
string
"plantuml_url"
t
.
boolean
"plantuml_enabled"
t
.
integer
"terminal_max_session_time"
,
default:
0
,
null:
false
t
.
integer
"max_pages_size"
,
default:
100
,
null:
false
t
.
string
"default_artifacts_expire_in"
,
default:
"0"
,
null:
false
t
.
integer
"unique_ips_limit_per_user"
t
.
integer
"unique_ips_limit_time_window"
...
...
@@ -322,9 +322,8 @@ ActiveRecord::Schema.define(version: 20170322013926) do
add_index
"ci_variables"
,
[
"project_id"
],
name:
"index_ci_variables_on_project_id"
,
using: :btree
create_table
"container_
imag
es"
,
force: :cascade
do
|
t
|
create_table
"container_
repositori
es"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
string
"name"
t
.
string
"path"
end
...
...
@@ -694,8 +693,8 @@ ActiveRecord::Schema.define(version: 20170322013926) do
t
.
integer
"visibility_level"
,
default:
20
,
null:
false
t
.
boolean
"request_access_enabled"
,
default:
false
,
null:
false
t
.
datetime
"deleted_at"
t
.
text
"description_html"
t
.
boolean
"lfs_enabled"
t
.
text
"description_html"
t
.
integer
"parent_id"
end
...
...
@@ -991,7 +990,6 @@ ActiveRecord::Schema.define(version: 20170322013926) do
end
add_index
"routes"
,
[
"path"
],
name:
"index_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"routes"
,
[
"path"
],
name:
"index_routes_on_path_text_pattern_ops"
,
using: :btree
,
opclasses:
{
"path"
=>
"varchar_pattern_ops"
}
add_index
"routes"
,
[
"source_type"
,
"source_id"
],
name:
"index_routes_on_source_type_and_source_id"
,
unique:
true
,
using: :btree
create_table
"sent_notifications"
,
force: :cascade
do
|
t
|
...
...
@@ -1238,8 +1236,8 @@ ActiveRecord::Schema.define(version: 20170322013926) do
t
.
datetime
"otp_grace_period_started_at"
t
.
boolean
"ldap_email"
,
default:
false
,
null:
false
t
.
boolean
"external"
,
default:
false
t
.
string
"incoming_email_token"
t
.
string
"organization"
t
.
string
"incoming_email_token"
t
.
boolean
"authorized_projects_populated"
t
.
boolean
"ghost"
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