diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-23 16:00:41 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-23 16:00:41 +0300 |
commit | 01d159b409d8b24d36204979a73de249843d71bf (patch) | |
tree | 8450df71c27dd6ebf1c48d779273502ac8fb4d15 | |
parent | bd8c8df6ed8dd7321608ce652e23d86ef3bd6899 (diff) |
Rename container image model to container repository
-rw-r--r-- | app/models/container_repository.rb (renamed from app/models/container_image.rb) | 14 | ||||
-rw-r--r-- | app/services/auth/container_registry_authentication_service.rb | 2 | ||||
-rw-r--r-- | db/migrate/20170322013926_create_container_repository.rb (renamed from db/migrate/20170322013926_create_container_image.rb) | 5 | ||||
-rw-r--r-- | db/schema.rb | 10 |
4 files changed, 14 insertions, 17 deletions
diff --git a/app/models/container_image.rb b/app/models/container_repository.rb index 434302159b0..2e78fc148b4 100644 --- a/app/models/container_image.rb +++ b/app/models/container_repository.rb @@ -1,4 +1,4 @@ -class ContainerImage < ActiveRecord::Base +class ContainerRepository < 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 diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb index 2205b0897e2..3d151c6a357 100644 --- a/app/services/auth/container_registry_authentication_service.rb +++ b/app/services/auth/container_registry_authentication_service.rb @@ -62,7 +62,7 @@ module Auth end def process_repository_access(type, name, actions) - requested_project = ContainerImage.project_from_path(name) + requested_project = ContainerRepository.project_from_path(name) return unless requested_project diff --git a/db/migrate/20170322013926_create_container_image.rb b/db/migrate/20170322013926_create_container_repository.rb index c494f2a56c7..0235fd7e096 100644 --- a/db/migrate/20170322013926_create_container_image.rb +++ b/db/migrate/20170322013926_create_container_repository.rb @@ -1,12 +1,11 @@ -class CreateContainerImage < ActiveRecord::Migration +class CreateContainerRepository < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = false def change - create_table :container_images do |t| + create_table :container_repositories do |t| t.integer :project_id - t.string :name t.string :path end end diff --git a/db/schema.rb b/db/schema.rb index b5bd6fc3121..be7604a14d5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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_images", force: :cascade do |t| + create_table "container_repositories", 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 |