parent
c5912ecd73
commit
c64d36306c
|
@ -1,4 +1,6 @@
|
|||
class ContainerImage < ActiveRecord::Base
|
||||
include Routable
|
||||
|
||||
belongs_to :project
|
||||
|
||||
delegate :container_registry, :container_registry_allowed_paths,
|
||||
|
@ -17,10 +19,18 @@ class ContainerImage < ActiveRecord::Base
|
|||
client.update_token(token)
|
||||
end
|
||||
|
||||
def path
|
||||
[container_registry.path, name_with_namespace].compact.join('/')
|
||||
def parent
|
||||
project
|
||||
end
|
||||
|
||||
def parent_changed?
|
||||
project_id_changed?
|
||||
end
|
||||
|
||||
# def path
|
||||
# [container_registry.path, name_with_namespace].compact.join('/')
|
||||
# end
|
||||
|
||||
def name_with_namespace
|
||||
[container_registry_path_with_namespace, name].reject(&:blank?).join('/')
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ module Auth
|
|||
# per image authentication.
|
||||
# Removes only last occurence in light
|
||||
# of future nested groups
|
||||
namespace, _ = ContainerImage::split_namespace(name)
|
||||
namespace, a = ContainerImage::split_namespace(name)
|
||||
requested_project = Project.find_by_full_path(namespace)
|
||||
return unless requested_project
|
||||
|
||||
|
|
|
@ -31,5 +31,4 @@
|
|||
- if can?(current_user, :update_container_image, @project)
|
||||
%th
|
||||
|
||||
- image.tags.each do |tag|
|
||||
= render 'tag', tag: tag
|
||||
= render partial: 'tag', collection: image.tags
|
||||
|
|
|
@ -23,5 +23,4 @@
|
|||
.nothing-here-block No container images in Container Registry for this project.
|
||||
|
||||
- else
|
||||
- @images.each do |image|
|
||||
= render 'image', image: image
|
||||
= render partial: 'image', collection: @images
|
||||
|
|
|
@ -11,6 +11,7 @@ class CreateContainerImage < ActiveRecord::Migration
|
|||
create_table :container_images do |t|
|
||||
t.integer :project_id
|
||||
t.string :name
|
||||
t.string :path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -108,7 +108,6 @@ ActiveRecord::Schema.define(version: 20170315194013) do
|
|||
t.string "sidekiq_throttling_queues"
|
||||
t.decimal "sidekiq_throttling_factor"
|
||||
t.boolean "html_emails_enabled", default: true
|
||||
t.string "container_registry_access_token"
|
||||
t.string "plantuml_url"
|
||||
t.boolean "plantuml_enabled"
|
||||
t.integer "terminal_max_session_time", default: 0, null: false
|
||||
|
@ -117,6 +116,7 @@ ActiveRecord::Schema.define(version: 20170315194013) do
|
|||
t.integer "unique_ips_limit_per_user"
|
||||
t.integer "unique_ips_limit_time_window"
|
||||
t.boolean "unique_ips_limit_enabled", default: false, null: false
|
||||
t.string "container_registry_access_token"
|
||||
end
|
||||
|
||||
create_table "audit_events", force: :cascade do |t|
|
||||
|
@ -327,6 +327,7 @@ ActiveRecord::Schema.define(version: 20170315194013) do
|
|||
create_table "container_images", force: :cascade do |t|
|
||||
t.integer "project_id"
|
||||
t.string "name"
|
||||
t.string "path"
|
||||
end
|
||||
|
||||
create_table "deploy_keys_projects", force: :cascade do |t|
|
||||
|
|
|
@ -44,7 +44,7 @@ module API
|
|||
project = Project::find_by_full_path(namespace)
|
||||
|
||||
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?
|
||||
render_api_error!({ error: "Failed to create container image!" }, 400)
|
||||
|
|
Loading…
Reference in New Issue