summaryrefslogtreecommitdiff
path: root/lib/container_registry
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-28 14:57:22 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-28 14:57:22 +0200
commitbdc1e1b9e005eeaf564b79698d61a801c3c6360f (patch)
tree96403481e21de64c1bb6c575dd349c5ab4f87402 /lib/container_registry
parentb15d9042e2688f29b002f90e0154e793ff1544ff (diff)
downloadgitlab-ce-bdc1e1b9e005eeaf564b79698d61a801c3c6360f.tar.gz
Implement method matching container repository names
Diffstat (limited to 'lib/container_registry')
-rw-r--r--lib/container_registry/path.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/container_registry/path.rb b/lib/container_registry/path.rb
index f32df1bc0d1..89ef396f374 100644
--- a/lib/container_registry/path.rb
+++ b/lib/container_registry/path.rb
@@ -3,6 +3,7 @@ module ContainerRegistry
InvalidRegistryPathError = Class.new(StandardError)
def initialize(name)
+ @name = name
@nodes = name.to_s.split('/')
end
@@ -19,11 +20,18 @@ module ContainerRegistry
end
end
+ def has_repository?
+ # ContainerRepository.find_by_full_path(@name).present?
+ end
+
def repository_project
@project ||= Project.where_full_path_in(components.first(3))&.first
end
def repository_name
+ return unless repository_project
+
+ @name.remove(%r(^?#{Regexp.escape(repository_project.full_path)}/?))
end
end
end