Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-12-30 18:13:34 +00:00
parent d6c434108c
commit b96b6c1abd
38 changed files with 105 additions and 63 deletions

View File

@ -10,7 +10,7 @@ export default {
</script>
<template>
<div>
<div class="gl-display-flex gl-align-items-center">
<span
class="dropdown-label-box gl-flex-shrink-0 gl-top-0 gl-mr-3"
:style="{ 'background-color': label.color }"

View File

@ -20,7 +20,7 @@ class Projects::MattermostsController < Projects::ApplicationController
if result
flash[:notice] = 'This service is now configured'
redirect_to edit_project_service_path(@project, integration)
redirect_to edit_project_integration_path(@project, integration)
else
flash[:alert] = message || 'Failed to configure service'
redirect_to new_project_mattermost_path(@project)

View File

@ -66,7 +66,7 @@ module Projects
)
if @metric.persisted?
redirect_to edit_project_service_path(project, ::Integrations::Prometheus),
redirect_to edit_project_integration_path(project, ::Integrations::Prometheus),
notice: _('Metric was successfully added.')
else
render 'new'
@ -77,7 +77,7 @@ module Projects
@metric = update_metrics_service(prometheus_metric).execute
if @metric.persisted?
redirect_to edit_project_service_path(project, ::Integrations::Prometheus),
redirect_to edit_project_integration_path(project, ::Integrations::Prometheus),
notice: _('Metric was successfully updated.')
else
render 'edit'
@ -93,7 +93,7 @@ module Projects
respond_to do |format|
format.html do
redirect_to edit_project_service_path(project, ::Integrations::Prometheus), status: :see_other
redirect_to edit_project_integration_path(project, ::Integrations::Prometheus), status: :see_other
end
format.json do
head :ok

View File

@ -7,13 +7,13 @@ class Projects::ServiceHookLogsController < Projects::HookLogsController
def retry
execute_hook
redirect_to edit_project_service_path(@project, @integration)
redirect_to edit_project_integration_path(@project, @integration)
end
private
def integration
@integration ||= @project.find_or_initialize_integration(params[:service_id])
@integration ||= @project.find_or_initialize_integration(params[:integration_id])
end
override :hook

View File

@ -66,7 +66,7 @@ class Projects::ServicesController < Projects::ApplicationController
private
def redirect_path
safe_redirect_path(params[:redirect_to]).presence || edit_project_service_path(project, integration)
safe_redirect_path(params[:redirect_to]).presence || edit_project_integration_path(project, integration)
end
def service_test_response
@ -119,7 +119,7 @@ class Projects::ServicesController < Projects::ApplicationController
end
def redirect_deprecated_prometheus_integration
redirect_to edit_project_service_path(project, integration) if integration.is_a?(::Integrations::Prometheus) && Feature.enabled?(:settings_operations_prometheus_service, project)
redirect_to edit_project_integration_path(project, integration) if integration.is_a?(::Integrations::Prometheus) && Feature.enabled?(:settings_operations_prometheus_service, project)
end
def set_deprecation_notice_for_prometheus_integration

View File

@ -5,7 +5,7 @@ module CustomMetricsHelper
{
'custom-metrics-path' => url_for([project, metric]),
'metric-persisted' => metric.persisted?.to_s,
'edit-project-service-path' => edit_project_service_path(project, ::Integrations::Prometheus),
'edit-project-service-path' => edit_project_integration_path(project, ::Integrations::Prometheus),
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
'title' => metric.title.to_s,
'query' => metric.query.to_s,

View File

@ -59,7 +59,7 @@ module EnvironmentsHelper
return {} unless project
{
'settings_path' => edit_project_service_path(project, 'prometheus'),
'settings_path' => edit_project_integration_path(project, 'prometheus'),
'clusters_path' => project_clusters_path(project),
'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json),
'default_branch' => project.default_branch,

View File

@ -29,7 +29,7 @@ module IntegrationsHelper
def scoped_integration_path(integration, project: nil, group: nil)
if project.present?
project_service_path(project, integration)
project_integration_path(project, integration)
elsif group.present?
group_settings_integration_path(group, integration)
else
@ -39,7 +39,7 @@ module IntegrationsHelper
def scoped_edit_integration_path(integration, project: nil, group: nil)
if project.present?
edit_project_service_path(project, integration)
edit_project_integration_path(project, integration)
elsif group.present?
edit_group_settings_integration_path(group, integration)
else
@ -53,7 +53,7 @@ module IntegrationsHelper
def scoped_test_integration_path(integration, project: nil, group: nil)
if project.present?
test_project_service_path(project, integration)
test_project_integration_path(project, integration)
elsif group.present?
test_group_settings_integration_path(group, integration)
else

View File

@ -1051,9 +1051,11 @@ module Ci
end
def drop_with_exit_code!(failure_reason, exit_code)
transaction do
conditionally_allow_failure!(exit_code)
drop!(failure_reason)
::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/348495') do
transaction do
conditionally_allow_failure!(exit_code)
drop!(failure_reason)
end
end
end

View File

@ -4,10 +4,10 @@ class ServiceHookPresenter < Gitlab::View::Presenter::Delegated
presents ::ServiceHook, as: :service_hook
def logs_details_path(log)
project_service_hook_log_path(integration.project, integration, log)
project_integration_hook_log_path(integration.project, integration, log)
end
def logs_retry_path(log)
retry_project_service_hook_log_path(integration.project, integration, log)
retry_project_integration_hook_log_path(integration.project, integration, log)
end
end

View File

@ -10,7 +10,7 @@
%td
%strong
- if can?(current_user, :admin_project, project)
= link_to integration.title, edit_project_service_path(project, integration)
= link_to integration.title, edit_project_integration_path(project, integration)
- else
= integration.title
%td

View File

@ -1,6 +1,6 @@
.js-jira-import-root{ data: { project_path: @project.full_path,
issues_path: project_issues_path(@project),
jira_integration_path: edit_project_service_path(@project, :jira),
jira_integration_path: edit_project_integration_path(@project, :jira),
is_jira_configured: @project.jira_integration&.configured?.to_s,
in_progress_illustration: image_path('illustrations/export-import.svg'),
project_id: @project.id,

View File

@ -15,4 +15,4 @@
and try again.
%hr
.clearfix
= link_to 'Go back', edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg float-right'
= link_to 'Go back', edit_project_integration_path(@project, @integration), class: 'gl-button btn btn-lg float-right'

View File

@ -42,5 +42,5 @@
%hr
.clearfix
.float-right
= link_to _('Cancel'), edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg'
= link_to _('Cancel'), edit_project_integration_path(@project, @integration), class: 'gl-button btn btn-lg'
= f.submit 'Install', class: 'gl-button btn btn-success btn-lg'

View File

@ -1,6 +1,6 @@
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
- add_to_breadcrumbs _("Integrations"), project_settings_integrations_path(@project)
- add_to_breadcrumbs "Prometheus", edit_project_service_path(@project, ::Integrations::Prometheus)
- add_to_breadcrumbs "Prometheus", edit_project_integration_path(@project, ::Integrations::Prometheus)
- breadcrumb_title s_('Metrics|Edit metric')
- page_title @metric.title, s_('Metrics|Edit metric')
= render 'form', project: @project, metric: @metric

View File

@ -1,6 +1,6 @@
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
- add_to_breadcrumbs _("Integrations"), project_settings_integrations_path(@project)
- add_to_breadcrumbs "Prometheus", edit_project_service_path(@project, ::Integrations::Prometheus)
- add_to_breadcrumbs "Prometheus", edit_project_integration_path(@project, ::Integrations::Prometheus)
- breadcrumb_title s_('Metrics|New metric')
- page_title s_('Metrics|New metric')
= render 'form', project: @project, metric: @metric

View File

@ -6,7 +6,7 @@
- if integration.operating?
= sprite_icon('check', css_class: 'gl-text-green-500')
= form_for(integration, as: :service, url: scoped_integration_path(integration, project: @project, group: @group), method: :put, html: { class: 'gl-show-field-errors integration-settings-form js-integration-settings-form', data: { 'test-url' => test_project_service_path(@project, integration) } }) do |form|
= form_for(integration, as: :service, url: scoped_integration_path(integration, project: @project, group: @group), method: :put, html: { class: 'gl-show-field-errors integration-settings-form js-integration-settings-form', data: { 'test-url' => test_project_integration_path(@project, integration) } }) do |form|
= render 'shared/service_settings', form: form, integration: integration
%input{ id: 'services_redirect_to', type: 'hidden', name: 'redirect_to', value: request.referer }

View File

@ -13,7 +13,7 @@
= create_link
- if show_enable_confluence_integration?(@wiki.container)
= link_to s_('WikiEmpty|Enable the Confluence Wiki integration'),
edit_project_service_path(@project, :confluence),
edit_project_integration_path(@project, :confluence),
class: 'btn gl-button', title: s_('WikiEmpty|Enable the Confluence Wiki integration')
- elsif @project && can?(current_user, :read_issue, @project)

View File

@ -212,7 +212,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
resources :integrations, controller: :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
member do
put :test
end

View File

@ -2603,7 +2603,7 @@ Example response:
## Approvals
For approvals, please see [Merge Request Approvals](merge_request_approvals.md)
For approvals, see [Merge Request Approvals](merge_request_approvals.md)
## List merge request state events

View File

@ -42,7 +42,7 @@ However, you can't import issues and merge requests this way. To retain all meta
merge requests, use the [import/export feature](../settings/import_export.md)
to export projects from self-managed GitLab and import those projects into GitLab.com. All GitLab
user associations (such as comment author) are changed to the user importing the project. For more
information, see the prerequisites and imporant notes in these sections:
information, see the prerequisites and important notes in these sections:
- [Export a project and its data](../settings/import_export.md#export-a-project-and-its-data).
- [Import the project](../settings/import_export.md#import-a-project-and-its-data).

View File

@ -40,7 +40,7 @@ See [Prometheus cluster integration](../../clusters/integrations.md#prometheus-c
Integration with Prometheus requires the following:
- Prometheus must be configured to collect one of the [supported metrics](prometheus_library/index.md)
- Each metric must be have a label to indicate the environment
- Each metric must have a label to indicate the environment
- GitLab must have network connectivity to the Prometheus server
#### Getting started

View File

@ -60,9 +60,9 @@ RSpec.describe Projects::MattermostsController do
it 'redirects to the new page' do
subject
service = project.integrations.last
integration = project.integrations.last
expect(subject).to redirect_to(edit_project_service_url(project, service))
expect(subject).to redirect_to(edit_project_integration_path(project, integration))
end
end
end

View File

@ -141,7 +141,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
expect(flash[:notice]).to include('Metric was successfully added.')
expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus))
expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
end
end
@ -157,6 +157,22 @@ RSpec.describe Projects::Prometheus::MetricsController do
end
end
describe 'PUT #update' do
context 'metric is updated' do
let_it_be(:metric) { create(:prometheus_metric, project: project) }
let(:metric_params) { { prometheus_metric: { title: 'new_title' }, id: metric.id } }
it 'shows a success flash message' do
put :update, params: project_params(metric_params)
expect(metric.reload.title).to eq('new_title')
expect(flash[:notice]).to include('Metric was successfully updated.')
expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
end
end
end
describe 'DELETE #destroy' do
context 'format html' do
let!(:metric) { create(:prometheus_metric, project: project) }
@ -164,7 +180,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
it 'destroys the metric' do
delete :destroy, params: project_params(id: metric.id)
expect(response).to redirect_to(edit_project_service_path(project, ::Integrations::Prometheus))
expect(response).to redirect_to(edit_project_integration_path(project, ::Integrations::Prometheus))
expect(PrometheusMetric.find_by(id: metric.id)).to be_nil
end
end

View File

@ -11,7 +11,7 @@ RSpec.describe Projects::ServiceHookLogsController do
{
namespace_id: project.namespace,
project_id: project,
service_id: integration.to_param,
integration_id: integration.to_param,
id: log.id
}
end
@ -44,7 +44,7 @@ RSpec.describe Projects::ServiceHookLogsController do
it 'executes the hook and redirects to the service form' do
expect_any_instance_of(ServiceHook).to receive(:execute)
expect_any_instance_of(described_class).to receive(:set_hook_execution_notice)
expect(subject).to redirect_to(edit_project_service_path(project, integration))
expect(subject).to redirect_to(edit_project_integration_path(project, integration))
end
it 'renders a 404 if the hook does not exist' do

View File

@ -183,7 +183,7 @@ RSpec.describe Projects::ServicesController do
let(:params) { project_params(service: integration_params) }
let(:message) { 'Jira settings saved and active.' }
let(:redirect_url) { edit_project_service_path(project, integration) }
let(:redirect_url) { edit_project_integration_path(project, integration) }
before do
stub_jira_integration_test
@ -341,7 +341,7 @@ RSpec.describe Projects::ServicesController do
it 'redirects user back to edit page with alert' do
put :update, params: project_params.merge(service: integration_params)
expect(response).to redirect_to(edit_project_service_path(project, integration))
expect(response).to redirect_to(edit_project_integration_path(project, integration))
expected_alert = [
"You can now manage your Prometheus settings on the",
%(<a href="#{project_settings_operations_path(project)}">Operations</a> page.),

View File

@ -20,7 +20,7 @@ RSpec.describe 'User activates Jira', :js do
it 'activates the Jira service' do
expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_service_path(project, :jira))
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
unless Gitlab.ee?
@ -55,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do
click_test_then_save_integration
expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_service_path(project, :jira))
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
end
end
@ -72,7 +72,7 @@ RSpec.describe 'User activates Jira', :js do
it 'saves but does not activate the Jira service' do
expect(page).to have_content('Jira settings saved, but not active.')
expect(current_path).to eq(edit_project_service_path(project, :jira))
expect(current_path).to eq(edit_project_integration_path(project, :jira))
end
it 'does not show the Jira link in the menu' do

View File

@ -34,7 +34,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'activates the service' do
expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_')))
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
it 'shows the link in the menu' do
@ -58,7 +58,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_')))
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
end
end
@ -73,7 +73,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'saves but does not activate the service' do
expect(page).to have_content("#{tracker} settings saved, but not active.")
expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_')))
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_')))
end
it 'does not show the external tracker link in the menu' do

View File

@ -15,7 +15,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
let(:mattermost_enabled) { true }
describe 'activation' do
let(:edit_path) { edit_project_service_path(project, :mattermost_slash_commands) }
let(:edit_path) { edit_project_integration_path(project, :mattermost_slash_commands) }
include_examples 'user activates the Mattermost Slash Command integration'
end

View File

@ -34,7 +34,7 @@ RSpec.describe 'User activates Slack notifications', :js do
pipeline_channel: 6,
wiki_page_channel: 7)
visit(edit_project_service_path(project, integration))
visit(edit_project_integration_path(project, integration))
end
it 'filters events by channel' do

View File

@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do
click_active_checkbox
click_on 'Save'
expect(current_path).to eq(edit_project_service_path(project, :slack_slash_commands))
expect(current_path).to eq(edit_project_integration_path(project, :slack_slash_commands))
expect(page).to have_content('Slack slash commands settings saved, but not active.')
end
@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do
fill_in 'Token', with: 'token'
click_on 'Save'
expect(current_path).to eq(edit_project_service_path(project, :slack_slash_commands))
expect(current_path).to eq(edit_project_integration_path(project, :slack_slash_commands))
expect(page).to have_content('Slack slash commands settings saved and active.')
end

View File

@ -128,7 +128,7 @@ exports[`Dashboard template matches the default snapshot 1`] = `
emptynodatasvgpath="/images/illustrations/monitoring/no_data.svg"
emptyunabletoconnectsvgpath="/images/illustrations/monitoring/unable_to_connect.svg"
selectedstate="gettingStarted"
settingspath="/monitoring/monitor-project/-/services/prometheus/edit"
settingspath="/monitoring/monitor-project/-/integrations/prometheus/edit"
/>
</div>
`;

View File

@ -18,7 +18,7 @@ RSpec.describe EnvironmentsHelper do
it 'returns data' do
expect(metrics_data).to include(
'settings_path' => edit_project_service_path(project, 'prometheus'),
'settings_path' => edit_project_integration_path(project, 'prometheus'),
'clusters_path' => project_clusters_path(project),
'metrics_dashboard_base_path' => environment_metrics_path(environment),
'current_environment_name' => environment.name,

View File

@ -32,7 +32,7 @@ RSpec.describe OperationsHelper do
expect(subject).to eq(
'alerts_setup_url' => help_page_path('operations/incident_management/integrations.md', anchor: 'configuration'),
'alerts_usage_url' => project_alert_management_index_path(project),
'prometheus_form_path' => project_service_path(project, prometheus_integration),
'prometheus_form_path' => project_integration_path(project, prometheus_integration),
'prometheus_reset_key_path' => reset_alerting_token_project_settings_operations_path(project),
'prometheus_authorization_key' => nil,
'prometheus_api_url' => nil,

View File

@ -5223,6 +5223,26 @@ RSpec.describe Ci::Build do
it_behaves_like 'drops the build without changing allow_failure'
end
end
context 'when build is configured to be retried' do
let(:options) { { retry: 3 } }
context 'when there is an MR attached to the pipeline and a failed job todo for that MR' do
let!(:merge_request) { create(:merge_request, source_project: project, author: user, head_pipeline: pipeline) }
let!(:todo) { create(:todo, :build_failed, user: user, project: project, author: user, target: merge_request) }
before do
build.update!(user: user)
project.add_developer(user)
end
it 'resolves the todo for the old failed build' do
expect do
drop_with_exit_code
end.to change { todo.reload.state }.from('pending').to('done')
end
end
end
end
describe '#exit_codes_defined?' do

View File

@ -12,7 +12,7 @@ RSpec.describe ServiceHookPresenter do
subject { service_hook.present.logs_details_path(web_hook_log) }
let(:expected_path) do
"/#{project.namespace.path}/#{project.name}/-/services/#{integration.to_param}/hook_logs/#{web_hook_log.id}"
"/#{project.namespace.path}/#{project.name}/-/integrations/#{integration.to_param}/hook_logs/#{web_hook_log.id}"
end
it { is_expected.to eq(expected_path) }
@ -22,7 +22,7 @@ RSpec.describe ServiceHookPresenter do
subject { service_hook.present.logs_retry_path(web_hook_log) }
let(:expected_path) do
"/#{project.namespace.path}/#{project.name}/-/services/#{integration.to_param}/hook_logs/#{web_hook_log.id}/retry"
"/#{project.namespace.path}/#{project.name}/-/integrations/#{integration.to_param}/hook_logs/#{web_hook_log.id}/retry"
end
it { is_expected.to eq(expected_path) }

View File

@ -21,7 +21,7 @@ RSpec.describe WebHookLogPresenter do
let(:web_hook) { create(:service_hook, integration: integration) }
let(:integration) { create(:drone_ci_integration, project: project) }
it { is_expected.to eq(project_service_hook_log_path(project, integration, web_hook_log)) }
it { is_expected.to eq(project_integration_hook_log_path(project, integration, web_hook_log)) }
end
end
@ -41,7 +41,7 @@ RSpec.describe WebHookLogPresenter do
let(:web_hook) { create(:service_hook, integration: integration) }
let(:integration) { create(:drone_ci_integration, project: project) }
it { is_expected.to eq(retry_project_service_hook_log_path(project, integration, web_hook_log)) }
it { is_expected.to eq(retry_project_integration_hook_log_path(project, integration, web_hook_log)) }
end
end
end

View File

@ -188,13 +188,6 @@ RSpec.describe Ci::RetryBuildService do
expect(new_build).to be_pending
end
it 'resolves todos for old build that failed' do
expect(::MergeRequests::AddTodoWhenBuildFailsService)
.to receive_message_chain(:new, :close)
service.execute(build)
end
context 'when there are subsequent processables that are skipped' do
let!(:subsequent_build) do
create(:ci_build, :skipped, stage_idx: 2,
@ -272,6 +265,17 @@ RSpec.describe Ci::RetryBuildService do
expect(bridge.reload).to be_pending
end
end
context 'when there is a failed job todo for the MR' do
let!(:merge_request) { create(:merge_request, source_project: project, author: user, head_pipeline: pipeline) }
let!(:todo) { create(:todo, :build_failed, user: user, project: project, author: user, target: merge_request) }
it 'resolves the todo for the old failed build' do
expect do
service.execute(build)
end.to change { todo.reload.state }.from('pending').to('done')
end
end
end
context 'when user does not have ability to execute build' do