summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 20:29:57 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 20:29:57 +0300
commit0094d8f19644152a66b9d21b8cd86f797199311f (patch)
treee55903e0a444857858c3ecf69427c9b8e0434e3f
parent51a8811e262c48e2d3aaa426b3c87693dda87b37 (diff)
downloadgitlab-ce-0094d8f19644152a66b9d21b8cd86f797199311f.tar.gz
Rename `images` to `container_registry`
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/models/ability.rb12
-rw-r--r--app/models/ci/build.rb1
-rw-r--r--app/models/project.rb8
-rw-r--r--app/views/projects/edit.html.haml8
-rw-r--r--config/gitlab.yml.example1
-rw-r--r--config/initializers/1_settings.rb12
-rw-r--r--db/migrate/20160407120251_add_images_enabled_for_project.rb2
-rw-r--r--db/schema.rb2
-rw-r--r--doc/permissions/permissions.md2
-rw-r--r--lib/api/entities.rb2
-rw-r--r--lib/api/projects.rb10
12 files changed, 35 insertions, 27 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 52f7b993343..f4ec60ad2c7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -235,7 +235,7 @@ class ProjectsController < Projects::ApplicationController
def project_params
params.require(:project).permit(
:name, :path, :description, :issues_tracker, :tag_list, :runners_token,
- :issues_enabled, :merge_requests_enabled, :snippets_enabled, :images_enabled,
+ :issues_enabled, :merge_requests_enabled, :snippets_enabled, :container_registry_enabled,
:issues_tracker_id, :default_branch,
:wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar,
:builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
diff --git a/app/models/ability.rb b/app/models/ability.rb
index ba27b9a9b14..59d5195f5b9 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -203,7 +203,7 @@ class Ability
:admin_label,
:read_commit_status,
:read_build,
- :read_image,
+ :read_container_registry,
]
end
@@ -218,8 +218,8 @@ class Ability
:create_merge_request,
:create_wiki,
:push_code,
- :create_image,
- :update_image,
+ :create_container_registry,
+ :update_container_registry,
]
end
@@ -246,7 +246,7 @@ class Ability
:admin_project,
:admin_commit_status,
:admin_build,
- :admin_image
+ :admin_container_registry,
]
end
@@ -291,6 +291,10 @@ class Ability
rules += named_abilities('build')
end
+ unless project.container_registry_enabled
+ rules += named_abilities('container_registry')
+ end
+
rules
end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 2fea8047147..4bc3a225e2c 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -426,7 +426,6 @@ module Ci
variables << { key: :CI_BUILD_NAME, value: name, public: true }
variables << { key: :CI_BUILD_STAGE, value: stage, public: true }
variables << { key: :CI_BUILD_TRIGGERED, value: 'true', public: true } if trigger_request
- variables << { key: :CI_DOCKER_REGISTRY, value: project.registry_repository_url, public: true } if project.registry_repository_url
variables
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index bce25455373..ab9ee9bad0a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -69,7 +69,7 @@ class Project < ActiveRecord::Base
default_value_for :wiki_enabled, gitlab_config_features.wiki
default_value_for :wall_enabled, false
default_value_for :snippets_enabled, gitlab_config_features.snippets
- default_value_for :images_enabled, gitlab_config_features.images
+ default_value_for :container_registry_enabled, gitlab_config_features.container_registry
default_value_for(:shared_runners_enabled) { current_application_settings.shared_runners_enabled }
# set last_activity_at to the same as created_at
@@ -375,8 +375,10 @@ class Project < ActiveRecord::Base
@repository ||= Repository.new(path_with_namespace, self)
end
- def registry_repository_url
- "#{Gitlab.config.registry.host_with_port}/#{path_with_namespace}" if images_enabled? && Gitlab.config.registry.enabled
+ def container_registry_url
+ if container_registry_enabled? && Gitlab.config.registry.enabled
+ "#{Gitlab.config.registry.host_with_port}/#{path_with_namespace}"
+ end
end
def commit(id = 'HEAD')
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 5c7960031e0..f6a53fddf17 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -88,11 +88,11 @@
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
- = f.label :images_enabled do
- = f.check_box :images_enabled
- %strong Images
+ = f.label :container_registry_enabled do
+ = f.check_box :container_registry_enabled
+ %strong Container Registry
%br
- %span.descr Use Docker Registry for this repository
+ %span.descr Enable Container Registry for this repository
= render 'builds_settings', f: f
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index cbb7c656fe7..f7a58753421 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -98,6 +98,7 @@ production: &base
wiki: true
snippets: false
builds: true
+ container_registry: true
## Webhook settings
# Number of seconds to wait for HTTP response after sending webhook HTTP POST request (default: 10)
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index b94f3f2f901..140d086054a 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -230,12 +230,12 @@ Settings.gitlab['default_projects_features'] ||= {}
Settings.gitlab['webhook_timeout'] ||= 10
Settings.gitlab['max_attachment_size'] ||= 10
Settings.gitlab['session_expire_delay'] ||= 10080
-Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil?
-Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil?
-Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil?
-Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil?
-Settings.gitlab.default_projects_features['builds'] = true if Settings.gitlab.default_projects_features['builds'].nil?
-Settings.gitlab.default_projects_features['images'] = true if Settings.gitlab.default_projects_features['images'].nil?
+Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil?
+Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil?
+Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil?
+Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil?
+Settings.gitlab.default_projects_features['builds'] = true if Settings.gitlab.default_projects_features['builds'].nil?
+Settings.gitlab.default_projects_features['container_registry'] = true if Settings.gitlab.default_projects_features['container_registry'].nil?
Settings.gitlab.default_projects_features['visibility_level'] = Settings.send(:verify_constant, Gitlab::VisibilityLevel, Settings.gitlab.default_projects_features['visibility_level'], Gitlab::VisibilityLevel::PRIVATE)
Settings.gitlab['repository_downloads_path'] = File.join(Settings.shared['path'], 'cache/archive') if Settings.gitlab['repository_downloads_path'].nil?
Settings.gitlab['restricted_signup_domains'] ||= []
diff --git a/db/migrate/20160407120251_add_images_enabled_for_project.rb b/db/migrate/20160407120251_add_images_enabled_for_project.rb
index 6a221a7fb03..47f0ca8e8de 100644
--- a/db/migrate/20160407120251_add_images_enabled_for_project.rb
+++ b/db/migrate/20160407120251_add_images_enabled_for_project.rb
@@ -1,5 +1,5 @@
class AddImagesEnabledForProject < ActiveRecord::Migration
def change
- add_column :projects, :images_enabled, :boolean
+ add_column :projects, :container_registry_enabled, :boolean
end
end
diff --git a/db/schema.rb b/db/schema.rb
index 7ea16e21358..103a18d3621 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -760,7 +760,7 @@ ActiveRecord::Schema.define(version: 20160421130527) do
t.integer "pushes_since_gc", default: 0
t.boolean "last_repository_check_failed"
t.datetime "last_repository_check_at"
- t.boolean "images_enabled"
+ t.boolean "container_registry_enabled"
end
add_index "projects", ["builds_enabled", "shared_runners_enabled"], name: "index_projects_on_builds_enabled_and_shared_runners_enabled", using: :btree
diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md
index 6219693b8a8..6be5ea0b486 100644
--- a/doc/permissions/permissions.md
+++ b/doc/permissions/permissions.md
@@ -27,6 +27,7 @@ documentation](../workflow/add-user/add-user.md).
| Manage issue tracker | | ✓ | ✓ | ✓ | ✓ |
| Manage labels | | ✓ | ✓ | ✓ | ✓ |
| See a commit status | | ✓ | ✓ | ✓ | ✓ |
+| See a container registry | | ✓ | ✓ | ✓ | ✓ |
| Manage merge requests | | | ✓ | ✓ | ✓ |
| Create new merge request | | | ✓ | ✓ | ✓ |
| Create new branches | | | ✓ | ✓ | ✓ |
@@ -37,6 +38,7 @@ documentation](../workflow/add-user/add-user.md).
| Write a wiki | | | ✓ | ✓ | ✓ |
| Cancel and retry builds | | | ✓ | ✓ | ✓ |
| Create or update commit status | | | ✓ | ✓ | ✓ |
+| Update a container registry | | | ✓ | ✓ | ✓ |
| Create new milestones | | | | ✓ | ✓ |
| Add new team members | | | | ✓ | ✓ |
| Push to protected branches | | | | ✓ | ✓ |
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 95c3597b03c..d62575e0a30 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -66,7 +66,7 @@ module API
expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group }
expose :name, :name_with_namespace
expose :path, :path_with_namespace
- expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :builds_enabled, :snippets_enabled, :images_enabled
+ expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :builds_enabled, :snippets_enabled, :container_registry_enabled
expose :created_at, :last_activity_at
expose :shared_runners_enabled
expose :creator_id
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 6f85bc4b1b9..d14b28e17fd 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -94,7 +94,7 @@ module API
# builds_enabled (optional)
# wiki_enabled (optional)
# snippets_enabled (optional)
- # images_enabled (optional)
+ # container_registry_enabled (optional)
# shared_runners_enabled (optional)
# namespace_id (optional) - defaults to user namespace
# public (optional) - if true same as setting visibility_level = 20
@@ -113,7 +113,7 @@ module API
:builds_enabled,
:wiki_enabled,
:snippets_enabled,
- :images_enabled,
+ :container_registry_enabled,
:shared_runners_enabled,
:namespace_id,
:public,
@@ -145,7 +145,7 @@ module API
# builds_enabled (optional)
# wiki_enabled (optional)
# snippets_enabled (optional)
- # images_enabled (optional)
+ # container_registry_enabled (optional)
# shared_runners_enabled (optional)
# public (optional) - if true same as setting visibility_level = 20
# visibility_level (optional)
@@ -209,7 +209,7 @@ module API
# builds_enabled (optional)
# wiki_enabled (optional)
# snippets_enabled (optional)
- # images_enabled (optional)
+ # container_registry_enabled (optional)
# shared_runners_enabled (optional)
# public (optional) - if true same as setting visibility_level = 20
# visibility_level (optional) - visibility level of a project
@@ -226,7 +226,7 @@ module API
:builds_enabled,
:wiki_enabled,
:snippets_enabled,
- :images_enabled,
+ :container_registry_enabled,
:shared_runners_enabled,
:public,
:visibility_level,