Commit a86801fc authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'dc-feature-flag-cleanup' into 'master'

Separate repository analytics and group coverage licensing

See merge request gitlab-org/gitlab!44478
parents 11dc34b3 8db976b7
...@@ -7,11 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -7,11 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Repositories Analytics **(PREMIUM)** # Repositories Analytics **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215104) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.4. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215104) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.4.
> - It's [deployed behind a feature flag](../../feature_flags.md), enabled by default.
> - It's enabled on GitLab.com.
> - It's recommended for production use.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-repositories-analytics). **(CORE ONLY)**
CAUTION: **Warning:** CAUTION: **Warning:**
This feature might not be available to you. Check the **version history** note above for details. This feature might not be available to you. Check the **version history** note above for details.
...@@ -35,25 +31,6 @@ For each day that a coverage report was generated by a job in a project's pipeli ...@@ -35,25 +31,6 @@ For each day that a coverage report was generated by a job in a project's pipeli
If the project's code coverage was calculated more than once in a day, we will take the last value from that day. If the project's code coverage was calculated more than once in a day, we will take the last value from that day.
## Enable or disable Repositories Analytics **(CORE ONLY)**
Repositories Analytics is under development but ready for production use.
It is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can opt to disable it.
To enable it:
```ruby
Feature.enable(:group_coverage_reports)
```
To disable it:
```ruby
Feature.disable(:group_coverage_reports)
```
<!-- ## Troubleshooting <!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
...@@ -5,7 +5,6 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat ...@@ -5,7 +5,6 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
before_action :load_group before_action :load_group
before_action -> { check_feature_availability!(:group_coverage_reports) } before_action -> { check_feature_availability!(:group_coverage_reports) }
before_action :check_feature_flag
def index def index
respond_to do |format| respond_to do |format|
...@@ -51,8 +50,4 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat ...@@ -51,8 +50,4 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
value: @group.id value: @group.id
} }
end end
def check_feature_flag
render_404 unless @group.feature_available?(:group_coverage_reports)
end
end end
...@@ -4,7 +4,6 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl ...@@ -4,7 +4,6 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
layout 'group' layout 'group'
before_action :load_group before_action :load_group
before_action :check_feature_flag
before_action -> { check_feature_availability!(:group_repository_analytics) } before_action -> { check_feature_availability!(:group_repository_analytics) }
before_action -> { authorize_view_by_action!(:read_group_repository_analytics) } before_action -> { authorize_view_by_action!(:read_group_repository_analytics) }
before_action -> { push_frontend_feature_flag(:group_coverage_data_report, @group, default_enabled: false) } before_action -> { push_frontend_feature_flag(:group_coverage_data_report, @group, default_enabled: false) }
...@@ -21,8 +20,4 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl ...@@ -21,8 +20,4 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
value: @group.id value: @group.id
} }
end end
def check_feature_flag
render_404 unless @group.feature_available?(:group_coverage_reports)
end
end end
...@@ -10,7 +10,7 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do ...@@ -10,7 +10,7 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
before do before do
sign_in(current_user) sign_in(current_user)
stub_licensed_features(feature_name => true, :group_coverage_reports => true) stub_licensed_features(feature_name => true)
end end
describe 'GET show', :snowplow do describe 'GET show', :snowplow do
...@@ -35,20 +35,12 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do ...@@ -35,20 +35,12 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
context 'when license is missing' do context 'when license is missing' do
before do before do
stub_licensed_features(feature_name => false, :group_coverage_reports => true) stub_licensed_features(feature_name => false)
end end
it { is_expected.to have_gitlab_http_status(:forbidden) } it { is_expected.to have_gitlab_http_status(:forbidden) }
end end
context 'when `group_repository_analytics` licensed feature flag is off' do
before do
stub_feature_flags(group_coverage_reports: false)
end
it { is_expected.to have_gitlab_http_status(:not_found) }
end
context 'when the user has no access to the group' do context 'when the user has no access to the group' do
before do before do
current_user.group_members.delete_all current_user.group_members.delete_all
......
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