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: InvalidResponseError, Version

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.addressObject



32
33
34
# File 'lib/gitlab/qa/component/staging.rb', line 32

def self.address
  self::ADDRESS
end

.releaseObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gitlab/qa/component/staging.rb', line 10

def self.release
  # 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
  version = Version.new(address).major_minor_revision
  image =
    if Runtime::Env.dev_access_token_variable
      "dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ee:#{version}"
    else
      "ee:#{version}"
    end

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