Commit 3142d8fc authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '57397-fixes-technical-debt-for-cluster-domain' into 'master'

Fixes technical debt issues for cluster domain

Closes #57397

See merge request gitlab-org/gitlab-ce!25010
parents 724e904c b3364566
...@@ -221,7 +221,8 @@ module Clusters ...@@ -221,7 +221,8 @@ module Clusters
# ProjectAutoDevops#Domain, project variables or group variables, # ProjectAutoDevops#Domain, project variables or group variables,
# as the AUTO_DEVOPS_DOMAIN is needed for CI_ENVIRONMENT_URL # as the AUTO_DEVOPS_DOMAIN is needed for CI_ENVIRONMENT_URL
# #
# This method should be removed on 12.0 # This method should is scheduled to be removed on
# https://gitlab.com/gitlab-org/gitlab-ce/issues/56959
def legacy_auto_devops_domain def legacy_auto_devops_domain
if project_type? if project_type?
project&.auto_devops&.domain.presence || project&.auto_devops&.domain.presence ||
......
...@@ -27,7 +27,8 @@ class ProjectAutoDevops < ActiveRecord::Base ...@@ -27,7 +27,8 @@ class ProjectAutoDevops < ActiveRecord::Base
# From 11.8, AUTO_DEVOPS_DOMAIN has been replaced by KUBE_INGRESS_BASE_DOMAIN. # From 11.8, AUTO_DEVOPS_DOMAIN has been replaced by KUBE_INGRESS_BASE_DOMAIN.
# See Clusters::Cluster#predefined_variables and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24580 # See Clusters::Cluster#predefined_variables and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24580
# for more info. # for more info.
# Support for AUTO_DEVOPS_DOMAIN support will be dropped on 12.0 on #
# Suppport AUTO_DEVOPS_DOMAIN is scheduled to be removed on
# https://gitlab.com/gitlab-org/gitlab-ce/issues/52363 # https://gitlab.com/gitlab-org/gitlab-ce/issues/52363
def predefined_variables def predefined_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables| Gitlab::Ci::Variables::Collection.new.tap do |variables|
......
...@@ -55,8 +55,8 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do ...@@ -55,8 +55,8 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
expect(clusters_with_domain.count).to eq(20) expect(clusters_with_domain.count).to eq(20)
project_auto_devops_with_domain.each do |project_auto_devops| project_auto_devops_with_domain.each do |project_auto_devops|
cluster_project = Clusters::Project.find_by(project_id: project_auto_devops.project_id) cluster_project = find_cluster_project(project_auto_devops.project_id)
cluster = Clusters::Cluster.find(cluster_project.cluster_id) cluster = find_cluster(cluster_project.cluster_id)
expect(cluster.domain).to be_present expect(cluster.domain).to be_present
end end
...@@ -64,8 +64,8 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do ...@@ -64,8 +64,8 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
expect(clusters_without_domain.count).to eq(25) expect(clusters_without_domain.count).to eq(25)
project_auto_devops_without_domain.each do |project_auto_devops| project_auto_devops_without_domain.each do |project_auto_devops|
cluster_project = Clusters::Project.find_by(project_id: project_auto_devops.project_id) cluster_project = find_cluster_project(project_auto_devops.project_id)
cluster = Clusters::Cluster.find(cluster_project.cluster_id) cluster = find_cluster(cluster_project.cluster_id)
expect(cluster.domain).not_to be_present expect(cluster.domain).not_to be_present
end end
...@@ -88,6 +88,14 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do ...@@ -88,6 +88,14 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
end end
end end
def find_cluster_project(project_id)
cluster_projects_table.where(project_id: project_id).first
end
def find_cluster(cluster_id)
clusters_table.where(id: cluster_id).first
end
def project_auto_devops_with_domain def project_auto_devops_with_domain
project_auto_devops_table.where.not("domain IS NULL OR domain = ''") project_auto_devops_table.where.not("domain IS NULL OR domain = ''")
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment