Commit 78fd7bcc authored by Maxime Orefice's avatar Maxime Orefice Committed by Dmytro Zaporozhets (DZ)

Add codequality backend comparison feature flag

This commit creates a new feature flag wich will be used to
toggle our codequality feature comparison on the backend.
parent 5d588d80
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
helpPath: this.codequalityHelpPath, helpPath: this.codequalityHelpPath,
}); });
this.fetchReports(this.glFeatures.codequalityMrDiff); this.fetchReports(this.glFeatures.codequalityBackendComparison);
}, },
methods: { methods: {
...mapActions(['fetchReports', 'setPaths']), ...mapActions(['fetchReports', 'setPaths']),
......
...@@ -39,7 +39,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -39,7 +39,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:core_security_mr_widget_counts, @project) push_frontend_feature_flag(:core_security_mr_widget_counts, @project)
push_frontend_feature_flag(:remove_resolve_note, @project, default_enabled: true) push_frontend_feature_flag(:remove_resolve_note, @project, default_enabled: true)
push_frontend_feature_flag(:diffs_gradual_load, @project, default_enabled: true) push_frontend_feature_flag(:diffs_gradual_load, @project, default_enabled: true)
push_frontend_feature_flag(:codequality_mr_diff, @project) push_frontend_feature_flag(:codequality_backend_comparison, @project, default_enabled: :yaml)
push_frontend_feature_flag(:suggestions_custom_commit, @project) push_frontend_feature_flag(:suggestions_custom_commit, @project)
push_frontend_feature_flag(:local_file_reviews, default_enabled: :yaml) push_frontend_feature_flag(:local_file_reviews, default_enabled: :yaml)
......
...@@ -1485,7 +1485,7 @@ class MergeRequest < ApplicationRecord ...@@ -1485,7 +1485,7 @@ class MergeRequest < ApplicationRecord
end end
def has_codequality_reports? def has_codequality_reports?
return false unless ::Gitlab::Ci::Features.display_quality_on_mr_diff?(project) return false unless ::Gitlab::Ci::Features.display_codequality_backend_comparison?(project)
actual_head_pipeline&.has_reports?(Ci::JobArtifact.codequality_reports) actual_head_pipeline&.has_reports?(Ci::JobArtifact.codequality_reports)
end end
......
---
name: codequality_backend_comparison
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53068
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/300796
milestone: '13.9'
type: development
group: group::testing
default_enabled: false
...@@ -71,6 +71,10 @@ module Gitlab ...@@ -71,6 +71,10 @@ module Gitlab
def self.display_quality_on_mr_diff?(project) def self.display_quality_on_mr_diff?(project)
::Feature.enabled?(:codequality_mr_diff, project, default_enabled: false) ::Feature.enabled?(:codequality_mr_diff, project, default_enabled: false)
end end
def self.display_codequality_backend_comparison?(project)
::Feature.enabled?(:codequality_backend_comparison, project, default_enabled: :yaml)
end
end end
end end
end end
...@@ -65,7 +65,7 @@ describe('Codequality Reports actions', () => { ...@@ -65,7 +65,7 @@ describe('Codequality Reports actions', () => {
let mock; let mock;
let diffFeatureFlagEnabled; let diffFeatureFlagEnabled;
describe('with codequalityMrDiff feature flag enabled', () => { describe('with codequalityBackendComparison feature flag enabled', () => {
beforeEach(() => { beforeEach(() => {
diffFeatureFlagEnabled = true; diffFeatureFlagEnabled = true;
localState.reportsPath = `${TEST_HOST}/codequality_reports.json`; localState.reportsPath = `${TEST_HOST}/codequality_reports.json`;
...@@ -112,7 +112,7 @@ describe('Codequality Reports actions', () => { ...@@ -112,7 +112,7 @@ describe('Codequality Reports actions', () => {
}); });
}); });
describe('with codequalityMrDiff feature flag disabled', () => { describe('with codequalityBackendComparison feature flag disabled', () => {
beforeEach(() => { beforeEach(() => {
diffFeatureFlagEnabled = false; diffFeatureFlagEnabled = false;
localState.headPath = `${TEST_HOST}/head.json`; localState.headPath = `${TEST_HOST}/head.json`;
......
...@@ -1994,7 +1994,7 @@ RSpec.describe MergeRequest, factory_default: :keep do ...@@ -1994,7 +1994,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
context 'when feature flag is disabled' do context 'when feature flag is disabled' do
before do before do
stub_feature_flags(codequality_mr_diff: false) stub_feature_flags(codequality_backend_comparison: false)
end end
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
......
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