Use new available_images routes from DCP

This commit is contained in:
Sebastian Serth
2021-10-29 22:32:15 +02:00
parent 2551ea709b
commit b13a3b084d

View File

@ -88,10 +88,16 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy
end end
def self.available_images def self.available_images
DockerClient.check_availability! url = "#{config[:pool][:location]}/docker_container_pool/available_images"
DockerClient.image_tags response = Faraday.get(url)
rescue DockerClient::Error => e json = JSON.parse(response.body)
raise Runner::Error::InternalServerError.new(e.message) return json if response.success?
raise Runner::Error::InternalServerError.new("DockerContainerPool returned: #{json['error']}")
rescue Faraday::Error => e
raise Runner::Error::FaradayError.new("Request to DockerContainerPool failed: #{e.inspect}")
rescue JSON::ParserError => e
raise Runner::Error::UnexpectedResponse.new("DockerContainerPool returned invalid JSON: #{e.inspect}")
end end
def self.config def self.config