Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
d6c434108c
commit
b96b6c1abd
|
|
@ -10,7 +10,7 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="gl-display-flex gl-align-items-center">
|
||||||
<span
|
<span
|
||||||
class="dropdown-label-box gl-flex-shrink-0 gl-top-0 gl-mr-3"
|
class="dropdown-label-box gl-flex-shrink-0 gl-top-0 gl-mr-3"
|
||||||
:style="{ 'background-color': label.color }"
|
:style="{ 'background-color': label.color }"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class Projects::MattermostsController < Projects::ApplicationController
|
||||||
|
|
||||||
if result
|
if result
|
||||||
flash[:notice] = 'This service is now configured'
|
flash[:notice] = 'This service is now configured'
|
||||||
redirect_to edit_project_service_path(@project, integration)
|
redirect_to edit_project_integration_path(@project, integration)
|
||||||
else
|
else
|
||||||
flash[:alert] = message || 'Failed to configure service'
|
flash[:alert] = message || 'Failed to configure service'
|
||||||
redirect_to new_project_mattermost_path(@project)
|
redirect_to new_project_mattermost_path(@project)
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ module Projects
|
||||||
)
|
)
|
||||||
|
|
||||||
if @metric.persisted?
|
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.')
|
notice: _('Metric was successfully added.')
|
||||||
else
|
else
|
||||||
render 'new'
|
render 'new'
|
||||||
|
|
@ -77,7 +77,7 @@ module Projects
|
||||||
@metric = update_metrics_service(prometheus_metric).execute
|
@metric = update_metrics_service(prometheus_metric).execute
|
||||||
|
|
||||||
if @metric.persisted?
|
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.')
|
notice: _('Metric was successfully updated.')
|
||||||
else
|
else
|
||||||
render 'edit'
|
render 'edit'
|
||||||
|
|
@ -93,7 +93,7 @@ module Projects
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
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
|
end
|
||||||
format.json do
|
format.json do
|
||||||
head :ok
|
head :ok
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ class Projects::ServiceHookLogsController < Projects::HookLogsController
|
||||||
|
|
||||||
def retry
|
def retry
|
||||||
execute_hook
|
execute_hook
|
||||||
redirect_to edit_project_service_path(@project, @integration)
|
redirect_to edit_project_integration_path(@project, @integration)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def integration
|
def integration
|
||||||
@integration ||= @project.find_or_initialize_integration(params[:service_id])
|
@integration ||= @project.find_or_initialize_integration(params[:integration_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
override :hook
|
override :hook
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class Projects::ServicesController < Projects::ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def redirect_path
|
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
|
end
|
||||||
|
|
||||||
def service_test_response
|
def service_test_response
|
||||||
|
|
@ -119,7 +119,7 @@ class Projects::ServicesController < Projects::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_deprecated_prometheus_integration
|
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
|
end
|
||||||
|
|
||||||
def set_deprecation_notice_for_prometheus_integration
|
def set_deprecation_notice_for_prometheus_integration
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module CustomMetricsHelper
|
||||||
{
|
{
|
||||||
'custom-metrics-path' => url_for([project, metric]),
|
'custom-metrics-path' => url_for([project, metric]),
|
||||||
'metric-persisted' => metric.persisted?.to_s,
|
'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),
|
'validate-query-path' => validate_query_project_prometheus_metrics_path(project),
|
||||||
'title' => metric.title.to_s,
|
'title' => metric.title.to_s,
|
||||||
'query' => metric.query.to_s,
|
'query' => metric.query.to_s,
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ module EnvironmentsHelper
|
||||||
return {} unless project
|
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),
|
'clusters_path' => project_clusters_path(project),
|
||||||
'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json),
|
'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json),
|
||||||
'default_branch' => project.default_branch,
|
'default_branch' => project.default_branch,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ module IntegrationsHelper
|
||||||
|
|
||||||
def scoped_integration_path(integration, project: nil, group: nil)
|
def scoped_integration_path(integration, project: nil, group: nil)
|
||||||
if project.present?
|
if project.present?
|
||||||
project_service_path(project, integration)
|
project_integration_path(project, integration)
|
||||||
elsif group.present?
|
elsif group.present?
|
||||||
group_settings_integration_path(group, integration)
|
group_settings_integration_path(group, integration)
|
||||||
else
|
else
|
||||||
|
|
@ -39,7 +39,7 @@ module IntegrationsHelper
|
||||||
|
|
||||||
def scoped_edit_integration_path(integration, project: nil, group: nil)
|
def scoped_edit_integration_path(integration, project: nil, group: nil)
|
||||||
if project.present?
|
if project.present?
|
||||||
edit_project_service_path(project, integration)
|
edit_project_integration_path(project, integration)
|
||||||
elsif group.present?
|
elsif group.present?
|
||||||
edit_group_settings_integration_path(group, integration)
|
edit_group_settings_integration_path(group, integration)
|
||||||
else
|
else
|
||||||
|
|
@ -53,7 +53,7 @@ module IntegrationsHelper
|
||||||
|
|
||||||
def scoped_test_integration_path(integration, project: nil, group: nil)
|
def scoped_test_integration_path(integration, project: nil, group: nil)
|
||||||
if project.present?
|
if project.present?
|
||||||
test_project_service_path(project, integration)
|
test_project_integration_path(project, integration)
|
||||||
elsif group.present?
|
elsif group.present?
|
||||||
test_group_settings_integration_path(group, integration)
|
test_group_settings_integration_path(group, integration)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1051,11 +1051,13 @@ module Ci
|
||||||
end
|
end
|
||||||
|
|
||||||
def drop_with_exit_code!(failure_reason, exit_code)
|
def drop_with_exit_code!(failure_reason, exit_code)
|
||||||
|
::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.allow_cross_database_modification_within_transaction(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/348495') do
|
||||||
transaction do
|
transaction do
|
||||||
conditionally_allow_failure!(exit_code)
|
conditionally_allow_failure!(exit_code)
|
||||||
drop!(failure_reason)
|
drop!(failure_reason)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def exit_codes_defined?
|
def exit_codes_defined?
|
||||||
options.dig(:allow_failure_criteria, :exit_codes).present?
|
options.dig(:allow_failure_criteria, :exit_codes).present?
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ class ServiceHookPresenter < Gitlab::View::Presenter::Delegated
|
||||||
presents ::ServiceHook, as: :service_hook
|
presents ::ServiceHook, as: :service_hook
|
||||||
|
|
||||||
def logs_details_path(log)
|
def logs_details_path(log)
|
||||||
project_service_hook_log_path(integration.project, integration, log)
|
project_integration_hook_log_path(integration.project, integration, log)
|
||||||
end
|
end
|
||||||
|
|
||||||
def logs_retry_path(log)
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
%td
|
%td
|
||||||
%strong
|
%strong
|
||||||
- if can?(current_user, :admin_project, project)
|
- 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
|
- else
|
||||||
= integration.title
|
= integration.title
|
||||||
%td
|
%td
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.js-jira-import-root{ data: { project_path: @project.full_path,
|
.js-jira-import-root{ data: { project_path: @project.full_path,
|
||||||
issues_path: project_issues_path(@project),
|
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,
|
is_jira_configured: @project.jira_integration&.configured?.to_s,
|
||||||
in_progress_illustration: image_path('illustrations/export-import.svg'),
|
in_progress_illustration: image_path('illustrations/export-import.svg'),
|
||||||
project_id: @project.id,
|
project_id: @project.id,
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,4 @@
|
||||||
and try again.
|
and try again.
|
||||||
%hr
|
%hr
|
||||||
.clearfix
|
.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'
|
||||||
|
|
|
||||||
|
|
@ -42,5 +42,5 @@
|
||||||
%hr
|
%hr
|
||||||
.clearfix
|
.clearfix
|
||||||
.float-right
|
.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'
|
= f.submit 'Install', class: 'gl-button btn btn-success btn-lg'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
|
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
|
||||||
- add_to_breadcrumbs _("Integrations"), project_settings_integrations_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')
|
- breadcrumb_title s_('Metrics|Edit metric')
|
||||||
- page_title @metric.title, s_('Metrics|Edit metric')
|
- page_title @metric.title, s_('Metrics|Edit metric')
|
||||||
= render 'form', project: @project, metric: @metric
|
= render 'form', project: @project, metric: @metric
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
|
- add_to_breadcrumbs _("Settings"), edit_project_path(@project)
|
||||||
- add_to_breadcrumbs _("Integrations"), project_settings_integrations_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')
|
- breadcrumb_title s_('Metrics|New metric')
|
||||||
- page_title s_('Metrics|New metric')
|
- page_title s_('Metrics|New metric')
|
||||||
= render 'form', project: @project, metric: @metric
|
= render 'form', project: @project, metric: @metric
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
- if integration.operating?
|
- if integration.operating?
|
||||||
= sprite_icon('check', css_class: 'gl-text-green-500')
|
= 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
|
= render 'shared/service_settings', form: form, integration: integration
|
||||||
%input{ id: 'services_redirect_to', type: 'hidden', name: 'redirect_to', value: request.referer }
|
%input{ id: 'services_redirect_to', type: 'hidden', name: 'redirect_to', value: request.referer }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
= create_link
|
= create_link
|
||||||
- if show_enable_confluence_integration?(@wiki.container)
|
- if show_enable_confluence_integration?(@wiki.container)
|
||||||
= link_to s_('WikiEmpty|Enable the Confluence Wiki integration'),
|
= 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')
|
class: 'btn gl-button', title: s_('WikiEmpty|Enable the Confluence Wiki integration')
|
||||||
|
|
||||||
- elsif @project && can?(current_user, :read_issue, @project)
|
- elsif @project && can?(current_user, :read_issue, @project)
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
|
resources :integrations, controller: :services, constraints: { id: %r{[^/]+} }, only: [:edit, :update] do
|
||||||
member do
|
member do
|
||||||
put :test
|
put :test
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2603,7 +2603,7 @@ Example response:
|
||||||
|
|
||||||
## Approvals
|
## 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
|
## List merge request state events
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
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
|
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
|
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).
|
- [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).
|
- [Import the project](../settings/import_export.md#import-a-project-and-its-data).
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ See [Prometheus cluster integration](../../clusters/integrations.md#prometheus-c
|
||||||
Integration with Prometheus requires the following:
|
Integration with Prometheus requires the following:
|
||||||
|
|
||||||
- Prometheus must be configured to collect one of the [supported metrics](prometheus_library/index.md)
|
- 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
|
- GitLab must have network connectivity to the Prometheus server
|
||||||
|
|
||||||
#### Getting started
|
#### Getting started
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,9 @@ RSpec.describe Projects::MattermostsController do
|
||||||
|
|
||||||
it 'redirects to the new page' do
|
it 'redirects to the new page' do
|
||||||
subject
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
|
||||||
|
|
||||||
expect(flash[:notice]).to include('Metric was successfully added.')
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -157,6 +157,22 @@ RSpec.describe Projects::Prometheus::MetricsController do
|
||||||
end
|
end
|
||||||
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
|
describe 'DELETE #destroy' do
|
||||||
context 'format html' do
|
context 'format html' do
|
||||||
let!(:metric) { create(:prometheus_metric, project: project) }
|
let!(:metric) { create(:prometheus_metric, project: project) }
|
||||||
|
|
@ -164,7 +180,7 @@ RSpec.describe Projects::Prometheus::MetricsController do
|
||||||
it 'destroys the metric' do
|
it 'destroys the metric' do
|
||||||
delete :destroy, params: project_params(id: metric.id)
|
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
|
expect(PrometheusMetric.find_by(id: metric.id)).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ RSpec.describe Projects::ServiceHookLogsController do
|
||||||
{
|
{
|
||||||
namespace_id: project.namespace,
|
namespace_id: project.namespace,
|
||||||
project_id: project,
|
project_id: project,
|
||||||
service_id: integration.to_param,
|
integration_id: integration.to_param,
|
||||||
id: log.id
|
id: log.id
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -44,7 +44,7 @@ RSpec.describe Projects::ServiceHookLogsController do
|
||||||
it 'executes the hook and redirects to the service form' do
|
it 'executes the hook and redirects to the service form' do
|
||||||
expect_any_instance_of(ServiceHook).to receive(:execute)
|
expect_any_instance_of(ServiceHook).to receive(:execute)
|
||||||
expect_any_instance_of(described_class).to receive(:set_hook_execution_notice)
|
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
|
end
|
||||||
|
|
||||||
it 'renders a 404 if the hook does not exist' do
|
it 'renders a 404 if the hook does not exist' do
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ RSpec.describe Projects::ServicesController do
|
||||||
let(:params) { project_params(service: integration_params) }
|
let(:params) { project_params(service: integration_params) }
|
||||||
|
|
||||||
let(:message) { 'Jira settings saved and active.' }
|
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
|
before do
|
||||||
stub_jira_integration_test
|
stub_jira_integration_test
|
||||||
|
|
@ -341,7 +341,7 @@ RSpec.describe Projects::ServicesController do
|
||||||
it 'redirects user back to edit page with alert' do
|
it 'redirects user back to edit page with alert' do
|
||||||
put :update, params: project_params.merge(service: integration_params)
|
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 = [
|
expected_alert = [
|
||||||
"You can now manage your Prometheus settings on the",
|
"You can now manage your Prometheus settings on the",
|
||||||
%(<a href="#{project_settings_operations_path(project)}">Operations</a> page.),
|
%(<a href="#{project_settings_operations_path(project)}">Operations</a> page.),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ RSpec.describe 'User activates Jira', :js do
|
||||||
|
|
||||||
it 'activates the Jira service' do
|
it 'activates the Jira service' do
|
||||||
expect(page).to have_content('Jira settings saved and active.')
|
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
|
||||||
|
|
||||||
unless Gitlab.ee?
|
unless Gitlab.ee?
|
||||||
|
|
@ -55,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do
|
||||||
click_test_then_save_integration
|
click_test_then_save_integration
|
||||||
|
|
||||||
expect(page).to have_content('Jira settings saved and active.')
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -72,7 +72,7 @@ RSpec.describe 'User activates Jira', :js do
|
||||||
|
|
||||||
it 'saves but does not activate the Jira service' do
|
it 'saves but does not activate the Jira service' do
|
||||||
expect(page).to have_content('Jira settings saved, but not active.')
|
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
|
end
|
||||||
|
|
||||||
it 'does not show the Jira link in the menu' do
|
it 'does not show the Jira link in the menu' do
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ RSpec.describe 'User activates issue tracker', :js do
|
||||||
|
|
||||||
it 'activates the service' do
|
it 'activates the service' do
|
||||||
expect(page).to have_content("#{tracker} settings saved and active.")
|
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
|
||||||
|
|
||||||
it 'shows the link in the menu' do
|
it 'shows the link in the menu' do
|
||||||
|
|
@ -58,7 +58,7 @@ RSpec.describe 'User activates issue tracker', :js do
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content("#{tracker} settings saved and active.")
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -73,7 +73,7 @@ RSpec.describe 'User activates issue tracker', :js do
|
||||||
|
|
||||||
it 'saves but does not activate the service' do
|
it 'saves but does not activate the service' do
|
||||||
expect(page).to have_content("#{tracker} settings saved, but not active.")
|
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
|
end
|
||||||
|
|
||||||
it 'does not show the external tracker link in the menu' do
|
it 'does not show the external tracker link in the menu' do
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do
|
||||||
let(:mattermost_enabled) { true }
|
let(:mattermost_enabled) { true }
|
||||||
|
|
||||||
describe 'activation' do
|
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'
|
include_examples 'user activates the Mattermost Slash Command integration'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ RSpec.describe 'User activates Slack notifications', :js do
|
||||||
pipeline_channel: 6,
|
pipeline_channel: 6,
|
||||||
wiki_page_channel: 7)
|
wiki_page_channel: 7)
|
||||||
|
|
||||||
visit(edit_project_service_path(project, integration))
|
visit(edit_project_integration_path(project, integration))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'filters events by channel' do
|
it 'filters events by channel' do
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do
|
||||||
click_active_checkbox
|
click_active_checkbox
|
||||||
click_on 'Save'
|
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.')
|
expect(page).to have_content('Slack slash commands settings saved, but not active.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do
|
||||||
fill_in 'Token', with: 'token'
|
fill_in 'Token', with: 'token'
|
||||||
click_on 'Save'
|
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.')
|
expect(page).to have_content('Slack slash commands settings saved and active.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ exports[`Dashboard template matches the default snapshot 1`] = `
|
||||||
emptynodatasvgpath="/images/illustrations/monitoring/no_data.svg"
|
emptynodatasvgpath="/images/illustrations/monitoring/no_data.svg"
|
||||||
emptyunabletoconnectsvgpath="/images/illustrations/monitoring/unable_to_connect.svg"
|
emptyunabletoconnectsvgpath="/images/illustrations/monitoring/unable_to_connect.svg"
|
||||||
selectedstate="gettingStarted"
|
selectedstate="gettingStarted"
|
||||||
settingspath="/monitoring/monitor-project/-/services/prometheus/edit"
|
settingspath="/monitoring/monitor-project/-/integrations/prometheus/edit"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ RSpec.describe EnvironmentsHelper do
|
||||||
|
|
||||||
it 'returns data' do
|
it 'returns data' do
|
||||||
expect(metrics_data).to include(
|
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),
|
'clusters_path' => project_clusters_path(project),
|
||||||
'metrics_dashboard_base_path' => environment_metrics_path(environment),
|
'metrics_dashboard_base_path' => environment_metrics_path(environment),
|
||||||
'current_environment_name' => environment.name,
|
'current_environment_name' => environment.name,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ RSpec.describe OperationsHelper do
|
||||||
expect(subject).to eq(
|
expect(subject).to eq(
|
||||||
'alerts_setup_url' => help_page_path('operations/incident_management/integrations.md', anchor: 'configuration'),
|
'alerts_setup_url' => help_page_path('operations/incident_management/integrations.md', anchor: 'configuration'),
|
||||||
'alerts_usage_url' => project_alert_management_index_path(project),
|
'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_reset_key_path' => reset_alerting_token_project_settings_operations_path(project),
|
||||||
'prometheus_authorization_key' => nil,
|
'prometheus_authorization_key' => nil,
|
||||||
'prometheus_api_url' => nil,
|
'prometheus_api_url' => nil,
|
||||||
|
|
|
||||||
|
|
@ -5223,6 +5223,26 @@ RSpec.describe Ci::Build do
|
||||||
it_behaves_like 'drops the build without changing allow_failure'
|
it_behaves_like 'drops the build without changing allow_failure'
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
describe '#exit_codes_defined?' do
|
describe '#exit_codes_defined?' do
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ RSpec.describe ServiceHookPresenter do
|
||||||
subject { service_hook.present.logs_details_path(web_hook_log) }
|
subject { service_hook.present.logs_details_path(web_hook_log) }
|
||||||
|
|
||||||
let(:expected_path) do
|
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
|
end
|
||||||
|
|
||||||
it { is_expected.to eq(expected_path) }
|
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) }
|
subject { service_hook.present.logs_retry_path(web_hook_log) }
|
||||||
|
|
||||||
let(:expected_path) do
|
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
|
end
|
||||||
|
|
||||||
it { is_expected.to eq(expected_path) }
|
it { is_expected.to eq(expected_path) }
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ RSpec.describe WebHookLogPresenter do
|
||||||
let(:web_hook) { create(:service_hook, integration: integration) }
|
let(:web_hook) { create(:service_hook, integration: integration) }
|
||||||
let(:integration) { create(:drone_ci_integration, project: project) }
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ RSpec.describe WebHookLogPresenter do
|
||||||
let(:web_hook) { create(:service_hook, integration: integration) }
|
let(:web_hook) { create(:service_hook, integration: integration) }
|
||||||
let(:integration) { create(:drone_ci_integration, project: project) }
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -188,13 +188,6 @@ RSpec.describe Ci::RetryBuildService do
|
||||||
expect(new_build).to be_pending
|
expect(new_build).to be_pending
|
||||||
end
|
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
|
context 'when there are subsequent processables that are skipped' do
|
||||||
let!(:subsequent_build) do
|
let!(:subsequent_build) do
|
||||||
create(:ci_build, :skipped, stage_idx: 2,
|
create(:ci_build, :skipped, stage_idx: 2,
|
||||||
|
|
@ -272,6 +265,17 @@ RSpec.describe Ci::RetryBuildService do
|
||||||
expect(bridge.reload).to be_pending
|
expect(bridge.reload).to be_pending
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
context 'when user does not have ability to execute build' do
|
context 'when user does not have ability to execute build' do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue