lib/gitlab/qa/release.rb in gitlab-qa-0.4.0 vs lib/gitlab/qa/release.rb in gitlab-qa-0.5.0
- old
+ new
@@ -1,11 +1,12 @@
module Gitlab
module QA
class Release
CANONICAL_REGEX = /\A(?<edition>ce|ee):?(?<tag>.+)?/i
CUSTOM_GITLAB_IMAGE_REGEX = %r{/gitlab-(?<edition>[ce]e):(?<tag>.+)\z}
- DEFAULT_TAG = 'nightly'.freeze
+ DEFAULT_TAG = 'latest'.freeze
+ DEFAULT_CANONICAL_TAG = 'nightly'.freeze
attr_reader :release
attr_writer :tag
def initialize(release)
@@ -29,28 +30,42 @@
else
release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:edition].to_sym
end
end
+ def ee?
+ edition == :ee
+ end
+
+ def to_ee
+ return self if ee?
+
+ self.class.new(to_s.sub('ce:', 'ee:'))
+ end
+
def image
@image ||=
if canonical?
"gitlab/gitlab-#{edition}"
else
release.sub(/:.+\z/, '')
end
end
+ def qa_image
+ "#{image}-qa"
+ end
+
def project_name
@project_name ||= image.sub(%r{^gitlab\/}, '')
end
def tag
@tag ||=
if canonical?
- release.match(CANONICAL_REGEX)[:tag] || DEFAULT_TAG
+ release.match(CANONICAL_REGEX)[:tag] || DEFAULT_CANONICAL_TAG
else
- release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:tag]
+ release.match(CUSTOM_GITLAB_IMAGE_REGEX)&.[](:tag) || DEFAULT_TAG
end
end
def edition_tag
@edition_tag ||= "#{edition}-#{tag}"