Commit fdfb8ad2 authored by mfluharty's avatar mfluharty

Add license check for full code quality report

Add 'full_codequality_report' as a starter feature
Check feature availability when rendering the pipeline Code Quality tab
Add a test to check that it's not rendered when feature is not available
parent 5c5650e9
......@@ -21,6 +21,7 @@ class License < ApplicationRecord
contribution_analytics
description_diffs
elastic_search
full_codequality_report
group_activity_analytics
group_bulk_edit
group_webhooks
......
......@@ -5,7 +5,7 @@
- licenses_api_path = licenses_project_pipeline_path(project, pipeline) if project.feature_available?(:license_scanning)
- vulnerabilities_endpoint_path = expose_path(api_v4_projects_vulnerability_findings_path(id: project.id, params: { pipeline_id: pipeline.id }))
- vulnerability_exports_endpoint_path = expose_path(api_v4_security_projects_vulnerability_exports_path(id: project.id))
- codequality_report_download_path = pipeline.downloadable_path_for_report_type(:codequality)
- codequality_report_download_path = pipeline.downloadable_path_for_report_type(:codequality) if project.feature_available?(:full_codequality_report)
- if pipeline.expose_security_dashboard?
#js-tab-security.build-security.tab-pane
......
......@@ -12,7 +12,7 @@
= _("Licenses")
%span.badge.badge-pill.js-licenses-counter.hidden{ data: { qa_selector: 'licenses_counter' } }
- if pipeline.downloadable_path_for_report_type(:codequality)
- if project.feature_available?(:full_codequality_report) && pipeline.downloadable_path_for_report_type(:codequality)
%li.js-codequality-tab-link
= link_to codequality_report_project_pipeline_path(project, pipeline), data: { target: '#js-tab-codequality', action: 'codequality_report', toggle: 'tab', 'track-event': 'click_button', 'track-label': 'get_codequality_report' }, class: 'codequality-tab' do
= _('Code Quality')
......@@ -181,6 +181,21 @@ RSpec.describe 'Pipeline', :js do
end
end
context 'when unlicensed' do
before do
stub_licensed_features(full_codequality_report: false)
create(:ee_ci_build, :codequality, pipeline: pipeline)
visit project_pipeline_path(project, pipeline)
wait_for_requests
end
it 'does not show code quality tab' do
expect(page).not_to have_content('Code Quality')
expect(page).not_to have_css('#js-tab-codequality')
end
end
context 'with code quality artifact' do
before do
create(:ee_ci_build, :codequality, pipeline: pipeline)
......
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