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
e81a1ba3
Commit
e81a1ba3
authored
Oct 12, 2021
by
Bala Kumar
Committed by
Shinya Maeda
Oct 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove FF `environment_last_visible_pipeline_disable_joins`"
parent
1c9615a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
78 deletions
+4
-78
app/models/environment.rb
app/models/environment.rb
+4
-4
config/feature_flags/development/environment_last_visible_pipeline_disable_joins.yml
...pment/environment_last_visible_pipeline_disable_joins.yml
+0
-8
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+0
-66
No files found.
app/models/environment.rb
View file @
e81a1ba3
...
@@ -28,8 +28,8 @@ class Environment < ApplicationRecord
...
@@ -28,8 +28,8 @@ class Environment < ApplicationRecord
has_one
:last_deployment
,
->
{
success
.
distinct_on_environment
},
class_name:
'Deployment'
,
inverse_of: :environment
has_one
:last_deployment
,
->
{
success
.
distinct_on_environment
},
class_name:
'Deployment'
,
inverse_of: :environment
has_one
:last_visible_deployment
,
->
{
visible
.
distinct_on_environment
},
inverse_of: :environment
,
class_name:
'Deployment'
has_one
:last_visible_deployment
,
->
{
visible
.
distinct_on_environment
},
inverse_of: :environment
,
class_name:
'Deployment'
has_one
:last_visible_deployable
,
through: :last_visible_deployment
,
source:
'deployable'
,
source_type:
'CommitStatus'
,
disable_joins:
->
{
::
Feature
.
enabled?
(
:environment_last_visible_pipeline_disable_joins
,
default_enabled: :yaml
)
}
has_one
:last_visible_deployable
,
through: :last_visible_deployment
,
source:
'deployable'
,
source_type:
'CommitStatus'
,
disable_joins:
true
has_one
:last_visible_pipeline
,
through: :last_visible_deployable
,
source:
'pipeline'
,
disable_joins:
->
{
::
Feature
.
enabled?
(
:environment_last_visible_pipeline_disable_joins
,
default_enabled: :yaml
)
}
has_one
:last_visible_pipeline
,
through: :last_visible_deployable
,
source:
'pipeline'
,
disable_joins:
true
has_one
:upcoming_deployment
,
->
{
running
.
distinct_on_environment
},
class_name:
'Deployment'
,
inverse_of: :environment
has_one
:upcoming_deployment
,
->
{
running
.
distinct_on_environment
},
class_name:
'Deployment'
,
inverse_of: :environment
has_one
:latest_opened_most_severe_alert
,
->
{
order_severity_with_open_prometheus_alert
},
class_name:
'AlertManagement::Alert'
,
inverse_of: :environment
has_one
:latest_opened_most_severe_alert
,
->
{
order_severity_with_open_prometheus_alert
},
class_name:
'AlertManagement::Alert'
,
inverse_of: :environment
...
@@ -198,14 +198,14 @@ class Environment < ApplicationRecord
...
@@ -198,14 +198,14 @@ class Environment < ApplicationRecord
# Overriding association
# Overriding association
def
last_visible_deployable
def
last_visible_deployable
return
super
if
association_cached?
(
:last_visible_deployable
)
||
::
Feature
.
disabled?
(
:environment_last_visible_pipeline_disable_joins
,
default_enabled: :yaml
)
return
super
if
association_cached?
(
:last_visible_deployable
)
last_visible_deployment
&
.
deployable
last_visible_deployment
&
.
deployable
end
end
# Overriding association
# Overriding association
def
last_visible_pipeline
def
last_visible_pipeline
return
super
if
association_cached?
(
:last_visible_pipeline
)
||
::
Feature
.
disabled?
(
:environment_last_visible_pipeline_disable_joins
,
default_enabled: :yaml
)
return
super
if
association_cached?
(
:last_visible_pipeline
)
last_visible_deployable
&
.
pipeline
last_visible_deployable
&
.
pipeline
end
end
...
...
config/feature_flags/development/environment_last_visible_pipeline_disable_joins.yml
deleted
100644 → 0
View file @
1c9615a3
---
name
:
environment_last_visible_pipeline_disable_joins
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68870
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/340283
milestone
:
'
14.3'
type
:
development
group
:
group::release
default_enabled
:
true
spec/models/environment_spec.rb
View file @
e81a1ba3
...
@@ -801,38 +801,6 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
...
@@ -801,38 +801,6 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
expect
(
query_count
).
to
eq
(
0
)
expect
(
query_count
).
to
eq
(
0
)
end
end
end
end
context
'when the feature for disable_join is disabled'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
,
pipeline:
pipeline
)
}
before
do
stub_feature_flags
(
environment_last_visible_pipeline_disable_joins:
false
)
create
(
:deployment
,
:failed
,
project:
project
,
environment:
environment
,
deployable:
ci_build
)
end
context
'for preload'
do
it
'executes the original association instead of override'
do
environment
.
reload
ActiveRecord
::
Associations
::
Preloader
.
new
.
preload
(
environment
,
[
last_visible_deployable:
[]])
expect_any_instance_of
(
Deployment
).
not_to
receive
(
:deployable
)
query_count
=
ActiveRecord
::
QueryRecorder
.
new
do
expect
(
subject
.
id
).
to
eq
(
ci_build
.
id
)
end
.
count
expect
(
query_count
).
to
eq
(
0
)
end
end
context
'for direct call'
do
it
'executes the original association instead of override'
do
expect_any_instance_of
(
Deployment
).
not_to
receive
(
:deployable
)
expect
(
subject
.
id
).
to
eq
(
ci_build
.
id
)
end
end
end
end
end
describe
'#last_visible_pipeline'
do
describe
'#last_visible_pipeline'
do
...
@@ -963,40 +931,6 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
...
@@ -963,40 +931,6 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
expect
(
query_count
).
to
eq
(
0
)
expect
(
query_count
).
to
eq
(
0
)
end
end
end
end
context
'when the feature for disable_join is disabled'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:ci_build
)
{
create
(
:ci_build
,
project:
project
,
pipeline:
pipeline
)
}
before
do
stub_feature_flags
(
environment_last_visible_pipeline_disable_joins:
false
)
create
(
:deployment
,
:failed
,
project:
project
,
environment:
environment
,
deployable:
ci_build
)
end
subject
{
environment
.
last_visible_pipeline
}
context
'for preload'
do
it
'executes the original association instead of override'
do
environment
.
reload
ActiveRecord
::
Associations
::
Preloader
.
new
.
preload
(
environment
,
[
last_visible_pipeline:
[]])
expect_any_instance_of
(
Ci
::
Build
).
not_to
receive
(
:pipeline
)
query_count
=
ActiveRecord
::
QueryRecorder
.
new
do
expect
(
subject
.
id
).
to
eq
(
pipeline
.
id
)
end
.
count
expect
(
query_count
).
to
eq
(
0
)
end
end
context
'for direct call'
do
it
'executes the original association instead of override'
do
expect_any_instance_of
(
Ci
::
Build
).
not_to
receive
(
:pipeline
)
expect
(
subject
.
id
).
to
eq
(
pipeline
.
id
)
end
end
end
end
end
describe
'#upcoming_deployment'
do
describe
'#upcoming_deployment'
do
...
...
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