Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0b9673eb
Commit
0b9673eb
authored
Oct 13, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes cross join in merge request environments
parent
0c5eca15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
app/models/merge_request.rb
app/models/merge_request.rb
+13
-1
config/feature_flags/development/avoid_cross_joins_environments_merge_request.yml
...elopment/avoid_cross_joins_environments_merge_request.yml
+8
-0
No files found.
app/models/merge_request.rb
View file @
0b9673eb
...
@@ -1409,7 +1409,19 @@ class MergeRequest < ApplicationRecord
...
@@ -1409,7 +1409,19 @@ class MergeRequest < ApplicationRecord
def
environments
def
environments
return
Environment
.
none
unless
actual_head_pipeline
&
.
merge_request?
return
Environment
.
none
unless
actual_head_pipeline
&
.
merge_request?
actual_head_pipeline
.
environments
if
::
Feature
.
enabled?
(
:avoid_cross_joins_environments_merge_request
,
default_enabled: :yaml
)
build_for_actual_head_pipeline
=
Ci
::
Build
.
latest
.
where
(
pipeline:
actual_head_pipeline
)
environments
=
build_for_actual_head_pipeline
.
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:
environments
)
else
actual_head_pipeline
.
environments
end
end
end
def
fetch_ref!
def
fetch_ref!
...
...
config/feature_flags/development/avoid_cross_joins_environments_merge_request.yml
0 → 100644
View file @
0b9673eb
---
name
:
avoid_cross_joins_environments_merge_request
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71591
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/343236
milestone
:
'
14.5'
type
:
development
group
:
group::sharding
default_enabled
:
false
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment