Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
c5d41b84ce
commit
04ebfaf17c
15 changed files with 87 additions and 51 deletions
|
@ -8,8 +8,6 @@ class Admin::IntegrationsController < Admin::ApplicationController
|
|||
feature_category :integrations
|
||||
|
||||
def overrides
|
||||
return render_404 unless instance_level_integration_overrides?
|
||||
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
projects = Project.with_active_integration(integration.class).merge(::Integration.with_custom_settings)
|
||||
|
|
|
@ -128,14 +128,12 @@ module IntegrationsHelper
|
|||
def integration_tabs(integration:)
|
||||
[
|
||||
{ key: 'edit', text: _('Settings'), href: scoped_edit_integration_path(integration) },
|
||||
({ key: 'overrides', text: s_('Integrations|Projects using custom settings'), href: scoped_overrides_integration_path(integration) } if instance_level_integration_overrides?)
|
||||
(
|
||||
{ key: 'overrides', text: s_('Integrations|Projects using custom settings'), href: scoped_overrides_integration_path(integration) } if integration.instance_level?
|
||||
)
|
||||
].compact
|
||||
end
|
||||
|
||||
def instance_level_integration_overrides?
|
||||
Feature.enabled?(:instance_level_integration_overrides, default_enabled: :yaml)
|
||||
end
|
||||
|
||||
def jira_issue_breadcrumb_link(issue_reference)
|
||||
link_to '', { class: 'gl-display-flex gl-align-items-center gl-white-space-nowrap' } do
|
||||
icon = image_tag image_path('illustrations/logos/jira.svg'), width: 15, height: 15, class: 'gl-mr-2'
|
||||
|
|
|
@ -63,8 +63,15 @@ module Projects
|
|||
# Make sure we're converting to symbols because
|
||||
# * ActionController::Parameters#keys returns a list of strings
|
||||
# * in specs we're using hashes with symbols as keys
|
||||
update_keys = settings.keys.map(&:to_sym)
|
||||
|
||||
settings.keys.map(&:to_sym) == %i[enabled]
|
||||
# Integrated error tracking works without Sentry integration,
|
||||
# so we don't need to update all those values from error_tracking_params_for_update method.
|
||||
# Instead we turn it on/off with partial update together with "enabled" attribute.
|
||||
# But since its optional, we exclude it from the condition below.
|
||||
update_keys.delete(:integrated)
|
||||
|
||||
update_keys == %i[enabled]
|
||||
end
|
||||
|
||||
def error_tracking_params_for_partial_update(settings)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: instance_level_integration_overrides
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66723
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/336750
|
||||
milestone: '14.2'
|
||||
type: development
|
||||
group: group::integrations
|
||||
default_enabled: false
|
|
@ -34,7 +34,8 @@ Example response:
|
|||
"active": true,
|
||||
"project_name": "sample sentry project",
|
||||
"sentry_external_url": "https://sentry.io/myawesomeproject/project",
|
||||
"api_url": "https://sentry.io/api/0/projects/myawesomeproject/project"
|
||||
"api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
|
||||
"integrated": false
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -46,10 +47,11 @@ The API allows you to enable or disable the Error Tracking settings for a projec
|
|||
PATCH /projects/:id/error_tracking/settings
|
||||
```
|
||||
|
||||
| Attribute | Type | Required | Description |
|
||||
| --------- | ------- | -------- | --------------------- |
|
||||
| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. |
|
||||
| `active` | boolean | yes | Pass `true` to enable the already configured error tracking settings or `false` to disable it. |
|
||||
| Attribute | Type | Required | Description |
|
||||
| ------------ | ------- | -------- | --------------------- |
|
||||
| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. |
|
||||
| `active` | boolean | yes | Pass `true` to enable the already configured error tracking settings or `false` to disable it. |
|
||||
| `integrated` | boolean | no | Pass `true` to enable the integrated error tracking backend. Available in [GitLab 14.2](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68260) and later. |
|
||||
|
||||
```shell
|
||||
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true"
|
||||
|
@ -62,6 +64,7 @@ Example response:
|
|||
"active": true,
|
||||
"project_name": "sample sentry project",
|
||||
"sentry_external_url": "https://sentry.io/myawesomeproject/project",
|
||||
"api_url": "https://sentry.io/api/0/projects/myawesomeproject/project"
|
||||
"api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
|
||||
"integrated": false
|
||||
}
|
||||
```
|
||||
|
|
|
@ -61,6 +61,18 @@ integration on all non-configured groups and projects by default.
|
|||
|
||||
Resetting an instance-level default setting removes the integration from all projects that have the integration set to use default settings.
|
||||
|
||||
### View projects that override the default settings
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218252) in GitLab 14.2.
|
||||
|
||||
You can view which projects in your instance use custom settings that [override the instance-level default settings](#use-custom-settings-for-a-group-or-project-integration)
|
||||
for an integration.
|
||||
|
||||
1. On the top bar, select **Menu >** **{admin}** **Admin**.
|
||||
1. In the left sidebar, select **Settings > Integrations**.
|
||||
1. Select an integration.
|
||||
1. Select the **Projects using custom settings** tab.
|
||||
|
||||
## Manage group-level default settings for a project integration
|
||||
|
||||
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2543) in GitLab 13.6.
|
||||
|
|
|
@ -1049,8 +1049,8 @@ When an API site type is selected, a [host override](#host-override) is used to
|
|||
#### Site profile validation
|
||||
|
||||
> - Site profile validation [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/233020) in GitLab 13.8.
|
||||
> - Meta tag validation [enabled on GitLab.com](https://gitlab.com/issue/etc) in GitLab 14.2 and is ready for production use.
|
||||
> - Meta tag validation [enabled with `dast_meta_tag_validation flag` flag](https://gitlab.com/issue/etc) for self-managed GitLab in GitLab 14.2 and is ready for production use.
|
||||
> - Meta tag validation [enabled on GitLab.com](https://gitlab.com/groups/gitlab-org/-/epics/6460) in GitLab 14.2 and is ready for production use.
|
||||
> - Meta tag validation [enabled with `dast_meta_tag_validation flag` flag](https://gitlab.com/gitlab-org/gitlab/-/issues/337711) for self-managed GitLab in GitLab 14.2 and is ready for production use.
|
||||
|
||||
FLAG:
|
||||
On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the `dast_meta_tag_validation` flag](../../../administration/feature_flags.md). On GitLab.com, this feature is available but can be configured by GitLab.com administrators only.
|
||||
|
|
|
@ -8,6 +8,7 @@ module API
|
|||
expose :project_name
|
||||
expose :sentry_external_url
|
||||
expose :api_url
|
||||
expose :integrated
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,6 +32,7 @@ module API
|
|||
end
|
||||
params do
|
||||
requires :active, type: Boolean, desc: 'Specifying whether to enable or disable error tracking settings', allow_blank: false
|
||||
optional :integrated, type: Boolean, desc: 'Specifying whether to enable or disable integrated error tracking'
|
||||
end
|
||||
|
||||
patch ':id/error_tracking/settings/' do
|
||||
|
@ -45,6 +46,10 @@ module API
|
|||
error_tracking_setting_attributes: { enabled: params[:active] }
|
||||
}
|
||||
|
||||
unless params[:integrated].nil?
|
||||
update_params[:error_tracking_setting_attributes][:integrated] = params[:integrated]
|
||||
end
|
||||
|
||||
result = ::Projects::Operations::UpdateService.new(user_project, current_user, update_params).execute
|
||||
|
||||
if result[:status] == :success
|
||||
|
|
|
@ -660,7 +660,7 @@ msgstr ""
|
|||
msgid "%{labelStart}Namespace:%{labelEnd} %{namespace}"
|
||||
msgstr ""
|
||||
|
||||
msgid "%{labelStart}Scan Type:%{labelEnd} %{reportType}"
|
||||
msgid "%{labelStart}Scanner:%{labelEnd} %{scanner}"
|
||||
msgstr ""
|
||||
|
||||
msgid "%{labelStart}Sent request:%{labelEnd} %{headers}"
|
||||
|
@ -669,7 +669,7 @@ msgstr ""
|
|||
msgid "%{labelStart}Severity:%{labelEnd} %{severity}"
|
||||
msgstr ""
|
||||
|
||||
msgid "%{labelStart}Tool:%{labelEnd} %{scanner}"
|
||||
msgid "%{labelStart}Tool:%{labelEnd} %{reportType}"
|
||||
msgstr ""
|
||||
|
||||
msgid "%{labelStart}Unmodified response:%{labelEnd} %{headers}"
|
||||
|
|
|
@ -131,18 +131,6 @@ RSpec.describe Admin::IntegrationsController do
|
|||
expect(response).to render_template 'shared/integrations/overrides'
|
||||
expect(assigns(:integration)).to eq(instance_integration)
|
||||
end
|
||||
|
||||
context 'when `instance_level_integration_overrides` is not enabled' do
|
||||
before do
|
||||
stub_feature_flags(instance_level_integration_overrides: false)
|
||||
end
|
||||
|
||||
it 'renders a 404' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,16 +19,4 @@ RSpec.describe 'User activates the instance-level Mattermost Slash Command integ
|
|||
expect(page).to have_link('Settings', href: edit_path)
|
||||
expect(page).to have_link('Projects using custom settings', href: overrides_path)
|
||||
end
|
||||
|
||||
context 'when instance_level_integration_overrides is disabled' do
|
||||
before do
|
||||
stub_feature_flags(instance_level_integration_overrides: false)
|
||||
visit_instance_integration('Mattermost slash commands')
|
||||
end
|
||||
|
||||
it 'does not display the overrides tab' do
|
||||
expect(page).not_to have_link('Settings', href: edit_path)
|
||||
expect(page).not_to have_link('Projects using custom settings', href: overrides_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,4 +13,9 @@ RSpec.describe 'User activates the group-level Mattermost Slash Command integrat
|
|||
let(:edit_path) { edit_group_settings_integration_path(group, :mattermost_slash_commands) }
|
||||
|
||||
include_examples 'user activates the Mattermost Slash Command integration'
|
||||
|
||||
it 'does not display the overrides tab' do
|
||||
expect(page).not_to have_link('Settings', href: edit_path)
|
||||
expect(page).not_to have_link('Projects using custom settings', href: overrides_admin_application_settings_integration_path(:mattermost_slash_commands))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,8 @@ RSpec.describe API::ErrorTracking do
|
|||
'active' => setting.reload.enabled,
|
||||
'project_name' => setting.project_name,
|
||||
'sentry_external_url' => setting.sentry_external_url,
|
||||
'api_url' => setting.api_url
|
||||
'api_url' => setting.api_url,
|
||||
'integrated' => setting.integrated
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -79,6 +80,19 @@ RSpec.describe API::ErrorTracking do
|
|||
.to eq('active is empty')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with integrated param' do
|
||||
let(:params) { { active: true, integrated: true } }
|
||||
|
||||
it 'updates the integrated flag' do
|
||||
expect(setting.integrated).to be_falsey
|
||||
|
||||
make_request
|
||||
|
||||
expect(json_response).to include('integrated' => true)
|
||||
expect(setting.reload.integrated).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'without a project setting' do
|
||||
|
|
|
@ -262,6 +262,31 @@ RSpec.describe Projects::Operations::UpdateService do
|
|||
expect(project.error_tracking_setting.previous_changes.keys)
|
||||
.to contain_exactly('enabled')
|
||||
end
|
||||
|
||||
context 'with integrated attribute' do
|
||||
let(:params) do
|
||||
{
|
||||
error_tracking_setting_attributes: {
|
||||
enabled: true,
|
||||
integrated: true
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
it 'updates integrated attribute' do
|
||||
expect { result }
|
||||
.to change { project.reload.error_tracking_setting.integrated }
|
||||
.from(false)
|
||||
.to(true)
|
||||
end
|
||||
|
||||
it 'only updates enabled and integrated attributes' do
|
||||
result
|
||||
|
||||
expect(project.error_tracking_setting.previous_changes.keys)
|
||||
.to contain_exactly('enabled', 'integrated')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'without setting' do
|
||||
|
|
Loading…
Reference in a new issue