class Gitlab::QA::Release
Constants
- CANONICAL_REGEX
- COM_REGISTRY
- CUSTOM_GITLAB_IMAGE_REGEX
- DEFAULT_CANONICAL_TAG
- DEFAULT_TAG
- DEV_OFFICIAL_TAG_REGEX
Official dev tag example:
12.5.4(-rc42)-ee
|————-|–|
| | | | | | | edition
version
- DEV_REGISTRY
- DEV_TAG_REGEX
Dev tag example:
12.1.201906121026-325a6632895.b340d0bd35d
|—-|————|———–|———–|
| | | | | | | omnibus-ref | | gitlab-ee ref | timestamp
version
- InvalidImageNameError
Attributes
release[R]
tag[W]
Public Class Methods
new(release)
click to toggle source
# File lib/gitlab/qa/release.rb, line 62 def initialize(release) @release = release.to_s.downcase raise InvalidImageNameError, "The release image name '#{@release}' does not have the expected format." unless valid? end
Public Instance Methods
api_project_name()
click to toggle source
# File lib/gitlab/qa/release.rb, line 179 def api_project_name project_name.gsub('ce', 'foss').gsub('-ee', '') end
dev_gitlab_org?()
click to toggle source
# File lib/gitlab/qa/release.rb, line 167 def dev_gitlab_org? image.start_with?(DEV_REGISTRY) end
edition()
click to toggle source
# File lib/gitlab/qa/release.rb, line 78 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?()
click to toggle source
# File lib/gitlab/qa/release.rb, line 87 def ee? edition == :ee end
image()
click to toggle source
# File lib/gitlab/qa/release.rb, line 97 def image @image ||= if canonical? "gitlab/gitlab-#{edition}" else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:image_without_tag] end end
login_params()
click to toggle source
# File lib/gitlab/qa/release.rb, line 138 def login_params return if Runtime::Env.skip_pull? if dev_gitlab_org? Runtime::Env.require_qa_dev_access_token! { username: Runtime::Env.gitlab_dev_username, password: Runtime::Env.dev_access_token_variable, registry: DEV_REGISTRY } elsif omnibus_mirror? username, password = if Runtime::Env.ci_job_token && Runtime::Env.ci_pipeline_source == 'pipeline' ['gitlab-ci-token', Runtime::Env.ci_job_token] elsif Runtime::Env.qa_container_registry_access_token [Runtime::Env.gitlab_username, Runtime::Env.qa_container_registry_access_token] else Runtime::Env.require_qa_access_token! [Runtime::Env.gitlab_username, Runtime::Env.qa_access_token] end { username: username, password: password, registry: COM_REGISTRY } end end
omnibus_mirror?()
click to toggle source
# File lib/gitlab/qa/release.rb, line 171 def omnibus_mirror? image.start_with?("#{COM_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/") end
previous_stable()
click to toggle source
# File lib/gitlab/qa/release.rb, line 72 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()
click to toggle source
# File lib/gitlab/qa/release.rb, line 110 def project_name @project_name ||= if canonical? "gitlab-#{edition}" else "gitlab-#{release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:edition]}" end end
qa_image()
click to toggle source
# File lib/gitlab/qa/release.rb, line 106 def qa_image "#{image}-qa" end
qa_tag()
click to toggle source
Tag scheme for gitlab-{ce,ee}-qa images is like 11.1.0-rc12-ee
# File lib/gitlab/qa/release.rb, line 130 def qa_tag if dev_gitlab_org? && (match_data = tag.match(DEV_TAG_REGEX)) "#{match_data[:version]}-#{match_data[:gitlab_ref]}" else tag.sub(/[-\.]([ce]e)(\.(\d+))?\z/, '-\1') end end
tag()
click to toggle source
Tag scheme for gitlab-{ce,ee} images is like 11.1.0-rc12.ee.0
# File lib/gitlab/qa/release.rb, line 120 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
to_ee()
click to toggle source
# File lib/gitlab/qa/release.rb, line 91 def to_ee return self if ee? self.class.new(to_s.sub('ce:', 'ee:')) end
to_s()
click to toggle source
# File lib/gitlab/qa/release.rb, line 68 def to_s "#{image}:#{tag}" end
valid?()
click to toggle source
# File lib/gitlab/qa/release.rb, line 175 def valid? canonical? || release.match?(CUSTOM_GITLAB_IMAGE_REGEX) end
Private Instance Methods
canonical?()
click to toggle source
# File lib/gitlab/qa/release.rb, line 185 def canonical? release =~ CANONICAL_REGEX end
canonical_image()
click to toggle source
# File lib/gitlab/qa/release.rb, line 189 def canonical_image @canonical_image ||= "gitlab/gitlab-#{edition}" end