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.



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

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

#tagObject



46
47
48
49
50
51
52
53
# File 'lib/gitlab/qa/release.rb', line 46

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

Instance Method Details

#canonical_imageObject



42
43
44
# File 'lib/gitlab/qa/release.rb', line 42

def canonical_image
  @canonical_image ||= "gitlab/gitlab-#{edition}"
end

#editionObject



24
25
26
27
28
29
30
31
# File 'lib/gitlab/qa/release.rb', line 24

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

#edition_tagObject



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

def edition_tag
  @edition_tag ||= "#{edition}-#{tag}"
end

#imageObject



33
34
35
36
37
38
39
40
# File 'lib/gitlab/qa/release.rb', line 33

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

#previous_stableObject



18
19
20
21
22
# File 'lib/gitlab/qa/release.rb', line 18

def previous_stable
  # The previous stable is always gitlab/gitlab-ce:latest or
  # gitlab/gitlab-ee:latest
  self.class.new("#{canonical_image}:latest")
end

#to_sObject



14
15
16
# File 'lib/gitlab/qa/release.rb', line 14

def to_s
  "#{image}:#{tag}"
end