class DockerRegistry
Public Class Methods
new(registry_url)
click to toggle source
# File lib/support/docker_registry.rb, line 5 def initialize(registry_url) @server = registry_url if (!registry_url.include? "://") registry_url = "https://#{registry_url}" end @connection = connection(registry_url) end
Public Instance Methods
find_images()
click to toggle source
# File lib/support/docker_registry.rb, line 13 def find_images() response = @connection.get "/v2/_catalog" raise "catalog retrieval return error: #{response.status} #{response.body}" if (response.status != 200) json = JSON.parse(response.body) return json['repositories'] end
has_image_with_version?(image, commit_id)
click to toggle source
# File lib/support/docker_registry.rb, line 27 def has_image_with_version?(image, commit_id) tags = self.find_tags(image) if (tags != nil) tags.each do |tag| return true if (tag == commit_id) end end return false end
images_and_versions()
click to toggle source
# File lib/support/docker_registry.rb, line 37 def images_and_versions hash = {} images = find_images() images.each do |image| tags = find_tags(image) hash[image] = tags end return hash end
Private Instance Methods
connection(address)
click to toggle source
# File lib/support/docker_registry.rb, line 49 def connection(address) if (!@service_connection) @service_connection = Faraday.new address, :ssl => {:verify => false} end return @service_connection end