Class: Gitlab::QA::Support::DevEEQAImage

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/support/dev_ee_qa_image.rb

Constant Summary collapse

DEV_ADDRESS =
'https://dev.gitlab.org'
GITLAB_EE_QA_REPOSITORY_ID =
55
QAImageNotFoundError =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDevEEQAImage

Returns a new instance of DevEEQAImage.



16
17
18
19
20
# File 'lib/gitlab/qa/support/dev_ee_qa_image.rb', line 16

def initialize
  @base_url = "#{DEV_ADDRESS}/api/v4/projects/gitlab%2Fomnibus-gitlab/registry/repositories/#{GITLAB_EE_QA_REPOSITORY_ID}/tags?per_page=100"

  Runtime::Env.require_qa_dev_access_token!
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



10
11
12
# File 'lib/gitlab/qa/support/dev_ee_qa_image.rb', line 10

def base_url
  @base_url
end

Instance Method Details

#retrieve_image_from_container_registry!(revision) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gitlab/qa/support/dev_ee_qa_image.rb', line 22

def retrieve_image_from_container_registry!(revision)
  request_url = base_url

  begin
    response = api_get!(URI.parse(request_url))
    tags = JSON.parse(response.body)

    matching_qa_image_tag = find_matching_qa_image_tag(tags, revision)
    return matching_qa_image_tag['location'] if matching_qa_image_tag

    request_url = next_page_url_from_response(response)
  end while request_url

  raise QAImageNotFoundError, "No `gitlab-ee-qa` image could be found for the revision `#{revision}`."
end