Skip to content
Snippets Groups Projects
Unverified Commit 4817af6c authored by Andrejs Cunskis's avatar Andrejs Cunskis
Browse files

Correctly infer qa-image from development gitlab image

parent e7bfe5e0
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -9,19 +9,19 @@ module Gitlab
(-qa)?
(:(?<tag>.+))?
\z
/xi
/xi.freeze
CUSTOM_GITLAB_IMAGE_REGEX = %r{
\A
(?<image_without_tag>
(?<registry>[^\/:]+(:(?<port>\d+))?)
.+
(?<registry>[^/:]+(:(?<port>\d+))?)
(?<project>.+)
gitlab-
(?<edition>ce|ee)
)
(-qa)?
(:(?<tag>.+))?
\z
}xi
}xi.freeze
 
# Official dev tag example:
# 12.5.4(-rc42)-ee
Loading
Loading
@@ -35,7 +35,7 @@ module Gitlab
\A
(?<version>\d+\.\d+.\d+(?:-rc\d+)?)-(?<edition>ce|ee)
\z
/xi
/xi.freeze
 
# Dev tag example:
# 12.1.201906121026-325a6632895.b340d0bd35d
Loading
Loading
@@ -47,9 +47,9 @@ module Gitlab
# version
DEV_TAG_REGEX = /
\A
(?<version>\d+\.\d+(.\d+)?)\.(?<timestamp>\d+)\-(?<gitlab_ref>[A-Za-z0-9]+)\.(?<omnibus_ref>[A-Za-z0-9]+)
(?<version>\d+\.\d+(.\d+)?)\.(?<timestamp>\d+)-(?<gitlab_ref>[A-Za-z0-9]+)\.(?<omnibus_ref>[A-Za-z0-9]+)
\z
/xi
/xi.freeze
 
DEFAULT_TAG = 'latest'
DEFAULT_CANONICAL_TAG = 'nightly'
Loading
Loading
@@ -63,8 +63,9 @@ module Gitlab
 
def initialize(release)
@release = release.to_s.downcase
return if valid?
 
raise InvalidImageNameError, "The release image name '#{@release}' does not have the expected format." unless valid?
raise InvalidImageNameError, "The release image name '#{@release}' does not have the expected format."
end
 
def to_s
Loading
Loading
@@ -106,7 +107,14 @@ module Gitlab
end
 
def qa_image
"#{image}-qa"
@qa_image ||= if omnibus_mirror?
omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project]
gitlab_project = "/gitlab-org/gitlab/"
"#{image.gsub(omnibus_project, gitlab_project)}-qa"
else
"#{image}-qa"
end
end
 
def project_name
Loading
Loading
@@ -133,7 +141,7 @@ module Gitlab
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')
tag.sub(/[-.]([ce]e)(\.(\d+))?\z/, '-\1')
end
end
 
Loading
Loading
@@ -158,6 +166,7 @@ module Gitlab
 
[Runtime::Env.gitlab_username, Runtime::Env.qa_access_token]
end
{
username: username,
password: password,
Loading
Loading
Loading
Loading
@@ -743,6 +743,7 @@ describe Gitlab::QA::Release do
subject { described_class.new(omnibus_mirror_image) }
 
it { expect(subject.omnibus_mirror?).to be true }
it { expect(subject.qa_image).to eq("registry.gitlab.com/gitlab-org/gitlab/gitlab-ee-qa") }
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment