Class: Gitlab::QA::Component::Staging

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/component/staging.rb

Direct Known Subclasses

Preprod, Production

Defined Under Namespace

Classes: Version

Constant Summary collapse

ADDRESS =
'https://staging.gitlab.com'.freeze

Class Method Summary collapse

Class Method Details

.addressObject



45
46
47
# File 'lib/gitlab/qa/component/staging.rb', line 45

def self.address
  self::ADDRESS
end

.imageObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gitlab/qa/component/staging.rb', line 19

def self.image
  if Runtime::Env.dev_access_token_variable
    # Auto-deploy builds have a tag formatted like 12.1.12345+5159f2949cb.59c9fa631
    # where `5159f2949cb` is the EE commit SHA. QA images are tagged using
    # the version from the VERSION file and this commit SHA, e.g.
    # `12.0-5159f2949cb` (note that the `major.minor` doesn't necessarily match).
    # To work around that, we're fetching the `revision` from the version API
    # and then find the corresponding QA image in the
    # `dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ee-qa` container
    # registry, based on this revision.
    # See:
    #  - https://gitlab.com/gitlab-org/quality/staging/issues/56
    #  - https://gitlab.com/gitlab-org/release/framework/issues/421
    #  - https://gitlab.com/gitlab-org/gitlab-qa/issues/398
    Support::DevEEQAImage.new.retrieve_image_from_container_registry!(staging_revision)
  else
    # Auto-deploy builds have a tag formatted like 12.0.12345+5159f2949cb.59c9fa631
    # but the version api returns a semver version like 12.0.1
    # so images are tagged using minor and major semver components plus
    # the EE commit ref, which is the 'revision' returned by the API
    # and so the version used for the docker image tag is like 12.0-5159f2949cb
    # See: https://gitlab.com/gitlab-org/quality/staging/issues/56
    "ee:#{Version.new(address).major_minor_revision}"
  end
end

.releaseObject



11
12
13
14
15
16
17
# File 'lib/gitlab/qa/component/staging.rb', line 11

def self.release
  Release.new(image)
rescue Support::InvalidResponseError => ex
  warn ex.message
  warn "#{ex.response.code} #{ex.response.message}: #{ex.response.body}"
  exit 1
end

.staging_revisionObject



49
50
51
# File 'lib/gitlab/qa/component/staging.rb', line 49

def self.staging_revision
  @staging_revision ||= Version.new(address).revision
end