Class: Gitlab::QA::Release
- Inherits:
-
Object
- Object
- Gitlab::QA::Release
- Defined in:
- lib/gitlab/qa/release.rb
Constant Summary collapse
- CANONICAL_REGEX =
/\A(?<edition>ce|ee):?(?<tag>.+)?/i- CUSTOM_GITLAB_IMAGE_REGEX =
%r{/gitlab-(?<edition>[ce]e):(?<tag>.+)\z}- DEFAULT_TAG =
'latest'.freeze
- DEFAULT_CANONICAL_TAG =
'nightly'.freeze
Instance Attribute Summary collapse
-
#release ⇒ Object
readonly
Returns the value of attribute release.
- #tag ⇒ Object
Instance Method Summary collapse
- #edition ⇒ Object
- #ee? ⇒ Boolean
- #image ⇒ Object
-
#initialize(release) ⇒ Release
constructor
A new instance of Release.
- #previous_stable ⇒ Object
- #project_name ⇒ Object
- #qa_image ⇒ Object
- #qa_tag ⇒ Object
- #to_ee ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(release) ⇒ Release
Returns a new instance of Release.
12 13 14 |
# File 'lib/gitlab/qa/release.rb', line 12 def initialize(release) @release = release.to_s.downcase end |
Instance Attribute Details
#release ⇒ Object (readonly)
Returns the value of attribute release.
9 10 11 |
# File 'lib/gitlab/qa/release.rb', line 9 def release @release end |
#tag ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/gitlab/qa/release.rb', line 62 def tag @tag ||= if canonical? release.match(CANONICAL_REGEX)[:tag] || DEFAULT_CANONICAL_TAG else release.match(CUSTOM_GITLAB_IMAGE_REGEX)&.[](:tag) || DEFAULT_TAG end end |
Instance Method Details
#edition ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/gitlab/qa/release.rb', line 26 def edition @edition ||= if canonical? release.match(CANONICAL_REGEX)[:edition].to_sym else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:edition].to_sym end end |
#ee? ⇒ Boolean
35 36 37 |
# File 'lib/gitlab/qa/release.rb', line 35 def ee? edition == :ee end |
#image ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/gitlab/qa/release.rb', line 45 def image @image ||= if canonical? "gitlab/gitlab-#{edition}" else release.sub(/:.+\z/, '') end end |
#previous_stable ⇒ Object
20 21 22 23 24 |
# File 'lib/gitlab/qa/release.rb', line 20 def previous_stable # The previous stable is always gitlab/gitlab-ce:latest or # gitlab/gitlab-ee:latest self.class.new("#{canonical_image}:latest") end |
#project_name ⇒ Object
58 59 60 |
# File 'lib/gitlab/qa/release.rb', line 58 def project_name @project_name ||= image.sub(%r{^gitlab\/}, '') end |
#qa_image ⇒ Object
54 55 56 |
# File 'lib/gitlab/qa/release.rb', line 54 def qa_image "#{image}-qa" end |
#qa_tag ⇒ Object
71 72 73 |
# File 'lib/gitlab/qa/release.rb', line 71 def qa_tag tag.sub(/\.([ce]e)/, '-\1').sub(/\.(\d+)\z/, '') end |
#to_ee ⇒ Object
39 40 41 42 43 |
# File 'lib/gitlab/qa/release.rb', line 39 def to_ee return self if ee? self.class.new(to_s.sub('ce:', 'ee:')) end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/gitlab/qa/release.rb', line 16 def to_s "#{image}:#{tag}" end |