From c05ba25e4c8670e87663a87bafdb82e1aab0f131 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Thu, 14 Nov 2024 10:10:39 +1300 Subject: [PATCH 01/31] Added custom param Adding custom parameters for custom registry: Changelog: added --- lib/gitlab/qa/release.rb | 10 ++++++++++ lib/gitlab/qa/runtime/env.rb | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 027dbf10..800d400f 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -59,6 +59,7 @@ module Gitlab DEFAULT_CANONICAL_TAG = 'nightly' DEV_REGISTRY = Gitlab::QA::Runtime::Env.qa_dev_registry COM_REGISTRY = Gitlab::QA::Runtime::Env.qa_com_registry + CUSTOM_REGISTRY = Gitlab::QA::Runtime::Env.qa_custom_registry InvalidImageNameError = Class.new(RuntimeError) @@ -153,6 +154,7 @@ module Gitlab return if Runtime::Env.skip_pull? params = if dev_gitlab_org? + puts "%%%%%%%%%%% inside if" Runtime::Env.require_qa_dev_access_token! { @@ -161,7 +163,15 @@ module Gitlab registry: DEV_REGISTRY } elsif omnibus_mirror? || omnibus_security? + puts "%%%%%%%%%%% inside elseif" omnibus_login_params + else + puts "%%%%%%%%%%% inside else" + { + username: Runtime::Env.gitlab_custom_username, + password: Runtime::Env.gitlab_custom_username_token, + registry: CUSTOM_REGISTRY + } end populate_registry_env_vars(params) diff --git a/lib/gitlab/qa/runtime/env.rb b/lib/gitlab/qa/runtime/env.rb index 0bcaed00..92755824 100644 --- a/lib/gitlab/qa/runtime/env.rb +++ b/lib/gitlab/qa/runtime/env.rb @@ -219,6 +219,14 @@ module Gitlab env_var_value_if_defined('GITLAB_DEV_USERNAME') || 'gitlab-qa-bot' end + def gitlab_custom_username + env_var_value_if_defined('GITLAB_CUSTOM_USERNAME') + end + + def gitlab_custom_username_token + env_var_value_if_defined('GITLAB_CUSTOM_ACCESS_TOKEN') + end + def run_id @run_id ||= "gitlab-qa-run-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(4)}" end @@ -432,6 +440,10 @@ module Gitlab env_var_value_if_defined('QA_COM_REGISTRY') || 'registry.gitlab.com' end + def qa_custom_registry + env_var_value_if_defined('QA_CUSTOM_REGISTRY') || 'registry.gitlab.com' + end + def gitlab_license_mode env_var_value_if_defined('GITLAB_LICENSE_MODE') end -- GitLab From 0f0c018d7ce73098105b8d701be268fe66062b00 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Thu, 14 Nov 2024 12:37:14 +1300 Subject: [PATCH 02/31] Fixed indentation --- lib/gitlab/qa/release.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 800d400f..8de63a73 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -154,7 +154,7 @@ module Gitlab return if Runtime::Env.skip_pull? params = if dev_gitlab_org? - puts "%%%%%%%%%%% inside if" + puts "%%%%%%%%%%% inside if" Runtime::Env.require_qa_dev_access_token! { @@ -163,10 +163,10 @@ module Gitlab registry: DEV_REGISTRY } elsif omnibus_mirror? || omnibus_security? - puts "%%%%%%%%%%% inside elseif" + puts "%%%%%%%%%%% inside elseif" omnibus_login_params else - puts "%%%%%%%%%%% inside else" + puts "%%%%%%%%%%% inside else" { username: Runtime::Env.gitlab_custom_username, password: Runtime::Env.gitlab_custom_username_token, -- GitLab From 7d7eaecf8c7e52cda30c25a4d122fae6c1aadef3 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Thu, 14 Nov 2024 16:04:18 +1300 Subject: [PATCH 03/31] Added condition for omnibus mirror fork --- lib/gitlab/qa/release.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 8de63a73..05d31ec3 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -112,12 +112,14 @@ module Gitlab end def qa_image - @qa_image ||= if omnibus_mirror? + @qa_image ||= if ( omnibus_mirror? || omnibus_mirror_fork? ) + puts "%%%%%%%%% inside if part of qa image" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" "#{image.gsub(omnibus_project, gitlab_project)}-qa" else + puts "%%%%%%%%% inside else part of qa image" "#{image}-qa" end end @@ -213,6 +215,10 @@ module Gitlab image.start_with?("#{COM_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/") end + def omnibus_mirror_fork? + image.start_with?(%r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror}) + end + def omnibus_security? image.start_with?("#{COM_REGISTRY}/gitlab-org/security/omnibus-gitlab/") end -- GitLab From faf07ed71ff89d849f62c5aabe34007c519446d0 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Thu, 14 Nov 2024 16:09:58 +1300 Subject: [PATCH 04/31] Adding regex for omnibus mirror project --- lib/gitlab/qa/release.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 05d31ec3..8a072aa2 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -55,6 +55,8 @@ module Gitlab \z /xi + OMNIBUS_MIRROR_FORK_REGEX = %r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror} + DEFAULT_TAG = 'latest' DEFAULT_CANONICAL_TAG = 'nightly' DEV_REGISTRY = Gitlab::QA::Runtime::Env.qa_dev_registry @@ -112,7 +114,7 @@ module Gitlab end def qa_image - @qa_image ||= if ( omnibus_mirror? || omnibus_mirror_fork? ) + @qa_image ||= if omnibus_mirror? || omnibus_mirror_fork? puts "%%%%%%%%% inside if part of qa image" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" @@ -216,7 +218,7 @@ module Gitlab end def omnibus_mirror_fork? - image.start_with?(%r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror}) + image.start_with?(OMNIBUS_MIRROR_FORK_REGEX) end def omnibus_security? -- GitLab From f1cc1e329c8476eaf41f46a606bd16291bbdbef1 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Thu, 14 Nov 2024 16:29:01 +1300 Subject: [PATCH 05/31] Moving var below defined const --- lib/gitlab/qa/release.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 8a072aa2..2baf026c 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -55,14 +55,14 @@ module Gitlab \z /xi - OMNIBUS_MIRROR_FORK_REGEX = %r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror} - DEFAULT_TAG = 'latest' DEFAULT_CANONICAL_TAG = 'nightly' DEV_REGISTRY = Gitlab::QA::Runtime::Env.qa_dev_registry COM_REGISTRY = Gitlab::QA::Runtime::Env.qa_com_registry CUSTOM_REGISTRY = Gitlab::QA::Runtime::Env.qa_custom_registry + OMNIBUS_MIRROR_FORK_REGEX = %r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror} + InvalidImageNameError = Class.new(RuntimeError) attr_reader :release -- GitLab From 367f5675ba5aa0a8c954ea4ca249dc2c46b36938 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 07:47:18 +1300 Subject: [PATCH 06/31] Added some debugging --- lib/gitlab/qa/release.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 2baf026c..664f263b 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -111,6 +111,7 @@ module Gitlab else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:image_without_tag] end + puts "$$$$$$$$$$$$$$$$$$$$"+@image.to_s end def qa_image -- GitLab From 67189d5f4611e8a20750d64e1b86dbc7b3690d80 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 07:51:51 +1300 Subject: [PATCH 07/31] Adding more debugging --- lib/gitlab/qa/release.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 664f263b..d0b7ca68 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -111,7 +111,8 @@ module Gitlab else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:image_without_tag] end - puts "$$$$$$$$$$$$$$$$$$$$"+@image.to_s + + puts "$$$$$$$$$$$$$$$$$$$$ #{@image}" end def qa_image -- GitLab From fd2232a6c72f0675b55ba4dbd0da482ad0ff1a4a Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 08:32:25 +1300 Subject: [PATCH 08/31] Added debugging --- lib/gitlab/qa/release.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index d0b7ca68..a4cd0b70 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -69,6 +69,7 @@ module Gitlab attr_writer :tag def initialize(release) + puts "%%%%%%%%%% this is release #{release}" @release = release.to_s.downcase return if valid? -- GitLab From 5220860bdf6889c61af7ef1a977b1eb2d19d397e Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 09:37:36 +1300 Subject: [PATCH 09/31] removing method for testin --- lib/gitlab/qa/release.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index a4cd0b70..2ee64af1 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -117,7 +117,7 @@ module Gitlab end def qa_image - @qa_image ||= if omnibus_mirror? || omnibus_mirror_fork? + @qa_image ||= if omnibus_mirror? # || omnibus_mirror_fork? puts "%%%%%%%%% inside if part of qa image" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" @@ -220,9 +220,9 @@ module Gitlab image.start_with?("#{COM_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/") end - def omnibus_mirror_fork? - image.start_with?(OMNIBUS_MIRROR_FORK_REGEX) - end + # def omnibus_mirror_fork? + # image.start_with?(OMNIBUS_MIRROR_FORK_REGEX) + # end def omnibus_security? image.start_with?("#{COM_REGISTRY}/gitlab-org/security/omnibus-gitlab/") -- GitLab From 2113cee78304bd5460addc22dab0c54113bec0af Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 09:44:02 +1300 Subject: [PATCH 10/31] removing method for testin --- lib/gitlab/qa/release.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 2ee64af1..42aa5188 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -61,7 +61,7 @@ module Gitlab COM_REGISTRY = Gitlab::QA::Runtime::Env.qa_com_registry CUSTOM_REGISTRY = Gitlab::QA::Runtime::Env.qa_custom_registry - OMNIBUS_MIRROR_FORK_REGEX = %r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror} + # OMNIBUS_MIRROR_FORK_REGEX = %r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror} InvalidImageNameError = Class.new(RuntimeError) @@ -220,10 +220,6 @@ module Gitlab image.start_with?("#{COM_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/") end - # def omnibus_mirror_fork? - # image.start_with?(OMNIBUS_MIRROR_FORK_REGEX) - # end - def omnibus_security? image.start_with?("#{COM_REGISTRY}/gitlab-org/security/omnibus-gitlab/") end -- GitLab From 59d2ca6f846edf177474464fa3460a140ebc4d6a Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 10:05:15 +1300 Subject: [PATCH 11/31] Removing logging --- lib/gitlab/qa/release.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 42aa5188..6c11b318 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -61,8 +61,6 @@ module Gitlab COM_REGISTRY = Gitlab::QA::Runtime::Env.qa_com_registry CUSTOM_REGISTRY = Gitlab::QA::Runtime::Env.qa_custom_registry - # OMNIBUS_MIRROR_FORK_REGEX = %r{^#{Regexp.escape(CUSTOM_REGISTRY)}/.*/omnibus-gitlab-mirror} - InvalidImageNameError = Class.new(RuntimeError) attr_reader :release @@ -117,7 +115,7 @@ module Gitlab end def qa_image - @qa_image ||= if omnibus_mirror? # || omnibus_mirror_fork? + @qa_image ||= if omnibus_mirror? puts "%%%%%%%%% inside if part of qa image" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" -- GitLab From ee6ef5ac59b1cbf210fcdd0f0fb15b03b3968a45 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 10:19:09 +1300 Subject: [PATCH 12/31] Removing logging --- lib/gitlab/qa/release.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 6c11b318..8de63a73 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -67,7 +67,6 @@ module Gitlab attr_writer :tag def initialize(release) - puts "%%%%%%%%%% this is release #{release}" @release = release.to_s.downcase return if valid? @@ -110,19 +109,15 @@ module Gitlab else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:image_without_tag] end - - puts "$$$$$$$$$$$$$$$$$$$$ #{@image}" end def qa_image @qa_image ||= if omnibus_mirror? - puts "%%%%%%%%% inside if part of qa image" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" "#{image.gsub(omnibus_project, gitlab_project)}-qa" else - puts "%%%%%%%%% inside else part of qa image" "#{image}-qa" end end -- GitLab From a4e610aa2035eec3af756d49064df40fbc6cc62b Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 12:41:28 +1300 Subject: [PATCH 13/31] Adding logging --- lib/gitlab/qa/component/base.rb | 2 +- lib/gitlab/qa/component/specs.rb | 1 + lib/gitlab/qa/release.rb | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/qa/component/base.rb b/lib/gitlab/qa/component/base.rb index d7afd33c..0a02cc0d 100644 --- a/lib/gitlab/qa/component/base.rb +++ b/lib/gitlab/qa/component/base.rb @@ -168,7 +168,7 @@ module Gitlab def pull return if Runtime::Env.skip_pull? - + puts "###### Image in docker pull l#{image} and #{tag}" docker.pull(image: image, tag: tag) end diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 2cc7e842..3cd8738e 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -191,6 +191,7 @@ module Gitlab def qa_image infered_qa_image = "#{release.qa_image}:#{release.qa_tag}" + puts "###### infered qa image #{infered_qa_image}" return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) Runtime::Scenario.qa_image diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 8de63a73..e146b904 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -113,11 +113,13 @@ module Gitlab def qa_image @qa_image ||= if omnibus_mirror? + puts "######## inside if" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" "#{image.gsub(omnibus_project, gitlab_project)}-qa" else + puts "######## inside else" "#{image}-qa" end end -- GitLab From 77dff882c23b611b70a081ac04a51b53b0e132ae Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 12:42:46 +1300 Subject: [PATCH 14/31] Fixed line break --- lib/gitlab/qa/component/base.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/component/base.rb b/lib/gitlab/qa/component/base.rb index 0a02cc0d..a8f17d89 100644 --- a/lib/gitlab/qa/component/base.rb +++ b/lib/gitlab/qa/component/base.rb @@ -168,6 +168,7 @@ module Gitlab def pull return if Runtime::Env.skip_pull? + puts "###### Image in docker pull l#{image} and #{tag}" docker.pull(image: image, tag: tag) end -- GitLab From 7e1619ab9755244d1a27f5830d1494149b96274e Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 13:06:59 +1300 Subject: [PATCH 15/31] Adding elsif condition --- lib/gitlab/qa/release.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index e146b904..af8f1787 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -105,6 +105,7 @@ module Gitlab def image @image ||= if canonical? + puts "############ inside if and edition is #{edition}" "gitlab/gitlab-#{edition}" else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:image_without_tag] @@ -117,6 +118,13 @@ module Gitlab omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" + "#{image.gsub(omnibus_project, gitlab_project)}-qa" + elsif omnibus_mirror_fork? + puts "######## inside elseif" + omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] + gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" + puts "###### #{omnibus_project}" + puts "###### #{gitlab_project}" "#{image.gsub(omnibus_project, gitlab_project)}-qa" else puts "######## inside else" @@ -215,6 +223,10 @@ module Gitlab image.start_with?("#{COM_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/") end + def omnibus_mirror_fork? + image.start_with?("#{COM_REGISTRY}/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/omnibus-gitlab-mirror") + end + def omnibus_security? image.start_with?("#{COM_REGISTRY}/gitlab-org/security/omnibus-gitlab/") end -- GitLab From b950c2fc86d1456633423bc625b2c4203451d254 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 13:10:50 +1300 Subject: [PATCH 16/31] Added to another method --- lib/gitlab/qa/release.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index af8f1787..64dd92b1 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -112,6 +112,14 @@ module Gitlab end end + def assing_omnibus_mirror_fork_project + omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] + gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" + puts "###### #{omnibus_project}" + puts "###### #{gitlab_project}" + "#{image.gsub(omnibus_project, gitlab_project)}-qa" + end + def qa_image @qa_image ||= if omnibus_mirror? puts "######## inside if" @@ -121,11 +129,7 @@ module Gitlab "#{image.gsub(omnibus_project, gitlab_project)}-qa" elsif omnibus_mirror_fork? puts "######## inside elseif" - omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] - gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" - puts "###### #{omnibus_project}" - puts "###### #{gitlab_project}" - "#{image.gsub(omnibus_project, gitlab_project)}-qa" + assing_omnibus_mirror_fork_project else puts "######## inside else" "#{image}-qa" -- GitLab From 472db387753c7b8a44e52733e8ffc4b0476cae47 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 13:37:33 +1300 Subject: [PATCH 17/31] Updating the qa image registry --- lib/gitlab/qa/release.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 64dd92b1..1fcd5c42 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -114,7 +114,7 @@ module Gitlab def assing_omnibus_mirror_fork_project omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] - gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" + gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" puts "###### #{omnibus_project}" puts "###### #{gitlab_project}" "#{image.gsub(omnibus_project, gitlab_project)}-qa" -- GitLab From 48c1812cdcdd5ec85e7e7d876fd0c4f7bbb521a1 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 13:39:33 +1300 Subject: [PATCH 18/31] Adding logging --- lib/gitlab/qa/release.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 1fcd5c42..c5512143 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -117,6 +117,7 @@ module Gitlab gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" puts "###### #{omnibus_project}" puts "###### #{gitlab_project}" + puts "#{image.gsub(omnibus_project, gitlab_project)}-qa" "#{image.gsub(omnibus_project, gitlab_project)}-qa" end -- GitLab From 39b84720aebaadc9f633840b5564a50153660ad8 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 13:45:04 +1300 Subject: [PATCH 19/31] Added more logging --- lib/gitlab/qa/component/specs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 3cd8738e..33f04f27 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -149,7 +149,7 @@ module Gitlab def docker_pull_qa_image_if_needed @docker.login(**release.login_params) if release.login_params - + puts "################ Pulling QA image #{qa_image}" @docker.pull(image: qa_image) unless Runtime::Env.skip_pull? end -- GitLab From 44a25e26257a278cf0587ef1c12a984d8c3bc691 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 14:00:31 +1300 Subject: [PATCH 20/31] Added more logging --- lib/gitlab/qa/release.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index c5512143..b71f002e 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -114,7 +114,7 @@ module Gitlab def assing_omnibus_mirror_fork_project omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] - gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" + gitlab_project = "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" puts "###### #{omnibus_project}" puts "###### #{gitlab_project}" puts "#{image.gsub(omnibus_project, gitlab_project)}-qa" @@ -150,8 +150,10 @@ module Gitlab def tag @tag ||= if canonical? + puts "######## inside if tag" release.match(CANONICAL_REGEX)[:tag] || DEFAULT_CANONICAL_TAG else + puts "######## inside else tag" release.match(CUSTOM_GITLAB_IMAGE_REGEX)&.[](:tag) || DEFAULT_TAG end end -- GitLab From 4904ddde17d37288f98e703ae103bcd60208278e Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 15:01:26 +1300 Subject: [PATCH 21/31] Added more logging --- lib/gitlab/qa/release.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index b71f002e..c85e98d2 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -161,8 +161,10 @@ module Gitlab # Tag scheme for gitlab-{ce,ee}-qa images is like 11.1.0-rc12-ee def qa_tag if dev_gitlab_org? && (match_data = tag.match(DEV_TAG_REGEX)) + puts "######## inside if qa tag" match_data[:gitlab_ref] else + puts "######## inside if qa tag" tag.sub(/[-.]([ce]e)(\.(\d+))?\z/, '-\1') end end -- GitLab From 411afcc1388807fb5531a38866d4024e3535c5de Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 15:06:13 +1300 Subject: [PATCH 22/31] Added more logging --- lib/gitlab/qa/release.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index c85e98d2..722e183b 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -164,7 +164,7 @@ module Gitlab puts "######## inside if qa tag" match_data[:gitlab_ref] else - puts "######## inside if qa tag" + puts "######## inside else qa tag" tag.sub(/[-.]([ce]e)(\.(\d+))?\z/, '-\1') end end -- GitLab From eb6b5615d3e1dfa4b53ea6aa512a64391344364c Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 15:13:52 +1300 Subject: [PATCH 23/31] Added more logging --- lib/gitlab/qa/release.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 722e183b..185a5e5b 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -162,6 +162,7 @@ module Gitlab def qa_tag if dev_gitlab_org? && (match_data = tag.match(DEV_TAG_REGEX)) puts "######## inside if qa tag" + puts "########## #{match_data}" match_data[:gitlab_ref] else puts "######## inside else qa tag" -- GitLab From c30846dcac0be9306b335bba9f24bff52b9b1eed Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 15:45:28 +1300 Subject: [PATCH 24/31] Changed to elsif --- lib/gitlab/qa/release.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 185a5e5b..66efa8df 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -174,7 +174,7 @@ module Gitlab return if Runtime::Env.skip_pull? params = if dev_gitlab_org? - puts "%%%%%%%%%%% inside if" + puts "%%%%%%%%%%% inside if method login params" Runtime::Env.require_qa_dev_access_token! { @@ -183,10 +183,10 @@ module Gitlab registry: DEV_REGISTRY } elsif omnibus_mirror? || omnibus_security? - puts "%%%%%%%%%%% inside elseif" + puts "%%%%%%%%%%% inside elseif method login params" omnibus_login_params - else - puts "%%%%%%%%%%% inside else" + elsif omnibus_mirror_fork? + puts "%%%%%%%%%%% inside else method login params" { username: Runtime::Env.gitlab_custom_username, password: Runtime::Env.gitlab_custom_username_token, -- GitLab From 606cc53a068d3663592aacc55124c91195d69853 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 16:07:48 +1300 Subject: [PATCH 25/31] Changed to elsif --- lib/gitlab/qa/component/specs.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 33f04f27..0e632396 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -194,6 +194,7 @@ module Gitlab puts "###### infered qa image #{infered_qa_image}" return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) + puts "###### After return infered qa image #{infered_qa_image}" Runtime::Scenario.qa_image end -- GitLab From bd8a7f0facef6132d816cab04775056add5611f2 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 16:28:32 +1300 Subject: [PATCH 26/31] Changed to elsif --- lib/gitlab/qa/component/specs.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 0e632396..0cb5f569 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -192,6 +192,8 @@ module Gitlab def qa_image infered_qa_image = "#{release.qa_image}:#{release.qa_tag}" puts "###### infered qa image #{infered_qa_image}" + puts "infer_qa_image_from_release #{infer_qa_image_from_release}" + puts "!Runtime::Scenario.attributes.include?(:qa_image) #{!Runtime::Scenario.attributes.include?(:qa_image)}" return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) puts "###### After return infered qa image #{infered_qa_image}" -- GitLab From 8b4e23d7415c3da3e35793c9ce76031aec49ab46 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 16:35:29 +1300 Subject: [PATCH 27/31] Changed to elsif --- lib/gitlab/qa/component/specs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 0cb5f569..88a02908 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -194,7 +194,7 @@ module Gitlab puts "###### infered qa image #{infered_qa_image}" puts "infer_qa_image_from_release #{infer_qa_image_from_release}" puts "!Runtime::Scenario.attributes.include?(:qa_image) #{!Runtime::Scenario.attributes.include?(:qa_image)}" - return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) + # return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) puts "###### After return infered qa image #{infered_qa_image}" Runtime::Scenario.qa_image -- GitLab From baddbdf91581fb7a3e1ae4adb6ac7c6ed219a390 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Fri, 15 Nov 2024 16:50:27 +1300 Subject: [PATCH 28/31] Changed to elsif --- lib/gitlab/qa/component/specs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 88a02908..0cb5f569 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -194,7 +194,7 @@ module Gitlab puts "###### infered qa image #{infered_qa_image}" puts "infer_qa_image_from_release #{infer_qa_image_from_release}" puts "!Runtime::Scenario.attributes.include?(:qa_image) #{!Runtime::Scenario.attributes.include?(:qa_image)}" - # return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) + return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) puts "###### After return infered qa image #{infered_qa_image}" Runtime::Scenario.qa_image -- GitLab From 52d9bf2de3add4c968698f65d6db0cf9d531e0ae Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Mon, 18 Nov 2024 10:38:54 +1300 Subject: [PATCH 29/31] Removed elseif and method for qa_image --- lib/gitlab/qa/release.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 66efa8df..10ccf5ff 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -112,14 +112,14 @@ module Gitlab end end - def assing_omnibus_mirror_fork_project - omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] - gitlab_project = "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" - puts "###### #{omnibus_project}" - puts "###### #{gitlab_project}" - puts "#{image.gsub(omnibus_project, gitlab_project)}-qa" - "#{image.gsub(omnibus_project, gitlab_project)}-qa" - end + # def assing_omnibus_mirror_fork_project + # omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] + # gitlab_project = "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" + # puts "###### #{omnibus_project}" + # puts "###### #{gitlab_project}" + # puts "#{image.gsub(omnibus_project, gitlab_project)}-qa" + # "#{image.gsub(omnibus_project, gitlab_project)}-qa" + # end def qa_image @qa_image ||= if omnibus_mirror? @@ -128,9 +128,9 @@ module Gitlab gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" "#{image.gsub(omnibus_project, gitlab_project)}-qa" - elsif omnibus_mirror_fork? - puts "######## inside elseif" - assing_omnibus_mirror_fork_project + # elsif omnibus_mirror_fork? + # puts "######## inside elseif" + # assing_omnibus_mirror_fork_project else puts "######## inside else" "#{image}-qa" -- GitLab From 5850905de67d37fa9f323072743e7ed10c6983fa Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Mon, 18 Nov 2024 11:16:19 +1300 Subject: [PATCH 30/31] Logging info --- lib/gitlab/qa/component/specs.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 0cb5f569..1c0b23af 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -197,6 +197,7 @@ module Gitlab return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) puts "###### After return infered qa image #{infered_qa_image}" + puts "###### #{Runtime::Scenario.qa_image}" Runtime::Scenario.qa_image end -- GitLab From b5e5f936806fa6e0fae39833b73ac68d3a604349 Mon Sep 17 00:00:00 2001 From: "vishal.s.patel" Date: Mon, 18 Nov 2024 11:58:30 +1300 Subject: [PATCH 31/31] Removed logging --- lib/gitlab/qa/component/base.rb | 1 - lib/gitlab/qa/component/specs.rb | 6 ------ lib/gitlab/qa/release.rb | 30 ++++++++---------------------- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/lib/gitlab/qa/component/base.rb b/lib/gitlab/qa/component/base.rb index a8f17d89..d7afd33c 100644 --- a/lib/gitlab/qa/component/base.rb +++ b/lib/gitlab/qa/component/base.rb @@ -169,7 +169,6 @@ module Gitlab def pull return if Runtime::Env.skip_pull? - puts "###### Image in docker pull l#{image} and #{tag}" docker.pull(image: image, tag: tag) end diff --git a/lib/gitlab/qa/component/specs.rb b/lib/gitlab/qa/component/specs.rb index 1c0b23af..677968f4 100644 --- a/lib/gitlab/qa/component/specs.rb +++ b/lib/gitlab/qa/component/specs.rb @@ -149,7 +149,6 @@ module Gitlab def docker_pull_qa_image_if_needed @docker.login(**release.login_params) if release.login_params - puts "################ Pulling QA image #{qa_image}" @docker.pull(image: qa_image) unless Runtime::Env.skip_pull? end @@ -191,13 +190,8 @@ module Gitlab def qa_image infered_qa_image = "#{release.qa_image}:#{release.qa_tag}" - puts "###### infered qa image #{infered_qa_image}" - puts "infer_qa_image_from_release #{infer_qa_image_from_release}" - puts "!Runtime::Scenario.attributes.include?(:qa_image) #{!Runtime::Scenario.attributes.include?(:qa_image)}" return infered_qa_image if infer_qa_image_from_release || !Runtime::Scenario.attributes.include?(:qa_image) - puts "###### After return infered qa image #{infered_qa_image}" - puts "###### #{Runtime::Scenario.qa_image}" Runtime::Scenario.qa_image end diff --git a/lib/gitlab/qa/release.rb b/lib/gitlab/qa/release.rb index 10ccf5ff..2ec170ad 100644 --- a/lib/gitlab/qa/release.rb +++ b/lib/gitlab/qa/release.rb @@ -105,34 +105,28 @@ module Gitlab def image @image ||= if canonical? - puts "############ inside if and edition is #{edition}" "gitlab/gitlab-#{edition}" else release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:image_without_tag] end end - # def assing_omnibus_mirror_fork_project - # omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] - # gitlab_project = "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" - # puts "###### #{omnibus_project}" - # puts "###### #{gitlab_project}" - # puts "#{image.gsub(omnibus_project, gitlab_project)}-qa" - # "#{image.gsub(omnibus_project, gitlab_project)}-qa" - # end + def assing_omnibus_mirror_fork_project + omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] + gitlab_project = "/registry.gitlab.com/gitlab-com/ops-sub-department/aws-gitlab-ai-integration/gitlab/" + + "#{image.gsub(omnibus_project, gitlab_project)}-qa" + end def qa_image @qa_image ||= if omnibus_mirror? - puts "######## inside if" omnibus_project = image.match(CUSTOM_GITLAB_IMAGE_REGEX)[:project] gitlab_project = ci_project_path ? "/#{ci_project_path}/" : "/gitlab-org/gitlab/" "#{image.gsub(omnibus_project, gitlab_project)}-qa" - # elsif omnibus_mirror_fork? - # puts "######## inside elseif" - # assing_omnibus_mirror_fork_project + elsif omnibus_mirror_fork? + assing_omnibus_mirror_fork_project else - puts "######## inside else" "#{image}-qa" end end @@ -150,10 +144,8 @@ module Gitlab def tag @tag ||= if canonical? - puts "######## inside if tag" release.match(CANONICAL_REGEX)[:tag] || DEFAULT_CANONICAL_TAG else - puts "######## inside else tag" release.match(CUSTOM_GITLAB_IMAGE_REGEX)&.[](:tag) || DEFAULT_TAG end end @@ -161,11 +153,8 @@ module Gitlab # Tag scheme for gitlab-{ce,ee}-qa images is like 11.1.0-rc12-ee def qa_tag if dev_gitlab_org? && (match_data = tag.match(DEV_TAG_REGEX)) - puts "######## inside if qa tag" - puts "########## #{match_data}" match_data[:gitlab_ref] else - puts "######## inside else qa tag" tag.sub(/[-.]([ce]e)(\.(\d+))?\z/, '-\1') end end @@ -174,7 +163,6 @@ module Gitlab return if Runtime::Env.skip_pull? params = if dev_gitlab_org? - puts "%%%%%%%%%%% inside if method login params" Runtime::Env.require_qa_dev_access_token! { @@ -183,10 +171,8 @@ module Gitlab registry: DEV_REGISTRY } elsif omnibus_mirror? || omnibus_security? - puts "%%%%%%%%%%% inside elseif method login params" omnibus_login_params elsif omnibus_mirror_fork? - puts "%%%%%%%%%%% inside else method login params" { username: Runtime::Env.gitlab_custom_username, password: Runtime::Env.gitlab_custom_username_token, -- GitLab