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

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

Direct Known Subclasses

Preprod, Production, Release, StagingRef

Defined Under Namespace

Classes: Version

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.addressObject



51
52
53
# File 'lib/gitlab/qa/component/staging.rb', line 51

def self.address
  self::ADDRESS
end

.imageObject



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
48
49
# File 'lib/gitlab/qa/component/staging.rb', line 22

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



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

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



55
56
57
# File 'lib/gitlab/qa/component/staging.rb', line 55

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