From 284dc3285a4ec2a626e90b16ca3d372eed82d349 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Sat, 14 May 2016 14:22:10 -0500 Subject: [PATCH] Fix abilities --- app/models/ability.rb | 2 +- app/models/project.rb | 10 +++++----- app/views/projects/container_registry/index.html.haml | 2 +- spec/requests/ci/api/runners_spec.rb | 1 - 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 09dea54689e..74321240468 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -292,7 +292,7 @@ class Ability rules += named_abilities('build') end - unless project.container_registry_enabled && Gitlab.config.registry.enabled + unless project.container_registry_enabled rules += named_abilities('container_registry') end diff --git a/app/models/project.rb b/app/models/project.rb index 0206ccc8d37..ed7719ed31c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -332,20 +332,20 @@ class Project < ActiveRecord::Base @container_registry_repository ||= begin token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace) url = Gitlab.config.registry.api_url - host_port = Gitlab.config.registry.host_port - registry = ContainerRegistry::Registry.new(url, token: token, path: host_port) + host = Gitlab.config.registry.host + registry = ContainerRegistry::Registry.new(url, token: token, path: host) registry[path_with_namespace] end end def container_registry_repository_url - if container_registry_enabled? && Gitlab.config.registry.enabled - "#{Gitlab.config.registry.host_port}/#{path_with_namespace}" + if Gitlab.config.registry.enabled + "#{Gitlab.config.registry.host}/#{path_with_namespace}" end end def has_container_registry_tags? - if container_registry_enabled? && Gitlab.config.registry.enabled + if Gitlab.config.registry.enabled container_registry_repository.tags.any? end end diff --git a/app/views/projects/container_registry/index.html.haml b/app/views/projects/container_registry/index.html.haml index ea7c4faaaec..990253719bf 100644 --- a/app/views/projects/container_registry/index.html.haml +++ b/app/views/projects/container_registry/index.html.haml @@ -16,7 +16,7 @@ To start using container images hosted on GitLab you first need to login: %pre %code - docker login #{Gitlab.config.registry.host_port} + docker login #{Gitlab.config.registry.host} %br Then you are free to create and upload a container image with build and push commands: %pre diff --git a/spec/requests/ci/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb index db8189ffb79..43f9fe89c8e 100644 --- a/spec/requests/ci/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -7,7 +7,6 @@ describe Ci::API::API do let(:registration_token) { 'abcdefg123456' } before do - stub_gitlab_calls stub_application_setting(runners_registration_token: registration_token) end