Fix abilities

This commit is contained in:
Kamil Trzcinski 2016-05-14 14:22:10 -05:00
parent ee725db8e0
commit 284dc3285a
4 changed files with 7 additions and 8 deletions

View file

@ -292,7 +292,7 @@ class Ability
rules += named_abilities('build') rules += named_abilities('build')
end end
unless project.container_registry_enabled && Gitlab.config.registry.enabled unless project.container_registry_enabled
rules += named_abilities('container_registry') rules += named_abilities('container_registry')
end end

View file

@ -332,20 +332,20 @@ class Project < ActiveRecord::Base
@container_registry_repository ||= begin @container_registry_repository ||= begin
token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace) token = Auth::ContainerRegistryAuthenticationService.full_access_token(path_with_namespace)
url = Gitlab.config.registry.api_url url = Gitlab.config.registry.api_url
host_port = Gitlab.config.registry.host_port host = Gitlab.config.registry.host
registry = ContainerRegistry::Registry.new(url, token: token, path: host_port) registry = ContainerRegistry::Registry.new(url, token: token, path: host)
registry[path_with_namespace] registry[path_with_namespace]
end end
end end
def container_registry_repository_url def container_registry_repository_url
if container_registry_enabled? && Gitlab.config.registry.enabled if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{path_with_namespace}" "#{Gitlab.config.registry.host}/#{path_with_namespace}"
end end
end end
def has_container_registry_tags? def has_container_registry_tags?
if container_registry_enabled? && Gitlab.config.registry.enabled if Gitlab.config.registry.enabled
container_registry_repository.tags.any? container_registry_repository.tags.any?
end end
end end

View file

@ -16,7 +16,7 @@
To start using container images hosted on GitLab you first need to login: To start using container images hosted on GitLab you first need to login:
%pre %pre
%code %code
docker login #{Gitlab.config.registry.host_port} docker login #{Gitlab.config.registry.host}
%br %br
Then you are free to create and upload a container image with build and push commands: Then you are free to create and upload a container image with build and push commands:
%pre %pre

View file

@ -7,7 +7,6 @@ describe Ci::API::API do
let(:registration_token) { 'abcdefg123456' } let(:registration_token) { 'abcdefg123456' }
before do before do
stub_gitlab_calls
stub_application_setting(runners_registration_token: registration_token) stub_application_setting(runners_registration_token: registration_token)
end end