summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndre Guedes <andrebsguedes@gmail.com>2016-12-16 01:24:05 -0200
committerAndre Guedes <andrebsguedes@gmail.com>2017-02-22 11:30:11 -0300
commite4fa80f3b67f1ef30c262cd4df28516ccff6336a (patch)
tree225b64223d018ca259fcfabd6b725918dfe4d126 /lib
parent246df2bd1151d39a04ef553064144eb75ee3e980 (diff)
downloadgitlab-ce-e4fa80f3b67f1ef30c262cd4df28516ccff6336a.tar.gz
Fixes broken and missing tests
Diffstat (limited to 'lib')
-rw-r--r--lib/api/registry_events.rb4
-rw-r--r--lib/container_registry/blob.rb4
-rw-r--r--lib/container_registry/registry.rb4
-rw-r--r--lib/container_registry/repository.rb48
4 files changed, 3 insertions, 57 deletions
diff --git a/lib/api/registry_events.rb b/lib/api/registry_events.rb
index e52433339eb..12305a49f0f 100644
--- a/lib/api/registry_events.rb
+++ b/lib/api/registry_events.rb
@@ -46,9 +46,7 @@ module API
if project
container_image = project.container_images.find_or_create_by(name: container_image_name)
- if container_image.valid?
- puts('Valid!')
- else
+ unless container_image.valid?
render_api_error!({ error: "Failed to create container image!" }, 400)
end
else
diff --git a/lib/container_registry/blob.rb b/lib/container_registry/blob.rb
index eb5a2596177..8db8e483b1d 100644
--- a/lib/container_registry/blob.rb
+++ b/lib/container_registry/blob.rb
@@ -38,11 +38,11 @@ module ContainerRegistry
end
def delete
- client.delete_blob(repository.name, digest)
+ client.delete_blob(repository.name_with_namespace, digest)
end
def data
- @data ||= client.blob(repository.name, digest, type)
+ @data ||= client.blob(repository.name_with_namespace, digest, type)
end
end
end
diff --git a/lib/container_registry/registry.rb b/lib/container_registry/registry.rb
index 0e634f6b6ef..63bce655f57 100644
--- a/lib/container_registry/registry.rb
+++ b/lib/container_registry/registry.rb
@@ -8,10 +8,6 @@ module ContainerRegistry
@client = ContainerRegistry::Client.new(uri, options)
end
- def repository(name)
- ContainerRegistry::Repository.new(self, name)
- end
-
private
def default_path
diff --git a/lib/container_registry/repository.rb b/lib/container_registry/repository.rb
deleted file mode 100644
index 0e4a7cb3cc9..00000000000
--- a/lib/container_registry/repository.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-module ContainerRegistry
- class Repository
- attr_reader :registry, :name
-
- delegate :client, to: :registry
-
- def initialize(registry, name)
- @registry, @name = registry, name
- end
-
- def path
- [registry.path, name].compact.join('/')
- end
-
- def tag(tag)
- ContainerRegistry::Tag.new(self, tag)
- end
-
- def manifest
- return @manifest if defined?(@manifest)
-
- @manifest = client.repository_tags(name)
- end
-
- def valid?
- manifest.present?
- end
-
- def tags
- return @tags if defined?(@tags)
- return [] unless manifest && manifest['tags']
-
- @tags = manifest['tags'].map do |tag|
- ContainerRegistry::Tag.new(self, tag)
- end
- end
-
- def blob(config)
- ContainerRegistry::Blob.new(self, config)
- end
-
- def delete_tags
- return unless tags
-
- tags.all?(&:delete)
- end
- end
-end