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
c64d3630
Commit
c64d3630
authored
Mar 21, 2017
by
Andre Guedes
Committed by
Grzegorz Bizon
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes ContainerImages Routable
Conflicts: db/schema.rb
parent
c5912ecd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
9 deletions
+19
-9
app/models/container_image.rb
app/models/container_image.rb
+12
-2
app/services/auth/container_registry_authentication_service.rb
...ervices/auth/container_registry_authentication_service.rb
+1
-1
app/views/projects/container_registry/_image.html.haml
app/views/projects/container_registry/_image.html.haml
+1
-2
app/views/projects/container_registry/index.html.haml
app/views/projects/container_registry/index.html.haml
+1
-2
db/migrate/20161031013926_create_container_image.rb
db/migrate/20161031013926_create_container_image.rb
+1
-0
db/schema.rb
db/schema.rb
+2
-1
lib/api/registry_events.rb
lib/api/registry_events.rb
+1
-1
No files found.
app/models/container_image.rb
View file @
c64d3630
class
ContainerImage
<
ActiveRecord
::
Base
class
ContainerImage
<
ActiveRecord
::
Base
include
Routable
belongs_to
:project
belongs_to
:project
delegate
:container_registry
,
:container_registry_allowed_paths
,
delegate
:container_registry
,
:container_registry_allowed_paths
,
...
@@ -17,10 +19,18 @@ class ContainerImage < ActiveRecord::Base
...
@@ -17,10 +19,18 @@ class ContainerImage < ActiveRecord::Base
client
.
update_token
(
token
)
client
.
update_token
(
token
)
end
end
def
path
def
parent
[
container_registry
.
path
,
name_with_namespace
].
compact
.
join
(
'/'
)
project
end
def
parent_changed?
project_id_changed?
end
end
# def path
# [container_registry.path, name_with_namespace].compact.join('/')
# end
def
name_with_namespace
def
name_with_namespace
[
container_registry_path_with_namespace
,
name
].
reject
(
&
:blank?
).
join
(
'/'
)
[
container_registry_path_with_namespace
,
name
].
reject
(
&
:blank?
).
join
(
'/'
)
end
end
...
...
app/services/auth/container_registry_authentication_service.rb
View file @
c64d3630
...
@@ -66,7 +66,7 @@ module Auth
...
@@ -66,7 +66,7 @@ module Auth
# per image authentication.
# per image authentication.
# Removes only last occurence in light
# Removes only last occurence in light
# of future nested groups
# of future nested groups
namespace
,
_
=
ContainerImage
::
split_namespace
(
name
)
namespace
,
a
=
ContainerImage
::
split_namespace
(
name
)
requested_project
=
Project
.
find_by_full_path
(
namespace
)
requested_project
=
Project
.
find_by_full_path
(
namespace
)
return
unless
requested_project
return
unless
requested_project
...
...
app/views/projects/container_registry/_image.html.haml
View file @
c64d3630
...
@@ -31,5 +31,4 @@
...
@@ -31,5 +31,4 @@
-
if
can?
(
current_user
,
:update_container_image
,
@project
)
-
if
can?
(
current_user
,
:update_container_image
,
@project
)
%th
%th
-
image
.
tags
.
each
do
|
tag
|
=
render
partial:
'tag'
,
collection:
image
.
tags
=
render
'tag'
,
tag:
tag
app/views/projects/container_registry/index.html.haml
View file @
c64d3630
...
@@ -23,5 +23,4 @@
...
@@ -23,5 +23,4 @@
.nothing-here-block
No container images in Container Registry for this project.
.nothing-here-block
No container images in Container Registry for this project.
-
else
-
else
-
@images
.
each
do
|
image
|
=
render
partial:
'image'
,
collection:
@images
=
render
'image'
,
image:
image
db/migrate/20161031013926_create_container_image.rb
View file @
c64d3630
...
@@ -11,6 +11,7 @@ class CreateContainerImage < ActiveRecord::Migration
...
@@ -11,6 +11,7 @@ class CreateContainerImage < ActiveRecord::Migration
create_table
:container_images
do
|
t
|
create_table
:container_images
do
|
t
|
t
.
integer
:project_id
t
.
integer
:project_id
t
.
string
:name
t
.
string
:name
t
.
string
:path
end
end
end
end
end
end
db/schema.rb
View file @
c64d3630
...
@@ -108,7 +108,6 @@ ActiveRecord::Schema.define(version: 20170315194013) do
...
@@ -108,7 +108,6 @@ ActiveRecord::Schema.define(version: 20170315194013) do
t
.
string
"sidekiq_throttling_queues"
t
.
string
"sidekiq_throttling_queues"
t
.
decimal
"sidekiq_throttling_factor"
t
.
decimal
"sidekiq_throttling_factor"
t
.
boolean
"html_emails_enabled"
,
default:
true
t
.
boolean
"html_emails_enabled"
,
default:
true
t
.
string
"container_registry_access_token"
t
.
string
"plantuml_url"
t
.
string
"plantuml_url"
t
.
boolean
"plantuml_enabled"
t
.
boolean
"plantuml_enabled"
t
.
integer
"terminal_max_session_time"
,
default:
0
,
null:
false
t
.
integer
"terminal_max_session_time"
,
default:
0
,
null:
false
...
@@ -117,6 +116,7 @@ ActiveRecord::Schema.define(version: 20170315194013) do
...
@@ -117,6 +116,7 @@ ActiveRecord::Schema.define(version: 20170315194013) do
t
.
integer
"unique_ips_limit_per_user"
t
.
integer
"unique_ips_limit_per_user"
t
.
integer
"unique_ips_limit_time_window"
t
.
integer
"unique_ips_limit_time_window"
t
.
boolean
"unique_ips_limit_enabled"
,
default:
false
,
null:
false
t
.
boolean
"unique_ips_limit_enabled"
,
default:
false
,
null:
false
t
.
string
"container_registry_access_token"
end
end
create_table
"audit_events"
,
force: :cascade
do
|
t
|
create_table
"audit_events"
,
force: :cascade
do
|
t
|
...
@@ -327,6 +327,7 @@ ActiveRecord::Schema.define(version: 20170315194013) do
...
@@ -327,6 +327,7 @@ ActiveRecord::Schema.define(version: 20170315194013) do
create_table
"container_images"
,
force: :cascade
do
|
t
|
create_table
"container_images"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
integer
"project_id"
t
.
string
"name"
t
.
string
"name"
t
.
string
"path"
end
end
create_table
"deploy_keys_projects"
,
force: :cascade
do
|
t
|
create_table
"deploy_keys_projects"
,
force: :cascade
do
|
t
|
...
...
lib/api/registry_events.rb
View file @
c64d3630
...
@@ -44,7 +44,7 @@ module API
...
@@ -44,7 +44,7 @@ module API
project
=
Project
::
find_by_full_path
(
namespace
)
project
=
Project
::
find_by_full_path
(
namespace
)
if
project
if
project
container_image
=
project
.
container_images
.
find_or_create_by
(
name:
container_image_name
)
container_image
=
project
.
container_images
.
find_or_create_by
(
name:
container_image_name
,
path:
container_image_name
)
unless
container_image
.
valid?
unless
container_image
.
valid?
render_api_error!
({
error:
"Failed to create container image!"
},
400
)
render_api_error!
({
error:
"Failed to create container image!"
},
400
)
...
...
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