Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-09-07 06:13:04 +00:00
parent 8f8e5017dd
commit 913224e81c
67 changed files with 1261 additions and 191 deletions

View File

@ -12,7 +12,7 @@ class Projects::GoogleCloud::BaseController < Projects::ApplicationController
def admin_project_google_cloud! def admin_project_google_cloud!
unless can?(current_user, :admin_project_google_cloud, project) unless can?(current_user, :admin_project_google_cloud, project)
track_event('admin_project_google_cloud!', 'error_access_denied', 'invalid_user') track_event(:error_invalid_user)
access_denied! access_denied!
end end
end end
@ -20,11 +20,7 @@ class Projects::GoogleCloud::BaseController < Projects::ApplicationController
def google_oauth2_enabled! def google_oauth2_enabled!
config = Gitlab::Auth::OAuth::Provider.config_for('google_oauth2') config = Gitlab::Auth::OAuth::Provider.config_for('google_oauth2')
if config.app_id.blank? || config.app_secret.blank? if config.app_id.blank? || config.app_secret.blank?
track_event( track_event(:error_google_oauth2_not_enabled)
'google_oauth2_enabled!',
'error_access_denied',
{ reason: 'google_oauth2_not_configured', config: config }
)
access_denied! 'This GitLab instance not configured for Google Oauth2.' access_denied! 'This GitLab instance not configured for Google Oauth2.'
end end
end end
@ -35,7 +31,7 @@ class Projects::GoogleCloud::BaseController < Projects::ApplicationController
enabled_for_project = Feature.enabled?(:incubation_5mp_google_cloud, project) enabled_for_project = Feature.enabled?(:incubation_5mp_google_cloud, project)
feature_is_enabled = enabled_for_user || enabled_for_group || enabled_for_project feature_is_enabled = enabled_for_user || enabled_for_group || enabled_for_project
unless feature_is_enabled unless feature_is_enabled
track_event('feature_flag_enabled!', 'error_access_denied', 'feature_flag_not_enabled') track_event(:error_feature_flag_not_enabled)
access_denied! access_denied!
end end
end end
@ -69,16 +65,14 @@ class Projects::GoogleCloud::BaseController < Projects::ApplicationController
session[GoogleApi::CloudPlatform::Client.session_key_for_expires_at] session[GoogleApi::CloudPlatform::Client.session_key_for_expires_at]
end end
def track_event(action, label, property) def track_event(action, label = nil)
options = { label: label, project: project, user: current_user } Gitlab::Tracking.event(
self.class.name,
if property.is_a?(String) action.to_s,
options[:property] = property label: label,
else project: project,
options[:extra] = property user: current_user
end )
Gitlab::Tracking.event('Projects::GoogleCloud', action, **options)
end end
def gcp_projects def gcp_projects

View File

@ -16,7 +16,7 @@ module Projects
revokeOauthUrl: revoke_oauth_url revokeOauthUrl: revoke_oauth_url
} }
@js_data = js_data.to_json @js_data = js_data.to_json
track_event('configuration#index', 'success', js_data) track_event(:render_page)
end end
private private

View File

@ -19,7 +19,7 @@ module Projects
} }
@js_data = js_data.to_json @js_data = js_data.to_json
track_event('databases#index', 'success', nil) track_event(:render_page)
end end
def new def new
@ -37,6 +37,7 @@ module Projects
tiers: Projects::GoogleCloud::CloudsqlHelper::TIERS tiers: Projects::GoogleCloud::CloudsqlHelper::TIERS
}.to_json }.to_json
track_event(:render_form)
render template: 'projects/google_cloud/databases/cloudsql_form', formats: :html render template: 'projects/google_cloud/databases/cloudsql_form', formats: :html
end end
@ -46,7 +47,7 @@ module Projects
.execute .execute
if enable_response[:status] == :error if enable_response[:status] == :error
track_event('databases#cloudsql_create', 'error_enable_cloudsql_service', enable_response) track_event(:error_enable_cloudsql_services)
flash[:error] = error_message(enable_response[:message]) flash[:error] = error_message(enable_response[:message])
else else
permitted_params = params.permit(:gcp_project, :ref, :database_version, :tier) permitted_params = params.permit(:gcp_project, :ref, :database_version, :tier)
@ -55,10 +56,10 @@ module Projects
.execute .execute
if create_response[:status] == :error if create_response[:status] == :error
track_event('databases#cloudsql_create', 'error_create_cloudsql_instance', create_response) track_event(:error_create_cloudsql_instance)
flash[:warning] = error_message(create_response[:message]) flash[:warning] = error_message(create_response[:message])
else else
track_event('databases#cloudsql_create', 'success', nil) track_event(:create_cloudsql_instance, permitted_params.to_s)
flash[:notice] = success_message flash[:notice] = success_message
end end
end end

View File

@ -12,7 +12,7 @@ class Projects::GoogleCloud::DeploymentsController < Projects::GoogleCloud::Base
enableCloudStorageUrl: project_google_cloud_deployments_cloud_storage_path(project) enableCloudStorageUrl: project_google_cloud_deployments_cloud_storage_path(project)
} }
@js_data = js_data.to_json @js_data = js_data.to_json
track_event('deployments#index', 'success', js_data) track_event(:render_page)
end end
def cloud_run def cloud_run
@ -21,7 +21,7 @@ class Projects::GoogleCloud::DeploymentsController < Projects::GoogleCloud::Base
.new(project, current_user, params).execute .new(project, current_user, params).execute
if enable_cloud_run_response[:status] == :error if enable_cloud_run_response[:status] == :error
track_event('deployments#cloud_run', 'error_enable_cloud_run', enable_cloud_run_response) track_event(:error_enable_services)
flash[:error] = enable_cloud_run_response[:message] flash[:error] = enable_cloud_run_response[:message]
redirect_to project_google_cloud_deployments_path(project) redirect_to project_google_cloud_deployments_path(project)
else else
@ -30,17 +30,17 @@ class Projects::GoogleCloud::DeploymentsController < Projects::GoogleCloud::Base
.new(project, current_user, params).execute .new(project, current_user, params).execute
if generate_pipeline_response[:status] == :error if generate_pipeline_response[:status] == :error
track_event('deployments#cloud_run', 'error_generate_pipeline', generate_pipeline_response) track_event(:error_generate_cloudrun_pipeline)
flash[:error] = 'Failed to generate pipeline' flash[:error] = 'Failed to generate pipeline'
redirect_to project_google_cloud_deployments_path(project) redirect_to project_google_cloud_deployments_path(project)
else else
cloud_run_mr_params = cloud_run_mr_params(generate_pipeline_response[:branch_name]) cloud_run_mr_params = cloud_run_mr_params(generate_pipeline_response[:branch_name])
track_event('deployments#cloud_run', 'success', cloud_run_mr_params) track_event(:generate_cloudrun_pipeline)
redirect_to project_new_merge_request_path(project, merge_request: cloud_run_mr_params) redirect_to project_new_merge_request_path(project, merge_request: cloud_run_mr_params)
end end
end end
rescue Google::Apis::ClientError, Google::Apis::ServerError, Google::Apis::AuthorizationError => e rescue Google::Apis::Error => e
track_event('deployments#cloud_run', 'error_gcp', e) track_event(:error_google_api)
flash[:warning] = _('Google Cloud Error - %{error}') % { error: e } flash[:warning] = _('Google Cloud Error - %{error}') % { error: e }
redirect_to project_google_cloud_deployments_path(project) redirect_to project_google_cloud_deployments_path(project)
end end

View File

@ -15,13 +15,13 @@ class Projects::GoogleCloud::GcpRegionsController < Projects::GoogleCloud::BaseC
cancelPath: project_google_cloud_configuration_path(project) cancelPath: project_google_cloud_configuration_path(project)
} }
@js_data = js_data.to_json @js_data = js_data.to_json
track_event('gcp_regions#index', 'success', js_data) track_event(:render_form)
end end
def create def create
permitted_params = params.permit(:ref, :gcp_region) permitted_params = params.permit(:ref, :gcp_region)
response = GoogleCloud::GcpRegionAddOrReplaceService.new(project).execute(permitted_params[:ref], permitted_params[:gcp_region]) GoogleCloud::GcpRegionAddOrReplaceService.new(project).execute(permitted_params[:ref], permitted_params[:gcp_region])
track_event('gcp_regions#create', 'success', response) track_event(:configure_region)
redirect_to project_google_cloud_configuration_path(project), notice: _('GCP region configured') redirect_to project_google_cloud_configuration_path(project), notice: _('GCP region configured')
end end
end end

View File

@ -9,10 +9,10 @@ class Projects::GoogleCloud::RevokeOauthController < Projects::GoogleCloud::Base
if response.success? if response.success?
redirect_message = { notice: s_('GoogleCloud|Google OAuth2 token revocation requested') } redirect_message = { notice: s_('GoogleCloud|Google OAuth2 token revocation requested') }
track_event('revoke_oauth#create', 'success', response.to_json) track_event(:revoke_oauth)
else else
redirect_message = { alert: s_('GoogleCloud|Google OAuth2 token revocation request failed') } redirect_message = { alert: s_('GoogleCloud|Google OAuth2 token revocation request failed') }
track_event('revoke_oauth#create', 'error', response.to_json) track_event(:error)
end end
session.delete(GoogleApi::CloudPlatform::Client.session_key_for_token) session.delete(GoogleApi::CloudPlatform::Client.session_key_for_token)

View File

@ -5,7 +5,7 @@ class Projects::GoogleCloud::ServiceAccountsController < Projects::GoogleCloud::
def index def index
if gcp_projects.empty? if gcp_projects.empty?
track_event('service_accounts#index', 'error_form', 'no_gcp_projects') track_event(:error_no_gcp_projects)
flash[:warning] = _('No Google Cloud projects - You need at least one Google Cloud project') flash[:warning] = _('No Google Cloud projects - You need at least one Google Cloud project')
redirect_to project_google_cloud_configuration_path(project) redirect_to project_google_cloud_configuration_path(project)
else else
@ -16,10 +16,10 @@ class Projects::GoogleCloud::ServiceAccountsController < Projects::GoogleCloud::
} }
@js_data = js_data.to_json @js_data = js_data.to_json
track_event('service_accounts#index', 'success', js_data) track_event(:render_form)
end end
rescue Google::Apis::ClientError, Google::Apis::ServerError, Google::Apis::AuthorizationError => e rescue Google::Apis::Error => e
track_event('service_accounts#index', 'error_gcp', e) track_event(:error_google_api)
flash[:warning] = _('Google Cloud Error - %{error}') % { error: e } flash[:warning] = _('Google Cloud Error - %{error}') % { error: e }
redirect_to project_google_cloud_configuration_path(project) redirect_to project_google_cloud_configuration_path(project)
end end
@ -35,10 +35,10 @@ class Projects::GoogleCloud::ServiceAccountsController < Projects::GoogleCloud::
environment_name: permitted_params[:ref] environment_name: permitted_params[:ref]
).execute ).execute
track_event('service_accounts#create', 'success', response) track_event(:create_service_account)
redirect_to project_google_cloud_configuration_path(project), notice: response.message redirect_to project_google_cloud_configuration_path(project), notice: response.message
rescue Google::Apis::ClientError, Google::Apis::ServerError, Google::Apis::AuthorizationError => e rescue Google::Apis::Error => e
track_event('service_accounts#create', 'error_gcp', e) track_event(:error_google_api)
flash[:warning] = _('Google Cloud Error - %{error}') % { error: e } flash[:warning] = _('Google Cloud Error - %{error}') % { error: e }
redirect_to project_google_cloud_configuration_path(project) redirect_to project_google_cloud_configuration_path(project)
end end

View File

@ -2,6 +2,7 @@
module Spam module Spam
module SpamConstants module SpamConstants
ERROR_TYPE = 'spamcheck'
BLOCK_USER = 'block' BLOCK_USER = 'block'
DISALLOW = 'disallow' DISALLOW = 'disallow'
CONDITIONAL_ALLOW = 'conditional_allow' CONDITIONAL_ALLOW = 'conditional_allow'

View File

@ -85,7 +85,7 @@ module Spam
[result, attribs] [result, attribs]
rescue StandardError => e rescue StandardError => e
Gitlab::ErrorTracking.log_exception(e) Gitlab::ErrorTracking.log_exception(e, error: ERROR_TYPE)
# Default to ALLOW if any errors occur # Default to ALLOW if any errors occur
[ALLOW, attribs, true] [ALLOW, attribs, true]

View File

@ -8,7 +8,7 @@
.col-lg-6 .col-lg-6
.card-new-merge-request .card-new-merge-request
%h2.gl-font-size-h2 %h2.gl-font-size-h2
Source branch = _('Source branch')
.clearfix .clearfix
.merge-request-select.dropdown .merge-request-select.dropdown
= f.hidden_field :source_project_id = f.hidden_field :source_project_id
@ -38,7 +38,7 @@
.col-lg-6 .col-lg-6
.card-new-merge-request .card-new-merge-request
%h2.gl-font-size-h2 %h2.gl-font-size-h2
Target branch = _('Target branch')
.clearfix .clearfix
- projects = target_projects(@project) - projects = target_projects(@project)
.merge-request-select.dropdown .merge-request-select.dropdown
@ -68,4 +68,4 @@
- if @merge_request.errors.any? - if @merge_request.errors.any?
= form_errors(@merge_request) = form_errors(@merge_request)
= f.submit 'Compare branches and continue', class: "gl-button btn btn-confirm mr-compare-btn gl-mt-4", data: { qa_selector: "compare_branches_button" } = f.submit _('Compare branches and continue'), class: "gl-button btn btn-confirm mr-compare-btn gl-mt-4", data: { qa_selector: "compare_branches_button" }

View File

@ -0,0 +1,26 @@
---
description: Invalid or unauthorized user
category: Projects::GoogleCloud::ConfigurationController
action: error_invalid_user
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google OAuth2 not enabled on GitLab instance
category: Projects::GoogleCloud::ConfigurationController
action: error_google_oauth2_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Feature flag not enabled on the GitLab instance
category: Projects::GoogleCloud::ConfigurationController
action: error_feature_flag_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Configuration page rendered
category: Projects::GoogleCloud::ConfigurationController
action: render_page
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Invalid or unauthorized user
category: Projects::GoogleCloud::ServiceAccountsController
action: error_invalid_user
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google OAuth2 not enabled on GitLab instance
category: Projects::GoogleCloud::ServiceAccountsController
action: error_google_oauth2_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Feature flag not enabled on the GitLab instance
category: Projects::GoogleCloud::ServiceAccountsController
action: error_feature_flag_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Service account form rendered
category: Projects::GoogleCloud::ServiceAccountsController
action: render_form
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: No GCP projects found for user
category: Projects::GoogleCloud::ServiceAccountsController
action: error_no_gcp_projects
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Service account created
category: Projects::GoogleCloud::ServiceAccountsController
action: create_service_account
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google API error
category: Projects::GoogleCloud::ServiceAccountsController
action: error_google_api
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Invalid or unauthorized user
category: Projects::GoogleCloud::GcpRegionsController
action: error_invalid_user
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google OAuth2 not enabled on GitLab instance
category: Projects::GoogleCloud::GcpRegionsController
action: error_google_oauth2_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Feature flag not enabled on the GitLab instance
category: Projects::GoogleCloud::GcpRegionsController
action: error_feature_flag_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: GCP regions configuration form rendered
category: Projects::GoogleCloud::GcpRegionsController
action: render_form
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: GCP region configured
category: Projects::GoogleCloud::GcpRegionsController
action: configure_region
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Failed to configure GCP region
category: Projects::GoogleCloud::GcpRegionsController
action: error_create
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Invalid or unauthorized user
category: Projects::GoogleCloud::RevokeOauthController
action: error_invalid_user
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google OAuth2 not enabled on GitLab instance
category: Projects::GoogleCloud::RevokeOauthController
action: error_google_oauth2_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Feature flag not enabled on the GitLab instance
category: Projects::GoogleCloud::RevokeOauthController
action: error_feature_flag_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: OAuth token revoked
category: Projects::GoogleCloud::RevokeOauthController
action: revoke_oauth
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Invalid or unauthorized user
category: Projects::GoogleCloud::DeploymentsController
action: error_invalid_user
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google OAuth2 not enabled on GitLab instance
category: Projects::GoogleCloud::DeploymentsController
action: error_google_oauth2_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Feature flag not enabled on the GitLab instance
category: Projects::GoogleCloud::DeploymentsController
action: error_feature_flag_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Deployments page rendered
category: Projects::GoogleCloud::DeploymentsController
action: render_page
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Cloud Run pipeline generated
category: Projects::GoogleCloud::DeploymentsController
action: generate_cloudrun_pipeline
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Failed to enable Cloud Run services
category: Projects::GoogleCloud::DeploymentsController
action: error_enable_cloudrun_services
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Failed to enable Cloud Run services
category: Projects::GoogleCloud::DeploymentsController
action: error_generate_cloudrun_pipeline
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google API error
category: Projects::GoogleCloud::DeploymentsController
action: error_google_api
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Invalid or unauthorized user
category: Projects::GoogleCloud::DatabasesController
action: error_invalid_user
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Google OAuth2 not enabled on GitLab instance
category: Projects::GoogleCloud::DatabasesController
action: error_google_oauth2_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Feature flag not enabled on the GitLab instance
category: Projects::GoogleCloud::DatabasesController
action: error_feature_flag_not_enabled
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Databases page rendered
category: Projects::GoogleCloud::DatabasesController
action: render_page
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Cloud SQL form rendered
category: Projects::GoogleCloud::DatabasesController
action: render_cloudsql_form
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Cloud SQL instance created
category: Projects::GoogleCloud::DatabasesController
action: create_cloudsql_instance
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Error enabling Cloud SQL services
category: Projects::GoogleCloud::DatabasesController
action: error_enable_cloudsql_services
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,26 @@
---
description: Error creating Cloud SQL instance
category: Projects::GoogleCloud::DatabasesController
action: error_create_cloudsql_instance
label_description:
property_description:
value_description:
extra_properties:
identifiers:
- project
- user
- namespace
product_section: google_cloud
product_stage: configure
product_group: group::incubation
product_category: cloud_seed
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96683"
distributions:
- ce
- ee
tiers:
- free
- premium
- ultimate

View File

@ -0,0 +1,8 @@
---
name: bypass_batch_pop_queueing_for_merge_trains
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96793
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372366
milestone: '15.4'
type: development
group: group::scalability
default_enabled: false

View File

@ -8,10 +8,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w
GitLab administrators can modify user settings for the entire GitLab instance. GitLab administrators can modify user settings for the entire GitLab instance.
## Prevent users from creating top-level groups ## Prevent new users from creating top-level groups
By default, new users can create top-level groups. To disable your users' By default, new users can create top-level groups. To disable new users'
ability to create top-level groups: ability to create top-level groups (does not affect existing users' setting):
**Omnibus GitLab installations** **Omnibus GitLab installations**
@ -33,6 +33,13 @@ ability to create top-level groups:
1. [Restart GitLab](restart_gitlab.md#installations-from-source). 1. [Restart GitLab](restart_gitlab.md#installations-from-source).
### Prevent existing users from creating top-level groups
Administrators can:
- Use the Admin Area to [prevent an existing user from creating top-level groups](../user/admin_area/index.md#prevent-a-user-from-creating-groups).
- Use the [modify an existing user API endpoint](../api/users.md#user-modification) to change the `can_create_group` setting.
## Prevent users from changing their usernames ## Prevent users from changing their usernames
By default, new users can change their usernames. To disable your users' By default, new users can change their usernames. To disable your users'

View File

@ -926,7 +926,7 @@ Transfer a group to a new parent group or turn a subgroup to a top-level group.
- With the Owner role for the group to transfer. - With the Owner role for the group to transfer.
- With permission to [create a subgroup](../user/group/subgroups/index.md#create-a-subgroup) in the new parent group if transferring a group. - With permission to [create a subgroup](../user/group/subgroups/index.md#create-a-subgroup) in the new parent group if transferring a group.
- With [permission to create a top-level group](../administration/user_settings.md#prevent-users-from-creating-top-level-groups) if turning a subgroup into a top-level group. - With [permission to create a top-level group](../administration/user_settings.md) if turning a subgroup into a top-level group.
```plaintext ```plaintext
POST /groups/:id/transfer POST /groups/:id/transfer

View File

@ -320,7 +320,7 @@ team members can join the Zoom call without requesting a link.
## Linked resources ## Linked resources
In an incident, you can [links to various resources](linked_resources.md), In an incident, you can add [links to various resources](linked_resources.md),
for example: for example:
- The incident Slack channel - The incident Slack channel

View File

@ -50,11 +50,27 @@ To add a linked resource:
1. Complete the required fields. 1. Complete the required fields.
1. Select **Add**. 1. Select **Add**.
### Link Zoom meetings from an incident **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230853) in GitLab 15.4.
Use the `/zoom` [quick action](../../user/project/quick_actions.md) to add multiple Zoom links to an incident:
```plaintext
/zoom https://example.zoom.us/j/123456789
```
You can also submit a short optional description with the link. The description shows instead of the URL in the **Linked resources** section of the incident issue:
```plaintext
/zoom https://example.zoom.us/j/123456789, Low on memory incident
```
## Remove a linked resource ## Remove a linked resource
You can also remove a linked resource. You can also remove a linked resource.
Prerequisities: Prerequisites:
- You must have at least the Reporter role for the project. - You must have at least the Reporter role for the project.

View File

@ -8,8 +8,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16609) in GitLab 12.4. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16609) in GitLab 12.4.
In order to communicate synchronously for incidents management, To communicate synchronously for incidents management,
GitLab allows to associate a Zoom meeting with an issue. you can associate a Zoom meeting with an issue.
After you start a Zoom call for a fire-fight, you need a way to After you start a Zoom call for a fire-fight, you need a way to
associate the conference call with an issue. This is so that your associate the conference call with an issue. This is so that your
team members can join swiftly without requesting a link. team members can join swiftly without requesting a link.
@ -36,6 +36,9 @@ You are only allowed to attach a single Zoom meeting to an issue. If you attempt
to add a second Zoom meeting using the `/zoom` quick action, it doesn't work. You to add a second Zoom meeting using the `/zoom` quick action, it doesn't work. You
need to [remove it](#removing-an-existing-zoom-meeting-from-an-issue) first. need to [remove it](#removing-an-existing-zoom-meeting-from-an-issue) first.
Users on GitLab Premium and higher can also
[add multiple Zoom links to incidents](../../../operations/incident_management/linked_resources.md#link-zoom-meetings-from-an-incident).
## Removing an existing Zoom meeting from an issue ## Removing an existing Zoom meeting from an issue
Similarly to adding a Zoom meeting, you can remove it with a quick action: Similarly to adding a Zoom meeting, you can remove it with a quick action:

View File

@ -100,7 +100,7 @@ threads. Some quick actions might not be available to all subscription tiers.
| `/remove_milestone` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove milestone. | | `/remove_milestone` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove milestone. |
| `/remove_parent_epic` | **{dotted-circle}** No | **{dotted-circle}** No | **{check-circle}** Yes | Remove parent epic from epic ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10556) in GitLab 12.1). | | `/remove_parent_epic` | **{dotted-circle}** No | **{dotted-circle}** No | **{check-circle}** Yes | Remove parent epic from epic ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10556) in GitLab 12.1). |
| `/remove_time_spent` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove time spent. | | `/remove_time_spent` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove time spent. |
| `/remove_zoom` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Remove Zoom meeting from this issue ([introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16609) in GitLab 12.4). | | `/remove_zoom` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Remove Zoom meeting from this issue. |
| `/reopen` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Reopen. | | `/reopen` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Reopen. |
| `/severity <severity>` | **{check-circle}** Yes | **{check-circle}** No | **{check-circle}** No | Set the severity. Options for `<severity>` are `S1` ... `S4`, `critical`, `high`, `medium`, `low`, `unknown`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/334045) in GitLab 14.2. | | `/severity <severity>` | **{check-circle}** Yes | **{check-circle}** No | **{check-circle}** No | Set the severity. Options for `<severity>` are `S1` ... `S4`, `critical`, `high`, `medium`, `low`, `unknown`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/334045) in GitLab 14.2. |
| `/shrug <comment>` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Append the comment with `¯\_(ツ)_/¯`. | | `/shrug <comment>` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Append the comment with `¯\_(ツ)_/¯`. |
@ -121,7 +121,7 @@ threads. Some quick actions might not be available to all subscription tiers.
| `/unlock` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Unlock the discussions. | | `/unlock` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Unlock the discussions. |
| `/unsubscribe` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Unsubscribe from notifications. | | `/unsubscribe` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Unsubscribe from notifications. |
| `/weight <value>` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Set weight. Valid options for `<value>` include `0`, `1`, `2`, and so on. | | `/weight <value>` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Set weight. Valid options for `<value>` include `0`, `1`, `2`, and so on. |
| `/zoom <Zoom URL>` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Add Zoom meeting to this issue ([introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16609) in GitLab 12.4). | | `/zoom <Zoom URL>` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Add a Zoom meeting to this issue or incident. In [GitLab 15.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/230853) users on GitLab Premium can add a short description when [adding a Zoom link to an incident](../../operations/incident_management/linked_resources.md#link-zoom-meetings-from-an-incident).|
## Commit messages ## Commit messages

View File

@ -27,9 +27,33 @@ module API
end end
end end
end end
resources 'batched_background_migrations/:id/resume' do
desc 'Resume a batched background migration'
params do
optional :database,
type: String,
values: Gitlab::Database.all_database_names,
desc: 'The name of the database',
default: 'main'
requires :id,
type: Integer,
desc: 'The batched background migration id'
end
put do
Gitlab::Database::SharedModel.using_connection(base_model.connection) do
batched_background_migration.execute!
present_entity(batched_background_migration)
end
end
end
end end
helpers do helpers do
def batched_background_migration
@batched_background_migration ||= Gitlab::Database::BackgroundMigration::BatchedMigration.find(params[:id])
end
def base_model def base_model
database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME
@base_model ||= Gitlab::Database.database_base_models[database] @base_model ||= Gitlab::Database.database_base_models[database]

View File

@ -207,19 +207,22 @@ module Gitlab
desc { _('Add Zoom meeting') } desc { _('Add Zoom meeting') }
explanation { _('Adds a Zoom meeting.') } explanation { _('Adds a Zoom meeting.') }
params '<Zoom URL>' params do
zoom_link_params
end
types Issue types Issue
condition do condition do
@zoom_service = zoom_link_service @zoom_service = zoom_link_service
@zoom_service.can_add_link? @zoom_service.can_add_link?
end end
parse_params do |link| parse_params do |link_params|
@zoom_service.parse_link(link) @zoom_service.parse_link(link_params)
end end
command :zoom do |link| command :zoom do |link, link_text = nil|
result = @zoom_service.add_link(link) result = add_zoom_link(link, link_text)
@execution_message[:zoom] = result.message @execution_message[:zoom] = result.message
@updates.merge!(result.payload) if result.payload merge_updates(result, @updates)
end end
desc { _('Remove Zoom meeting') } desc { _('Remove Zoom meeting') }
@ -314,12 +317,24 @@ module Gitlab
command :remove_contacts do |contact_emails| command :remove_contacts do |contact_emails|
@updates[:remove_contacts] = contact_emails.split(' ') @updates[:remove_contacts] = contact_emails.split(' ')
end end
end
private private
def zoom_link_service def zoom_link_service
::Issues::ZoomLinkService.new(project: quick_action_target.project, current_user: current_user, params: { issue: quick_action_target }) ::Issues::ZoomLinkService.new(project: quick_action_target.project, current_user: current_user, params: { issue: quick_action_target })
end end
def zoom_link_params
'<Zoom URL>'
end
def add_zoom_link(link, _link_text)
zoom_link_service.add_link(link)
end
def merge_updates(result, update_hash)
update_hash.merge!(result.payload) if result.payload
end end
end end
end end

View File

@ -34,7 +34,7 @@ module Gitlab
end end
def spam?(spammable:, user:, context: {}, extra_features: {}) def spam?(spammable:, user:, context: {}, extra_features: {})
metadata = { 'authorization' => Gitlab::CurrentSettings.spam_check_api_key } metadata = { 'authorization' => Gitlab::CurrentSettings.spam_check_api_key || '' }
protobuf_args = { spammable: spammable, user: user, context: context, extra_features: extra_features } protobuf_args = { spammable: spammable, user: user, context: context, extra_features: extra_features }
pb, grpc_method = build_protobuf(**protobuf_args) pb, grpc_method = build_protobuf(**protobuf_args)

View File

@ -9575,6 +9575,9 @@ msgstr ""
msgid "Compare Revisions" msgid "Compare Revisions"
msgstr "" msgstr ""
msgid "Compare branches and continue"
msgstr ""
msgid "Compare changes" msgid "Compare changes"
msgstr "" msgstr ""

View File

@ -49,6 +49,6 @@ describe('ItemTitle', () => {
findInputEl().element.innerText = mockUpdatedTitle; findInputEl().element.innerText = mockUpdatedTitle;
await findInputEl().trigger(sourceEvent); await findInputEl().trigger(sourceEvent);
expect(wrapper.emitted(eventName)).toBeTruthy(); expect(wrapper.emitted(eventName)).toBeDefined();
}); });
}); });

View File

@ -75,4 +75,52 @@ RSpec.describe API::Admin::BatchedBackgroundMigrations do
end end
end end
end end
describe 'PUT /admin/batched_background_migrations/:id/resume' do
let!(:migration) { create(:batched_background_migration, :paused) }
let(:database) { :main }
subject(:resume) do
put api("/admin/batched_background_migrations/#{migration.id}/resume", admin), params: { database: database }
end
it 'pauses the batched background migration' do
resume
aggregate_failures "testing response" do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['id']).to eq(migration.id)
expect(json_response['status']).to eq('active')
end
end
context 'when the batched background migration does not exist' do
let(:params) { { database: database } }
it 'returns 404' do
put api("/admin/batched_background_migrations/#{non_existing_record_id}/pause", admin), params: params
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when multiple database is enabled', :add_ci_connection do
let(:ci_model) { Ci::ApplicationRecord }
let(:database) { :ci }
it 'uses the correct connection' do
expect(Gitlab::Database::SharedModel).to receive(:using_connection).with(ci_model.connection).and_yield
resume
end
end
context 'when authenticated as a non-admin user' do
it 'returns 403' do
get api('/admin/batched_background_migrations', unauthorized_user)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
end
end end

View File

@ -26,10 +26,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do
get url get url
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ConfigurationController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: unauthorized_member user: unauthorized_member
) )
@ -65,11 +64,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ConfigurationController',
action: 'google_oauth2_enabled!', action: 'error_google_oauth2_not_enabled',
label: 'error_access_denied', label: nil,
extra: { reason: 'google_oauth2_not_configured',
config: unconfigured_google_oauth2 },
project: project, project: project,
user: authorized_member user: authorized_member
) )
@ -90,10 +87,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ConfigurationController',
action: 'feature_flag_enabled!', action: 'error_feature_flag_not_enabled',
label: 'error_access_denied', label: nil,
property: 'feature_flag_not_enabled',
project: project, project: project,
user: authorized_member user: authorized_member
) )
@ -114,20 +110,9 @@ RSpec.describe Projects::GoogleCloud::ConfigurationController do
expect(response).to be_successful expect(response).to be_successful
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ConfigurationController',
action: 'configuration#index', action: 'render_page',
label: 'success', label: nil,
extra: {
configurationUrl: project_google_cloud_configuration_path(project),
deploymentsUrl: project_google_cloud_deployments_path(project),
databasesUrl: project_google_cloud_databases_path(project),
serviceAccounts: [],
createServiceAccountUrl: project_google_cloud_service_accounts_path(project),
emptyIllustrationUrl: ActionController::Base.helpers.image_path('illustrations/pipelines_empty.svg'),
configureGcpRegionsUrl: project_google_cloud_gcp_regions_path(project),
gcpRegions: [],
revokeOauthUrl: nil
},
project: project, project: project,
user: authorized_member user: authorized_member
) )

View File

@ -105,10 +105,9 @@ RSpec.describe Projects::GoogleCloud::DatabasesController, :snowplow do
expect(response).to redirect_to(project_google_cloud_databases_path(project)) expect(response).to redirect_to(project_google_cloud_databases_path(project))
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DatabasesController',
action: 'databases#cloudsql_create', action: 'error_enable_cloudsql_services',
label: 'error_enable_cloudsql_service', label: nil,
extra: { status: :error, message: 'error' },
project: project, project: project,
user: user user: user
) )
@ -133,10 +132,9 @@ RSpec.describe Projects::GoogleCloud::DatabasesController, :snowplow do
expect(response).to redirect_to(project_google_cloud_databases_path(project)) expect(response).to redirect_to(project_google_cloud_databases_path(project))
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DatabasesController',
action: 'databases#cloudsql_create', action: 'error_create_cloudsql_instance',
label: 'error_create_cloudsql_instance', label: nil,
extra: { status: :error, message: 'error' },
project: project, project: project,
user: user user: user
) )
@ -156,10 +154,9 @@ RSpec.describe Projects::GoogleCloud::DatabasesController, :snowplow do
expect(response).to redirect_to(project_google_cloud_databases_path(project)) expect(response).to redirect_to(project_google_cloud_databases_path(project))
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DatabasesController',
action: 'databases#cloudsql_create', action: 'create_cloudsql_instance',
label: 'success', label: "{}",
extra: nil,
project: project, project: project,
user: user user: user
) )

View File

@ -29,10 +29,9 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DeploymentsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: nil user: nil
) )
@ -48,10 +47,9 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DeploymentsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: nil user: nil
) )
@ -75,6 +73,30 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
end end
end end
describe 'Authorized GET project/-/google_cloud/deployments', :snowplow do
before do
sign_in(user_maintainer)
allow_next_instance_of(GoogleApi::CloudPlatform::Client) do |client|
allow(client).to receive(:validate_token).and_return(true)
end
end
it 'renders template' do
get "#{project_google_cloud_deployments_path(project)}"
expect(response).to render_template(:index)
expect_snowplow_event(
category: 'Projects::GoogleCloud::DeploymentsController',
action: 'render_page',
label: nil,
project: project,
user: user_maintainer
)
end
end
describe 'Authorized GET project/-/google_cloud/deployments/cloud_run', :snowplow do describe 'Authorized GET project/-/google_cloud/deployments/cloud_run', :snowplow do
let_it_be(:url) { "#{project_google_cloud_deployments_cloud_run_path(project)}" } let_it_be(:url) { "#{project_google_cloud_deployments_cloud_run_path(project)}" }
@ -92,11 +114,9 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
expect(response).to redirect_to(project_google_cloud_deployments_path(project)) expect(response).to redirect_to(project_google_cloud_deployments_path(project))
# since GPC_PROJECT_ID is not set, enable cloud run service should return an error # since GPC_PROJECT_ID is not set, enable cloud run service should return an error
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DeploymentsController',
action: 'deployments#cloud_run', action: 'error_enable_services',
label: 'error_enable_cloud_run', label: nil,
extra: { message: 'No GCP projects found. Configure a service account or GCP_PROJECT_ID ci variable.',
status: :error },
project: project, project: project,
user: user_maintainer user: user_maintainer
) )
@ -113,10 +133,9 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
expect(response).to redirect_to(project_google_cloud_deployments_path(project)) expect(response).to redirect_to(project_google_cloud_deployments_path(project))
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DeploymentsController',
action: 'deployments#cloud_run', action: 'error_google_api',
label: 'error_gcp', label: nil,
extra: mock_gcp_error,
project: project, project: project,
user: user_maintainer user: user_maintainer
) )
@ -136,10 +155,9 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
expect(response).to redirect_to(project_google_cloud_deployments_path(project)) expect(response).to redirect_to(project_google_cloud_deployments_path(project))
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DeploymentsController',
action: 'deployments#cloud_run', action: 'error_generate_cloudrun_pipeline',
label: 'error_generate_pipeline', label: nil,
extra: { status: :error },
project: project, project: project,
user: user_maintainer user: user_maintainer
) )
@ -159,15 +177,9 @@ RSpec.describe Projects::GoogleCloud::DeploymentsController do
expect(response).to have_gitlab_http_status(:found) expect(response).to have_gitlab_http_status(:found)
expect(response.location).to include(project_new_merge_request_path(project)) expect(response.location).to include(project_new_merge_request_path(project))
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::DeploymentsController',
action: 'deployments#cloud_run', action: 'generate_cloudrun_pipeline',
label: 'success', label: nil,
extra: { "title": "Enable deployments to Cloud Run",
"description": "This merge request includes a Cloud Run deployment job in the pipeline definition (.gitlab-ci.yml).\n\nThe `deploy-to-cloud-run` job:\n* Requires the following environment variables\n * `GCP_PROJECT_ID`\n * `GCP_SERVICE_ACCOUNT_KEY`\n* Job definition can be found at: https://gitlab.com/gitlab-org/incubation-engineering/five-minute-production/library\n\nThis pipeline definition has been committed to the branch ``.\nYou may modify the pipeline definition further or accept the changes as-is if suitable.\n",
"source_project_id": project.id,
"target_project_id": project.id,
"source_branch": nil,
"target_branch": project.default_branch },
project: project, project: project,
user: user_maintainer user: user_maintainer
) )

View File

@ -13,10 +13,9 @@ RSpec.describe Projects::GoogleCloud::GcpRegionsController do
it "tracks event" do it "tracks event" do
is_expected.to be(404) is_expected.to be(404)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::GcpRegionsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: nil user: nil
) )
@ -27,10 +26,9 @@ RSpec.describe Projects::GoogleCloud::GcpRegionsController do
it "tracks event" do it "tracks event" do
is_expected.to be(404) is_expected.to be(404)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::GcpRegionsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: nil user: nil
) )
@ -41,10 +39,9 @@ RSpec.describe Projects::GoogleCloud::GcpRegionsController do
it "tracks event" do it "tracks event" do
is_expected.to be(404) is_expected.to be(404)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::GcpRegionsController',
action: 'feature_flag_enabled!', action: 'error_feature_flag_not_enabled',
label: 'error_access_denied', label: nil,
property: 'feature_flag_not_enabled',
project: project, project: project,
user: user_maintainer user: user_maintainer
) )
@ -55,10 +52,9 @@ RSpec.describe Projects::GoogleCloud::GcpRegionsController do
it "tracks event" do it "tracks event" do
is_expected.to be(403) is_expected.to be(403)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::GcpRegionsController',
action: 'google_oauth2_enabled!', action: 'error_google_oauth2_not_enabled',
label: 'error_access_denied', label: nil,
extra: { reason: 'google_oauth2_not_configured', config: config },
project: project, project: project,
user: user_maintainer user: user_maintainer
) )

View File

@ -50,10 +50,9 @@ RSpec.describe Projects::GoogleCloud::RevokeOauthController do
expect(response).to redirect_to(project_google_cloud_configuration_path(project)) expect(response).to redirect_to(project_google_cloud_configuration_path(project))
expect(flash[:notice]).to eq('Google OAuth2 token revocation requested') expect(flash[:notice]).to eq('Google OAuth2 token revocation requested')
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::RevokeOauthController',
action: 'revoke_oauth#create', action: 'revoke_oauth',
label: 'success', label: nil,
property: '{}',
project: project, project: project,
user: user user: user
) )
@ -73,10 +72,9 @@ RSpec.describe Projects::GoogleCloud::RevokeOauthController do
expect(response).to redirect_to(project_google_cloud_configuration_path(project)) expect(response).to redirect_to(project_google_cloud_configuration_path(project))
expect(flash[:alert]).to eq('Google OAuth2 token revocation request failed') expect(flash[:alert]).to eq('Google OAuth2 token revocation request failed')
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::RevokeOauthController',
action: 'revoke_oauth#create', action: 'error',
label: 'error', label: nil,
property: '{}',
project: project, project: project,
user: user user: user
) )

View File

@ -30,10 +30,9 @@ RSpec.describe Projects::GoogleCloud::ServiceAccountsController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ServiceAccountsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: nil user: nil
) )
@ -53,10 +52,9 @@ RSpec.describe Projects::GoogleCloud::ServiceAccountsController do
get url get url
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ServiceAccountsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: unauthorized_member user: unauthorized_member
) )
@ -71,10 +69,9 @@ RSpec.describe Projects::GoogleCloud::ServiceAccountsController do
post url post url
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ServiceAccountsController',
action: 'admin_project_google_cloud!', action: 'error_invalid_user',
label: 'error_access_denied', label: nil,
property: 'invalid_user',
project: project, project: project,
user: unauthorized_member user: unauthorized_member
) )
@ -135,10 +132,9 @@ RSpec.describe Projects::GoogleCloud::ServiceAccountsController do
expect(response).to redirect_to(project_google_cloud_configuration_path(project)) expect(response).to redirect_to(project_google_cloud_configuration_path(project))
expect(flash[:warning]).to eq('No Google Cloud projects - You need at least one Google Cloud project') expect(flash[:warning]).to eq('No Google Cloud projects - You need at least one Google Cloud project')
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ServiceAccountsController',
action: 'service_accounts#index', action: 'error_no_gcp_projects',
label: 'error_form', label: nil,
property: 'no_gcp_projects',
project: project, project: project,
user: authorized_member user: authorized_member
) )
@ -207,11 +203,10 @@ RSpec.describe Projects::GoogleCloud::ServiceAccountsController do
expect(response).to redirect_to(project_google_cloud_configuration_path(project)) expect(response).to redirect_to(project_google_cloud_configuration_path(project))
expect(flash[:warning]).to eq('Google Cloud Error - client-error') expect(flash[:warning]).to eq('Google Cloud Error - client-error')
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ServiceAccountsController',
action: 'service_accounts#index', action: 'error_google_api',
label: 'error_gcp',
extra: google_client_error,
project: project, project: project,
label: nil,
user: authorized_member user: authorized_member
) )
end end
@ -226,10 +221,9 @@ RSpec.describe Projects::GoogleCloud::ServiceAccountsController do
expect(response).to redirect_to(project_google_cloud_configuration_path(project)) expect(response).to redirect_to(project_google_cloud_configuration_path(project))
expect(flash[:warning]).to eq('Google Cloud Error - client-error') expect(flash[:warning]).to eq('Google Cloud Error - client-error')
expect_snowplow_event( expect_snowplow_event(
category: 'Projects::GoogleCloud', category: 'Projects::GoogleCloud::ServiceAccountsController',
action: 'service_accounts#create', action: 'error_google_api',
label: 'error_gcp', label: nil,
extra: google_client_error,
project: project, project: project,
user: authorized_member user: authorized_member
) )

View File

@ -371,6 +371,9 @@ RSpec.describe Spam::SpamVerdictService do
end end
it 'returns nil' do it 'returns nil' do
expect(Gitlab::ErrorTracking).to receive(:log_exception).with(
an_instance_of(GRPC::Aborted), error: ::Spam::SpamConstants::ERROR_TYPE
)
expect(subject).to eq([ALLOW, attribs, true]) expect(subject).to eq([ALLOW, attribs, true])
end end
end end
@ -383,17 +386,20 @@ RSpec.describe Spam::SpamVerdictService do
expect(subject).to eq [DISALLOW, attribs] expect(subject).to eq [DISALLOW, attribs]
end end
end end
end
context 'if the endpoint times out' do context 'if the endpoint times out' do
let(:attribs) { nil } let(:attribs) { nil }
before do before do
allow(spam_client).to receive(:spam?).and_raise(GRPC::DeadlineExceeded) allow(spam_client).to receive(:spam?).and_raise(GRPC::DeadlineExceeded)
end end
it 'returns nil' do it 'returns nil' do
expect(subject).to eq([ALLOW, attribs, true]) expect(Gitlab::ErrorTracking).to receive(:log_exception).with(
an_instance_of(GRPC::DeadlineExceeded), error: ::Spam::SpamConstants::ERROR_TYPE
)
expect(subject).to eq([ALLOW, attribs, true])
end
end end
end end
end end