Class: Gitlab::QA::Release

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

Constant Summary collapse

CUSTOM_GITLAB_IMAGE_REGEX =
%r{/gitlab-([ce]e):(.+)\z}
DEFAULT_TAG =
'nightly'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(release) ⇒ Release

Returns a new instance of Release.



9
10
11
# File 'lib/gitlab/qa/release.rb', line 9

def initialize(release)
  @release = release.to_s
end

Instance Attribute Details

#releaseObject (readonly)

Returns the value of attribute release.



7
8
9
# File 'lib/gitlab/qa/release.rb', line 7

def release
  @release
end

Instance Method Details

#editionObject



13
14
15
16
17
18
19
# File 'lib/gitlab/qa/release.rb', line 13

def edition
  if canonical?
    release.downcase.to_sym
  else
    release.match(CUSTOM_GITLAB_IMAGE_REGEX)[1].to_sym
  end
end

#imageObject



21
22
23
24
25
26
27
# File 'lib/gitlab/qa/release.rb', line 21

def image
  if canonical?
    "gitlab/gitlab-#{edition}"
  else
    release.sub(/:.+\z/, '')
  end
end

#tagObject



29
30
31
32
33
34
35
# File 'lib/gitlab/qa/release.rb', line 29

def tag
  if canonical?
    DEFAULT_TAG
  else
    release.match(CUSTOM_GITLAB_IMAGE_REGEX)[2]
  end
end