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

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

Direct Known Subclasses

Preprod, Production, Release

Defined Under Namespace

Classes: Version

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.addressObject



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

def self.address
  self::ADDRESS
end

.imageObject



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

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
    #
    # For official builds (currently deployed on preprod) we use the version
    # string e.g. '12.5.4-ee' for tag matching
    Support::DevEEQAImage.new.retrieve_image_from_container_registry!(tag_end)
  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



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

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

.tag_endObject



53
54
55
# File 'lib/gitlab/qa/component/staging.rb', line 53

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