Commit 1799519d authored by Max Woolf's avatar Max Woolf

Merge branch 'remove-ff-avoid-cross-joins-environments-in-self-and-descendants' into 'master'

Remove FF avoid_cross_joins_environments_in_self_and_descendants

See merge request gitlab-org/gitlab!76857
parents c7a6ab39 4c768671
......@@ -949,22 +949,16 @@ module Ci
end
def environments_in_self_and_descendants
if ::Feature.enabled?(:avoid_cross_joins_environments_in_self_and_descendants, default_enabled: :yaml)
# We limit to 100 unique environments for application safety.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/340781#note_699114700
expanded_environment_names =
builds_in_self_and_descendants.joins(:metadata)
.where.not('ci_builds_metadata.expanded_environment_name' => nil)
.distinct('ci_builds_metadata.expanded_environment_name')
.limit(100)
.pluck(:expanded_environment_name)
Environment.where(project: project, name: expanded_environment_names).with_deployment(sha)
else
environment_ids = self_and_descendants.joins(:deployments).select(:'deployments.environment_id')
Environment.where(id: environment_ids)
end
# We limit to 100 unique environments for application safety.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/340781#note_699114700
expanded_environment_names =
builds_in_self_and_descendants.joins(:metadata)
.where.not('ci_builds_metadata.expanded_environment_name' => nil)
.distinct('ci_builds_metadata.expanded_environment_name')
.limit(100)
.pluck(:expanded_environment_name)
Environment.where(project: project, name: expanded_environment_names).with_deployment(sha)
end
# With multi-project and parent-child pipelines
......
---
name: avoid_cross_joins_environments_in_self_and_descendants
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71894
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/342991
milestone: '14.4'
type: development
group: group::release
default_enabled: false
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