Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-05-16 15:08:39 +00:00
parent 1c9afffa29
commit d7b1354b39
111 changed files with 966 additions and 316 deletions

View File

@ -276,6 +276,11 @@ Rails/InverseOf:
Rails/UniqueValidationWithoutIndex:
Enabled: false
Rails/HasManyOrHasOneDependent:
Include:
- app/models/**/*.rb
- ee/app/models/**/*.rb
Rails/HelperInstanceVariable:
Include:
- app/helpers/**/*.rb

View File

@ -1,17 +1,7 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-02-24 14:52:20 UTC using RuboCop version 0.93.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Enabled: false
# Offense count: 42
# Cop supports --auto-correct.
Style/CaseLikeIf:
Enabled: false
# This configuration is no longer used.
#
# The RuboCop TODO lists are located in `.rubocop_todo/**/*.yml`.
#
# Please use `rake rubocop:todo:generate` to generate TODOs.
#
# See https://docs.gitlab.com/ee/development/rake_tasks.html#generate-initial-rubocop-todo-list

View File

@ -773,7 +773,6 @@ Gitlab/NamespacedClass:
- 'app/workers/emails_on_push_worker.rb'
- 'app/workers/error_tracking_issue_link_worker.rb'
- 'app/workers/expire_build_artifacts_worker.rb'
- 'app/workers/expire_build_instance_artifacts_worker.rb'
- 'app/workers/expire_job_cache_worker.rb'
- 'app/workers/expire_pipeline_cache_worker.rb'
- 'app/workers/export_csv_worker.rb'

View File

@ -0,0 +1,154 @@
---
Rails/HasManyOrHasOneDependent:
# Offense count: 593
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/models/alert_management/alert.rb'
- 'app/models/analytics/cycle_analytics/project_value_stream.rb'
- 'app/models/analytics/cycle_analytics/stage_event_hash.rb'
- 'app/models/application_setting/term.rb'
- 'app/models/bulk_import.rb'
- 'app/models/bulk_imports/entity.rb'
- 'app/models/bulk_imports/export.rb'
- 'app/models/ci/bridge.rb'
- 'app/models/ci/build.rb'
- 'app/models/ci/pipeline.rb'
- 'app/models/ci/pipeline_schedule.rb'
- 'app/models/ci/processable.rb'
- 'app/models/ci/ref.rb'
- 'app/models/ci/resource_group.rb'
- 'app/models/ci/runner.rb'
- 'app/models/ci/stage.rb'
- 'app/models/ci/trigger.rb'
- 'app/models/ci/trigger_request.rb'
- 'app/models/ci/unit_test.rb'
- 'app/models/clusters/agent.rb'
- 'app/models/clusters/applications/knative.rb'
- 'app/models/clusters/cluster.rb'
- 'app/models/clusters/project.rb'
- 'app/models/commit_status.rb'
- 'app/models/concerns/ci/metadatable.rb'
- 'app/models/concerns/integrations/has_data_fields.rb'
- 'app/models/concerns/issuable.rb'
- 'app/models/concerns/label_eventable.rb'
- 'app/models/concerns/milestone_eventable.rb'
- 'app/models/concerns/packages/debian/distribution.rb'
- 'app/models/concerns/protected_ref.rb'
- 'app/models/concerns/state_eventable.rb'
- 'app/models/concerns/timebox.rb'
- 'app/models/concerns/versioned_description.rb'
- 'app/models/concerns/with_uploads.rb'
- 'app/models/customer_relations/contact.rb'
- 'app/models/deploy_key.rb'
- 'app/models/deploy_token.rb'
- 'app/models/deployment.rb'
- 'app/models/design_management/design.rb'
- 'app/models/design_management/version.rb'
- 'app/models/environment.rb'
- 'app/models/error_tracking/error.rb'
- 'app/models/event.rb'
- 'app/models/experiment.rb'
- 'app/models/fork_network.rb'
- 'app/models/gpg_key.rb'
- 'app/models/group.rb'
- 'app/models/hooks/web_hook.rb'
- 'app/models/integration.rb'
- 'app/models/issue.rb'
- 'app/models/jira_connect_installation.rb'
- 'app/models/label.rb'
- 'app/models/lfs_object.rb'
- 'app/models/list.rb'
- 'app/models/member.rb'
- 'app/models/merge_request.rb'
- 'app/models/merge_request_context_commit.rb'
- 'app/models/milestone.rb'
- 'app/models/namespace.rb'
- 'app/models/namespaces/project_namespace.rb'
- 'app/models/note.rb'
- 'app/models/operations/feature_flag.rb'
- 'app/models/operations/feature_flags/strategy.rb'
- 'app/models/operations/feature_flags/user_list.rb'
- 'app/models/packages/debian/project_distribution.rb'
- 'app/models/packages/dependency.rb'
- 'app/models/packages/dependency_link.rb'
- 'app/models/packages/package.rb'
- 'app/models/packages/package_file.rb'
- 'app/models/pages_domain.rb'
- 'app/models/plan.rb'
- 'app/models/pool_repository.rb'
- 'app/models/project.rb'
- 'app/models/projects/topic.rb'
- 'app/models/prometheus_alert.rb'
- 'app/models/prometheus_metric.rb'
- 'app/models/release.rb'
- 'app/models/snippet.rb'
- 'app/models/terraform/state.rb'
- 'app/models/user.rb'
- 'app/models/wiki_page/meta.rb'
- 'app/models/work_items/type.rb'
- 'app/models/x509_certificate.rb'
- 'app/models/x509_issuer.rb'
- 'ee/app/models/analytics/devops_adoption/enabled_namespace.rb'
- 'ee/app/models/analytics/devops_adoption/snapshot.rb'
- 'ee/app/models/approval_merge_request_rule.rb'
- 'ee/app/models/approval_project_rule.rb'
- 'ee/app/models/boards/epic_board.rb'
- 'ee/app/models/boards/epic_list.rb'
- 'ee/app/models/compliance_management/framework.rb'
- 'ee/app/models/concerns/ee/iteration_eventable.rb'
- 'ee/app/models/concerns/ee/protected_branch.rb'
- 'ee/app/models/concerns/ee/protected_ref.rb'
- 'ee/app/models/concerns/ee/weight_eventable.rb'
- 'ee/app/models/concerns/geo/eventable.rb'
- 'ee/app/models/concerns/issue_widgets/acts_like_requirement.rb'
- 'ee/app/models/concerns/security/scan_execution_policy.rb'
- 'ee/app/models/dast/profile.rb'
- 'ee/app/models/dast_site.rb'
- 'ee/app/models/dast_site_profile.rb'
- 'ee/app/models/dast_site_validation.rb'
- 'ee/app/models/ee/alert_management/alert.rb'
- 'ee/app/models/ee/analytics/cycle_analytics/stage_event_hash.rb'
- 'ee/app/models/ee/board.rb'
- 'ee/app/models/ee/ci/build.rb'
- 'ee/app/models/ee/ci/job_artifact.rb'
- 'ee/app/models/ee/ci/pipeline.rb'
- 'ee/app/models/ee/deployment.rb'
- 'ee/app/models/ee/environment.rb'
- 'ee/app/models/ee/epic.rb'
- 'ee/app/models/ee/group.rb'
- 'ee/app/models/ee/issue.rb'
- 'ee/app/models/ee/iteration.rb'
- 'ee/app/models/ee/label.rb'
- 'ee/app/models/ee/lfs_object.rb'
- 'ee/app/models/ee/merge_request.rb'
- 'ee/app/models/ee/merge_request_diff.rb'
- 'ee/app/models/ee/milestone.rb'
- 'ee/app/models/ee/namespace.rb'
- 'ee/app/models/ee/pages_deployment.rb'
- 'ee/app/models/ee/plan.rb'
- 'ee/app/models/ee/project.rb'
- 'ee/app/models/ee/upload.rb'
- 'ee/app/models/ee/user.rb'
- 'ee/app/models/ee/vulnerability.rb'
- 'ee/app/models/elastic/reindexing_subtask.rb'
- 'ee/app/models/elastic/reindexing_task.rb'
- 'ee/app/models/geo/event.rb'
- 'ee/app/models/geo_node.rb'
- 'ee/app/models/incident_management/escalation_policy.rb'
- 'ee/app/models/incident_management/oncall_participant.rb'
- 'ee/app/models/incident_management/oncall_rotation.rb'
- 'ee/app/models/incident_management/oncall_schedule.rb'
- 'ee/app/models/integrations/gitlab_slack_application.rb'
- 'ee/app/models/iterations/cadence.rb'
- 'ee/app/models/protected_environment.rb'
- 'ee/app/models/protected_environments/approval_rule.rb'
- 'ee/app/models/push_rule.rb'
- 'ee/app/models/saml_provider.rb'
- 'ee/app/models/security/finding.rb'
- 'ee/app/models/security/scan.rb'
- 'ee/app/models/security/training_provider.rb'
- 'ee/app/models/vulnerabilities/finding.rb'
- 'ee/app/models/vulnerabilities/identifier.rb'
- 'ee/app/models/vulnerabilities/remediation.rb'
- 'ee/app/models/vulnerabilities/scanner.rb'

View File

@ -0,0 +1,63 @@
---
# Cop supports --auto-correct.
Style/CaseLikeIf:
# Offense count: 60
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/controllers/concerns/issuable_actions.rb'
- 'app/controllers/groups/dependency_proxy/application_controller.rb'
- 'app/controllers/projects/labels_controller.rb'
- 'app/graphql/types/ci/job_need_union.rb'
- 'app/helpers/avatars_helper.rb'
- 'app/helpers/broadcast_messages_helper.rb'
- 'app/helpers/issues_helper.rb'
- 'app/helpers/routing/pseudonymization_helper.rb'
- 'app/models/integrations/jira.rb'
- 'app/models/members/member_task.rb'
- 'app/models/namespace.rb'
- 'app/models/packages/go/module_version.rb'
- 'app/serializers/group_child_serializer.rb'
- 'app/services/google_cloud/generate_pipeline_service.rb'
- 'app/services/issuable/bulk_update_service.rb'
- 'app/services/todo_service.rb'
- 'ee/app/controllers/concerns/credentials_inventory_actions.rb'
- 'ee/app/finders/ee/notes_finder.rb'
- 'ee/app/helpers/ee/branches_helper.rb'
- 'ee/app/helpers/ee/namespace_storage_limit_alert_helper.rb'
- 'ee/app/services/epics/tree_reorder_service.rb'
- 'ee/app/services/merge_request_approval_settings/update_service.rb'
- 'ee/lib/gitlab/alert_management/alert_payload_field_extractor.rb'
- 'ee/spec/config/metrics/every_metric_definition_spec.rb'
- 'ee/spec/features/boards/user_adds_lists_to_board_spec.rb'
- 'ee/spec/features/issues/user_bulk_edits_issues_spec.rb'
- 'ee/spec/features/projects/custom_projects_template_spec.rb'
- 'ee/spec/support/matchers/ee/epic_aggregate_matchers.rb'
- 'lib/api/helpers/label_helpers.rb'
- 'lib/gitlab/analytics/unique_visits.rb'
- 'lib/gitlab/ci/ansi2html.rb'
- 'lib/gitlab/ci/ansi2json/converter.rb'
- 'lib/gitlab/ci/build/image.rb'
- 'lib/gitlab/identifier.rb'
- 'lib/gitlab/issues/rebalancing/state.rb'
- 'lib/gitlab/pagination/gitaly_keyset_pager.rb'
- 'lib/gitlab/utils.rb'
- 'lib/gitlab/utils/strong_memoize.rb'
- 'qa/qa/git/repository.rb'
- 'qa/qa/scenario/bootable.rb'
- 'rubocop/cop/gitlab/keys_first_and_values_first.rb'
- 'spec/features/boards/user_adds_lists_to_board_spec.rb'
- 'spec/lib/gitlab/auth/auth_finders_spec.rb'
- 'spec/lib/gitlab/database/load_balancing_spec.rb'
- 'spec/lib/omni_auth/strategies/jwt_spec.rb'
- 'spec/models/concerns/sha_attribute_spec.rb'
- 'spec/models/preloaders/labels_preloader_spec.rb'
- 'spec/requests/api/rubygem_packages_spec.rb'
- 'spec/requests/api/terraform/modules/v1/packages_spec.rb'
- 'spec/services/resource_events/change_state_service_spec.rb'
- 'spec/support/helpers/filter_spec_helper.rb'
- 'spec/support/matchers/abort_matcher.rb'
- 'spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/notes_shared_examples.rb'
- 'spec/support/shared_examples/uploaders/object_storage_shared_examples.rb'
- 'spec/workers/loose_foreign_keys/cleanup_worker_spec.rb'

View File

@ -302,6 +302,7 @@ export default {
@click="handleFileNameClick"
>
<file-icon
v-if="!glFeatures.removeDiffHeaderIcons"
:file-name="filePath"
:size="16"
aria-hidden="true"

View File

@ -268,7 +268,10 @@ export default {
: '';
},
statusIcon() {
return this.isClosed ? 'issue-closed' : 'issues';
if (this.issuableType === IssuableType.Issue) {
return this.isClosed ? 'issue-closed' : 'issues';
}
return this.isClosed ? 'epic-closed' : 'epic';
},
statusVariant() {
return this.isClosed ? 'info' : 'success';

View File

@ -91,13 +91,13 @@ export default {
},
commentButtonTitle() {
const { comment, internalComment, startThread, startInternalThread } = this.$options.i18n;
if (this.getNoteableData.confidential || this.noteIsConfidential) {
if (this.noteIsConfidential) {
return this.noteType === constants.COMMENT ? internalComment : startInternalThread;
}
return this.noteType === constants.COMMENT ? comment : startThread;
},
textareaPlaceholder() {
return this.getNoteableData.confidential || this.noteIsConfidential
return this.noteIsConfidential
? this.$options.i18n.bodyPlaceholderInternal
: this.$options.i18n.bodyPlaceholder;
},

View File

@ -376,14 +376,12 @@ span.idiff {
a {
color: $gl-text-color;
}
}
@include media-breakpoint-down(md) {
.file-actions {
margin-top: $gl-padding-8;
.btn {
margin-bottom: $gl-padding-8;
}
.blob-content-holder .file-actions {
@include media-breakpoint-down(sm) {
.btn {
margin-bottom: $gl-padding-8;
}
}
}

View File

@ -256,6 +256,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:raw_blob_request_limit,
:issues_create_limit,
:notes_create_limit,
:pipeline_limit_per_project_user_sha,
:default_branch_name,
disabled_oauth_sign_in_sources: [],
import_sources: [],

View File

@ -141,7 +141,7 @@ class Projects::JobsController < Projects::ApplicationController
end
def raw
if @build.trace.archived_trace_exist?
if @build.trace.archived?
workhorse_set_content_type!
send_upload(@build.job_artifacts_trace.file,
send_params: raw_send_params,

View File

@ -46,6 +46,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:updated_diff_expansion_buttons, project)
push_frontend_feature_flag(:mr_attention_requests, current_user)
push_frontend_feature_flag(:updated_mr_header, project)
push_frontend_feature_flag(:remove_diff_header_icons, project)
end
before_action do

View File

@ -428,7 +428,8 @@ module ApplicationSettingsHelper
:users_get_by_id_limit_allowlist_raw,
:runner_token_expiration_interval,
:group_runner_token_expiration_interval,
:project_runner_token_expiration_interval
:project_runner_token_expiration_interval,
:pipeline_limit_per_project_user_sha
].tap do |settings|
settings << :deactivate_dormant_users unless Gitlab.com?
end

View File

@ -154,7 +154,7 @@ module IssuesHelper
end
def issue_closed_text(issue, current_user)
link = issue_closed_link(issue, current_user, css_class: 'text-white text-underline')
link = issue_closed_link(issue, current_user, css_class: 'text-underline gl-reset-color!')
if link
s_('IssuableStatus|Closed (%{link})').html_safe % { link: link }

View File

@ -489,6 +489,9 @@ class ApplicationSetting < ApplicationRecord
validates :raw_blob_request_limit,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :pipeline_limit_per_project_user_sha,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :ci_jwt_signing_key,
rsa_key: true, allow_nil: true

View File

@ -677,7 +677,7 @@ module Ci
end
def has_archived_trace?
trace.archived_trace_exist?
trace.archived?
end
def artifacts_file
@ -825,7 +825,6 @@ module Ci
end
end
# and use that for `ExpireBuildInstanceArtifactsWorker`?
def erase_erasable_artifacts!
job_artifacts.erasable.destroy_all # rubocop: disable Cop/DestroyAll
end

View File

@ -1,9 +1,9 @@
= form_for @application_setting, url: network_admin_application_settings_path(anchor: 'js-issue-limits-settings'), html: { class: 'fieldset-form' } do |f|
= gitlab_ui_form_for @application_setting, url: network_admin_application_settings_path(anchor: 'js-issue-limits-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
= f.label :issues_create_limit, 'Max requests per minute per user', class: 'label-bold'
= f.label :issues_create_limit, _('Maximum number of requests per minute')
= f.number_field :issues_create_limit, class: 'form-control gl-form-input'
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }

View File

@ -0,0 +1,9 @@
= gitlab_ui_form_for @application_setting, url: network_admin_application_settings_path(anchor: 'js-pipeline-limits-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
= f.label :pipeline_limit_per_project_user_sha, _('Maximum number of requests per minute')
= f.number_field :pipeline_limit_per_project_user_sha, class: 'form-control gl-form-input'
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }

View File

@ -157,4 +157,16 @@
.settings-content
= render 'import_export_limits'
%section.settings.as-pipeline-limits.no-animate#js-pipeline-limits-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header
%h4
= _('Pipeline creation rate limits')
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= _('Limit the number of pipeline creation requests per minute. This limit includes pipelines created through the UI, the API, and by background processing.')
= link_to _('Learn more.'), help_page_path('user/admin_area/settings/rate_limit_on_pipelines_creation.md'), target: '_blank', rel: 'noopener noreferrer'
.settings-content
= render 'pipeline_limits'
= render_if_exists 'admin/application_settings/ee_network_settings'

View File

@ -1,4 +1,4 @@
- link = issue_closed_link(@issue, current_user, css_class: 'text-white text-underline')
- link = issue_closed_link(@issue, current_user, css_class: 'text-underline gl-reset-color!')
- badge_classes = 'issuable-status-badge gl-mr-3'
.detail-page-header
@ -7,7 +7,7 @@
.gl-display-none.gl-sm-display-block.gl-ml-2
= issue_closed_text(issuable, current_user)
- if link
%span.text-white.gl-pl-2.gl-sm-display-none
%span.gl-pl-2.gl-sm-display-none
= "(#{link})"
= gl_badge_tag({ variant: :success, icon: 'issues', icon_classes: 'gl-mr-0!' }, { class: "#{issue_status_visibility(issuable, status_box: :open)} #{badge_classes} issuable-status-badge-open" }) do
%span.gl-display-none.gl-sm-display-block.gl-ml-2

View File

@ -2272,15 +2272,6 @@
:weight: 1
:idempotent: true
:tags: []
- :name: expire_build_instance_artifacts
:worker_name: ExpireBuildInstanceArtifactsWorker
:feature_category: :build_artifacts
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent:
:tags: []
- :name: export_csv
:worker_name: ExportCsvWorker
:feature_category: :team_planning

View File

@ -13,7 +13,7 @@ module ContainerRegistry
feature_category :container_registry
urgency :low
worker_resource_boundary :unknown
deduplicate :until_executed
deduplicate :until_executed, ttl: 5.minutes
idempotent!
def perform
@ -68,9 +68,9 @@ module ContainerRegistry
if Feature.enabled?(:registry_migration_guard_thresholds)
timeout = if repository.migration_state == 'pre_importing'
migration.pre_import_timeout
migration.pre_import_timeout.seconds
else
migration.import_timeout
migration.import_timeout.seconds
end
end

View File

@ -1,25 +0,0 @@
# frozen_string_literal: true
class ExpireBuildInstanceArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
feature_category :build_artifacts
def perform(build_id)
# rubocop: disable CodeReuse/ActiveRecord
build = Ci::Build
.with_expired_artifacts
.reorder(nil)
.find_by_id(build_id)
# rubocop: enable CodeReuse/ActiveRecord
return unless build&.project && !build.project.pending_delete
Gitlab::AppLogger.info("Removing artifacts for build #{build.id}...")
build.erase_erasable_artifacts!
end
end

View File

@ -0,0 +1,8 @@
---
name: remove_diff_header_icons
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87289
rollout_issue_url:
milestone: '15.0'
type: development
group: group::code review
default_enabled: true

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage_monthly.verify.ci_pipeline_config_auto_devops
description: Distinct users that ran an auto DevOps pipeline without a .gitlab-ci.yml file.
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage_monthly.create.action_monthly_active_users_ide_edit
description: Number of unique users per month who edited a file from any web editor
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage_monthly.manage.events
description: Number of distinct users who have generated a manage event by month
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts_monthly.successful_deployments
description: Total successful deployments
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts_monthly.failed_deployments
description: Total failed deployments
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage_monthly.release.failed_deployments
description: Disinct users who initiated a failed deployment.
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage_monthly.release.successful_deployments
description: Disinct users who initiated a successful deployment.
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage_monthly.create.protected_branches
description: Count of users creating projects with repositories making use of at least
one protected branch in last 28 days.

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: gitlab_project
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: gitlab
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: github
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: bitbucket
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: bitbucket_server
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: gitea
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: git
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: manifest
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountBulkImportsEntitiesMetric
options:
source_type: project_entity
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: fogbugz
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: phabricator
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: 28d
data_source: database
instrumentation_class: CountBulkImportsEntitiesMetric
options:
source_type: group_entity
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: redis_hll_counters.pipeline_authoring.o_pipeline_authoring_unique_users_committing_ciconfigfile_monthly
description: Monthly unique user count doing commits which contains the CI config
file

View File

@ -12,7 +12,7 @@ milestone: "14.3"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70061
time_frame: 28d
data_source: database
data_category: optional
data_category: operational
performance_indicator_type: []
distribution:
- ce

View File

@ -11,7 +11,7 @@ milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
time_frame: 28d
data_source: redis_hll
data_category: optional
data_category: operational
instrumentation_class: RedisHLLMetric
performance_indicator_type: []
distribution:

View File

@ -11,7 +11,7 @@ milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
time_frame: 28d
data_source: redis_hll
data_category: optional
data_category: operational
instrumentation_class: RedisHLLMetric
performance_indicator_type: []
distribution:

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.ci_pipeline_config_auto_devops
description: Total pipelines from an Auto DevOps template
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage.verify.ci_builds
description: Unique count of builds in project
product_section: ops

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: gitlab_project
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: gitlab
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: github
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: bitbucket
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: bitbucket_server
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: gitea
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: git
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: manifest
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountBulkImportsEntitiesMetric
options:
source_type: project_entity
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: fogbugz
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountImportedProjectsMetric
options:
import_type: phabricator
distribution:
- ce
- ee

View File

@ -10,6 +10,9 @@ value_type: number
status: active
time_frame: all
data_source: database
instrumentation_class: CountBulkImportsEntitiesMetric
options:
source_type: group_entity
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage.manage.events
description: Number of distinct users who have generated a manage event
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.projects_prometheus_active
description: Count of projects with active integrations for Prometheus
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.feature_flags
description: Number of feature flag toggles
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.environments
description: Total available and stopped environments
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: analytics_unique_visits.i_analytics_dev_ops_adoption
description: Unique users viewing analytics devops adoption
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.ci_runners_instance_type_active
name: "count_active_instance_ci_runners"
description: Total active Shared (Instance) Runners

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.ci_runners_group_type_active
name: "count_active_group_ci_runners"
description: Total active Group Runners

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: counts.ci_runners_project_type_active
name: "count_active_project_ci_runners"
description: Total active Specific (Project) Runners

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: usage_activity_by_stage.manage.project_imports.total
description: Number of projects imported
product_section: dev

View File

@ -5,7 +5,7 @@ product_section: growth
product_stage: growth
product_group: group::product intelligence
product_category: collection
value_type: string
value_type: number
status: active
milestone: "<13.9"
data_category: subscription

View File

@ -1,5 +1,5 @@
---
data_category: optional
data_category: operational
key_path: prometheus_enabled
description: Whether the bundled Prometheus is enabled
product_section: growth

View File

@ -161,8 +161,6 @@
- 1
- - experiments_record_conversion_event
- 1
- - expire_build_instance_artifacts
- 1
- - export_csv
- 1
- - external_service_reactive_caching

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddPipelineCreateLimitPerProjectUserShaToApplicationSettings < Gitlab::Database::Migration[2.0]
def change
add_column :application_settings, :pipeline_limit_per_project_user_sha, :integer, default: 0, null: false
end
end

View File

@ -0,0 +1 @@
dd2733b77f86e108c5015edcdbc715dd011b00479828a7087af9120cc5ae5661

View File

@ -11302,6 +11302,7 @@ CREATE TABLE application_settings (
max_export_size integer DEFAULT 0,
container_registry_pre_import_timeout integer DEFAULT 1800 NOT NULL,
container_registry_import_timeout integer DEFAULT 600 NOT NULL,
pipeline_limit_per_project_user_sha integer DEFAULT 0 NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)),

View File

@ -1140,7 +1140,7 @@ Rate limits are enforced using the following:
- `rate_limit_source_ip`: Set the maximum threshold in number of requests per client IP per second. Set to 0 to disable this feature.
- `rate_limit_source_ip_burst`: Sets the maximum threshold of number of requests allowed in an initial outburst of requests per client IP.
For example, when you load a web page that loads a number of resources at the same time.
- `rate_limit_domain_ip`: Set the maximum threshold in number of requests per hosted pages domain per second. Set to 0 to disable this feature.
- `rate_limit_domain`: Set the maximum threshold in number of requests per hosted pages domain per second. Set to 0 to disable this feature.
- `rate_limit_domain_burst`: Sets the maximum threshold of number of requests allowed in an initial outburst of requests per hosted pages domain.
#### Enable source-IP rate limits

View File

@ -389,6 +389,7 @@ listed in the descriptions of the relevant settings.
| `performance_bar_allowed_group_path` | string | no | Path of the group that is allowed to toggle the performance bar. |
| `performance_bar_enabled` | boolean | no | (Deprecated: Pass `performance_bar_allowed_group_path: nil` instead) Allow enabling the performance bar. |
| `personal_access_token_prefix` | string | no | Prefix for all generated personal access tokens. |
| `pipeline_limit_per_project_user_sha` | integer | no | Maximum number of pipeline creation requests per minute per user and commit. Disabled by default. |
| `plantuml_enabled` | boolean | no | (**If enabled, requires:** `plantuml_url`) Enable PlantUML integration. Default is `false`. |
| `plantuml_url` | string | required by: `plantuml_enabled` | The PlantUML instance URL for integration. |
| `polling_interval_multiplier` | decimal | no | Interval multiplier used by endpoints that perform polling. Set to `0` to disable polling. |

View File

@ -73,8 +73,8 @@ To enable merge trains:
- Your repository must be a GitLab repository, not an
[external repository](../ci_cd_for_external_repos/index.md).
Merge trains do not work with [Semi-linear history merge requests](../../user/project/merge_requests/reviews/index.md)
or [fast-forward merge requests](../../user/project/merge_requests/fast_forward_merge.md).
Merge trains do not work with [Semi-linear history merge requests](../../user/project/merge_requests/methods/index.md#merge-commit-with-semi-linear-history)
or [fast-forward merge requests](../../user/project/merge_requests/methods/index.md#fast-forward-merge).
## Enable merge trains

View File

@ -147,12 +147,11 @@ mostly for fine-grained control of Redis usage, so they wouldn't be used
in combination with the `Rails.cache` wrapper: we'd either use
`Rails.cache` or these classes and literal Redis commands.
`Rails.cache` or these classes and literal Redis commands. We prefer
using `Rails.cache` so we can reap the benefits of future optimizations
done to Rails. It is worth noting that Ruby objects are
We prefer using `Rails.cache` so we can reap the benefits of future
optimizations done to Rails. Ruby objects are
[marshalled](https://github.com/rails/rails/blob/v6.0.3.1/activesupport/lib/active_support/cache/redis_cache_store.rb#L447)
when written to Redis, so we need to pay attention to not to store huge
objects, or untrusted user input.
when written to Redis, so we must pay attention to store neither huge objects,
nor untrusted user input.
Typically we would only use these classes when at least one of the
following is true:

View File

@ -123,6 +123,8 @@ the current stable release, and two previous monthly releases. In rare cases a r
For instance, if we release `13.2.1` with a fix for a severe bug introduced in
`13.0.0`, we could backport the fix to a new `13.0.x`, and `13.1.x` patch release.
Note that [severity] 3 and lower requests will be automatically turned down.
To request backporting to more than one stable release for consideration, raise an issue in the
[release/tasks](https://gitlab.com/gitlab-org/release/tasks/-/issues/new?issuable_template=Backporting-request) issue tracker.

View File

@ -170,22 +170,6 @@ wiki, packages, or snippets. The repository size limit applies to both private a
For details on manually purging files, see [reducing the repository size using Git](../../project/repository/reducing_the_repo_size_using_git.md).
## Troubleshooting
### 413 Request Entity Too Large
When attaching a file to a comment or reply in GitLab displays a `413 Request Entity Too Large`
error, the [max attachment size](#max-attachment-size)
is probably larger than the web server's allowed value.
To increase the max attachment size to 200 MB in a
[Omnibus GitLab](https://docs.gitlab.com/omnibus/) install, you may need to
add the line below to `/etc/gitlab/gitlab.rb` before increasing the max attachment size:
```ruby
nginx['client_max_body_size'] = "200m"
```
## Customize session duration for Git Operations when 2FA is enabled **(PREMIUM SELF)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/296669) in GitLab 13.9.
@ -258,7 +242,7 @@ This feature was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/351963)
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3649) in GitLab 12.6.
Users can optionally specify a lifetime for
access tokens, this includes [personal](../../profile/personal_access_tokens.md),
access tokens, this includes [personal](../../profile/personal_access_tokens.md),
[group](../../group/settings/group_access_tokens.md), and [project](../../project/settings/project_access_tokens.md) access tokens.
This lifetime is not a requirement, and can be set to any arbitrary number of days.
@ -315,3 +299,33 @@ NOTE:
When this ability is disabled, GitLab administrators can still use the
[Admin Area](../index.md#administering-users) or the
[API](../../../api/users.md#user-modification) to update usernames.
## Troubleshooting
### 413 Request Entity Too Large
When attaching a file to a comment or reply in GitLab displays a `413 Request Entity Too Large`
error, the [max attachment size](#max-attachment-size)
is probably larger than the web server's allowed value.
To increase the max attachment size to 200 MB in a
[Omnibus GitLab](https://docs.gitlab.com/omnibus/) install, you may need to
add the line below to `/etc/gitlab/gitlab.rb` before increasing the max attachment size:
```ruby
nginx['client_max_body_size'] = "200m"
```
### This repository has exceeded its size limit
If you receive intermittent push errors in your [Rails exceptions log](../../../administration/logs.md#exceptions_jsonlog), like this:
```plaintext
Your push has been rejected, because this repository has exceeded its size limit.
```
[Housekeeping](../../../administration/housekeeping.md) tasks may be causing your repository size to grow.
To resolve this problem, either of these options helps in the short- to middle-term:
- Increase the [repository size limit](#repository-size-limit).
- [Reduce the repo size](../../project/repository/reducing_the_repo_size_using_git.md).

View File

@ -15,7 +15,7 @@ To can change its value:
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Settings > Network**.
1. Expand **Issues Rate Limits**.
1. Under **Max requests per minute per user**, enter the new value.
1. Under **Max requests per minute**, enter the new value.
1. Select **Save changes**.
For example, if you set a limit of 300, requests using the

View File

@ -0,0 +1,33 @@
---
type: reference
stage: Verify
group: Pipeline Execution
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Rate limits on pipeline creation **(FREE SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/362475) in GitLab 15.0.
You can set a limit so that users and processes can't request more than a certain number of pipelines each minute. This limit can help save resources and improve stability.
For example, if you set a limit of `10`, and `11` requests are sent to the [trigger API](../../../ci/triggers/) within one minute,
the eleventh request is blocked. Access to the endpoint is allowed again after one minute.
This limit is:
- Applied independently per project, user, and commit.
- Not applied per IP address.
- Disabled by default.
Requests that exceed the limit are logged in the `application_json.log` file.
## Set a pipeline request limit
To limit the number of pipeline requests:
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Settings > Network**.
1. Expand **Pipelines Rate Limits**.
1. Under **Max requests per minute**, enter a value greater than `0`.
1. Select **Save changes**.

View File

@ -181,6 +181,7 @@ module API
optional :runner_token_expiration_interval, type: Integer, desc: 'Token expiration interval for shared runners, in seconds'
optional :group_runner_token_expiration_interval, type: Integer, desc: 'Token expiration interval for group runners, in seconds'
optional :project_runner_token_expiration_interval, type: Integer, desc: 'Token expiration interval for project runners, in seconds'
optional :pipeline_limit_per_project_user_sha, type: Integer, desc: "Maximum number of pipeline creation requests allowed per minute per user and commit. Set to 0 for unlimited requests per minute."
Gitlab::SSHPublicKey.supported_types.each do |type|
optional :"#{type}_key_restriction",

View File

@ -74,11 +74,11 @@ module Gitlab
end
def exist?
archived_trace_exist? || live_trace_exist?
archived? || live_trace_exist?
end
def archived_trace_exist?
archived?
def archived?
trace_artifact&.stored?
end
def live_trace_exist?
@ -218,10 +218,6 @@ module Gitlab
end
end
def archived?
trace_artifact&.stored?
end
def destroy_any_orphan_trace_data!
return unless trace_artifact

View File

@ -6,7 +6,6 @@ module Gitlab
class EventDefinition
EVENT_SCHEMA_PATH = Rails.root.join('config', 'events', 'schema.json')
BASE_REPO_PATH = 'https://gitlab.com/gitlab-org/gitlab/-/blob/master'
SCHEMA = ::JSONSchemer.schema(Pathname.new(EVENT_SCHEMA_PATH))
attr_reader :path

View File

@ -4,7 +4,6 @@ module Gitlab
module Usage
class MetricDefinition
METRIC_SCHEMA_PATH = Rails.root.join('config', 'metrics', 'schema.json')
BASE_REPO_PATH = 'https://gitlab.com/gitlab-org/gitlab/-/blob/master'
SKIP_VALIDATION_STATUSES = %w[deprecated removed].to_set.freeze
AVAILABLE_STATUSES = %w[active data_available implemented deprecated].to_set.freeze
VALID_SERVICE_PING_STATUSES = %w[active data_available implemented deprecated broken].to_set.freeze
@ -27,20 +26,22 @@ module Gitlab
attributes
end
def json_schema
return unless has_json_schema?
@json_schema ||= Gitlab::Json.parse(File.read(json_schema_path))
end
def json_schema_path
return '' unless has_json_schema?
"#{BASE_REPO_PATH}/#{attributes[:value_json_schema]}"
Rails.root.join(attributes[:value_json_schema])
end
def has_json_schema?
attributes[:value_type] == 'object' && attributes[:value_json_schema].present?
end
def yaml_path
"#{BASE_REPO_PATH}#{path.delete_prefix(Rails.root.to_s)}"
end
def validate!
unless skip_validation?
self.class.schemer.validate(attributes.stringify_keys).each do |error|

View File

@ -0,0 +1,39 @@
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CountBulkImportsEntitiesMetric < DatabaseMetric
operation :count
def initialize(time_frame:, options: {})
super
if source_type.present? && !source_type.in?(allowed_source_types)
raise ArgumentError, "source_type '#{source_type}' must be one of: #{allowed_source_types.join(', ')}"
end
end
relation { ::BulkImports::Entity }
private
def relation
return super.where(source_type: source_type) if source_type.present? # rubocop: disable CodeReuse/ActiveRecord
super
end
def source_type
options[:source_type].to_s
end
def allowed_source_types
BulkImports::Entity.source_types.keys.map(&:to_s)
end
end
end
end
end
end

View File

@ -0,0 +1,57 @@
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CountImportedProjectsMetric < DatabaseMetric
operation :count
def initialize(time_frame:, options: {})
super
raise ArgumentError, "import_type options attribute is required" unless import_type.present?
end
relation { ::Project }
start do |time_constraints|
unless time_constraints.nil?
start = time_constraints[:created_at]&.first
unless start.nil?
::Project
.select(:id)
.where(Project.arel_table[:created_at].gteq(start)) # rubocop:disable UsageData/LargeTable
.order(created_at: :asc).limit(1).first&.id
end
end
end
finish do |time_constraints|
unless time_constraints.nil?
finish = time_constraints[:created_at]&.last
unless finish.nil?
::Project
.select(:id)
.where(Project.arel_table[:created_at].lteq(finish)) # rubocop:disable UsageData/LargeTable
.order(created_at: :desc).limit(1).first&.id
end
end
end
private
def relation
super.imported_from(import_type) # rubocop: disable CodeReuse/ActiveRecord
end
def import_type
options[:import_type]
end
end
end
end
end
end

View File

@ -91,6 +91,14 @@ module Gitlab
private
def start
self.class.metric_start&.call(time_constraints)
end
def finish
self.class.metric_finish&.call(time_constraints)
end
def relation
self.class.metric_relation.call.where(time_constraints)
end
@ -109,19 +117,19 @@ module Gitlab
end
def get_or_cache_batch_ids
return [self.class.start, self.class.finish] unless self.class.cache_key.present?
return [start, finish] unless self.class.cache_key.present?
key_name = "metric_instrumentation/#{self.class.cache_key}"
start = Gitlab::Cache.fetch_once("#{key_name}_minimum_id", expires_in: 1.day) do
self.class.start
cached_start = Gitlab::Cache.fetch_once("#{key_name}_minimum_id", expires_in: 1.day) do
start
end
finish = Gitlab::Cache.fetch_once("#{key_name}_maximum_id", expires_in: 1.day) do
self.class.finish
cached_finish = Gitlab::Cache.fetch_once("#{key_name}_maximum_id", expires_in: 1.day) do
finish
end
[start, finish]
[cached_start, cached_finish]
end
end
end

View File

@ -61,9 +61,31 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def raw_sql(relation, column, distinct = false)
column ||= relation.primary_key
relation.select(relation.all.table[column].count(distinct)).to_sql
node = node_to_count(relation, column)
relation.unscope(:order).select(node.count(distinct)).to_sql
end
# rubocop: enable CodeReuse/ActiveRecord
def node_to_count(relation, column)
if join_relation?(relation) && joined_column?(column)
table_name, column_name = column.split(".")
Arel::Table.new(table_name)[column_name]
else
relation.all.table[column]
end
end
def join_relation?(relation)
relation.is_a?(ActiveRecord::Relation) && relation.joins_values.present?
end
# checks if the passed column is of format "table.column"
def joined_column?(column)
column.is_a?(String) && column.include?(".")
end
end
end

View File

@ -866,16 +866,17 @@ module Gitlab
end
def project_imports(time_period)
time_frame = metric_time_period(time_period)
counters = {
gitlab_project: projects_imported_count('gitlab_project', time_period),
gitlab: projects_imported_count('gitlab', time_period),
github: projects_imported_count('github', time_period),
bitbucket: projects_imported_count('bitbucket', time_period),
bitbucket_server: projects_imported_count('bitbucket_server', time_period),
gitea: projects_imported_count('gitea', time_period),
git: projects_imported_count('git', time_period),
manifest: projects_imported_count('manifest', time_period),
gitlab_migration: count(::BulkImports::Entity.where(time_period).project_entity) # rubocop: disable CodeReuse/ActiveRecord
gitlab_project: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'gitlab_project' }),
gitlab: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'gitlab' }),
github: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'github' }),
bitbucket: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'bitbucket' }),
bitbucket_server: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'bitbucket_server' }),
gitea: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'gitea' }),
git: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'git' }),
manifest: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'manifest' }),
gitlab_migration: add_metric('CountBulkImportsEntitiesMetric', time_frame: time_frame, options: { source_type: :project_entity })
}
counters[:total] = add(*counters.values)
@ -883,46 +884,21 @@ module Gitlab
counters
end
def projects_imported_count(from, time_period)
# rubocop:disable CodeReuse/ActiveRecord
relation = ::Project.imported_from(from).where.not(import_type: nil) # rubocop:disable UsageData/LargeTable
if time_period.empty?
count(relation)
else
@project_import_id ||= {}
start = time_period[:created_at].first
finish = time_period[:created_at].last
# can be nil values here if no records are in our range and it is possible the same instance
# is called with different time periods since it is passed in as a variable
unless @project_import_id.key?(start)
@project_import_id[start] = ::Project.select(:id).where(Project.arel_table[:created_at].gteq(start)) # rubocop:disable UsageData/LargeTable
.order(created_at: :asc).limit(1).first&.id
end
unless @project_import_id.key?(finish)
@project_import_id[finish] = ::Project.select(:id).where(Project.arel_table[:created_at].lteq(finish)) # rubocop:disable UsageData/LargeTable
.order(created_at: :desc).limit(1).first&.id
end
count(relation, start: @project_import_id[start], finish: @project_import_id[finish])
end
# rubocop:enable CodeReuse/ActiveRecord
end
def issue_imports(time_period)
time_frame = metric_time_period(time_period)
{
jira: count(::JiraImportState.where(time_period)), # rubocop: disable CodeReuse/ActiveRecord
fogbugz: projects_imported_count('fogbugz', time_period),
phabricator: projects_imported_count('phabricator', time_period),
fogbugz: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'fogbugz' }),
phabricator: add_metric('CountImportedProjectsMetric', time_frame: time_frame, options: { import_type: 'phabricator' }),
csv: count(::Issues::CsvImport.where(time_period)) # rubocop: disable CodeReuse/ActiveRecord
}
end
def group_imports(time_period)
time_frame = metric_time_period(time_period)
{
group_import: count(::GroupImportState.where(time_period)), # rubocop: disable CodeReuse/ActiveRecord
gitlab_migration: count(::BulkImports::Entity.where(time_period).group_entity) # rubocop: disable CodeReuse/ActiveRecord
gitlab_migration: add_metric('CountBulkImportsEntitiesMetric', time_frame: time_frame, options: { source_type: :group_entity })
}
end

View File

@ -31,6 +31,10 @@ module Gitlab
SQL_METRIC_DEFAULT
end
def add(*args)
SQL_METRIC_DEFAULT
end
def maximum_id(model, column = nil)
end

View File

@ -22844,6 +22844,9 @@ msgstr ""
msgid "Limit the number of issues and epics per minute a user can create through web and API requests."
msgstr ""
msgid "Limit the number of pipeline creation requests per minute. This limit includes pipelines created through the UI, the API, and by background processing."
msgstr ""
msgid "Limit the size of Sidekiq jobs stored in Redis."
msgstr ""
@ -23555,6 +23558,9 @@ msgstr ""
msgid "Maximum number of projects."
msgstr ""
msgid "Maximum number of requests per minute"
msgstr ""
msgid "Maximum number of requests per minute for an authenticated user"
msgstr ""
@ -27553,6 +27559,9 @@ msgstr ""
msgid "Pipeline URL"
msgstr ""
msgid "Pipeline creation rate limits"
msgstr ""
msgid "Pipeline durations for the last 30 commits"
msgstr ""

View File

@ -351,6 +351,17 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set
end
end
end
context 'pipeline creation rate limiting' do
let(:application_settings) { ApplicationSetting.current }
it 'updates pipeline_limit_per_project_user_sha setting' do
put :update, params: { application_setting: { pipeline_limit_per_project_user_sha: 25 } }
expect(response).to redirect_to(general_admin_application_settings_path)
expect(application_settings.reload.pipeline_limit_per_project_user_sha).to eq(25)
end
end
end
describe 'PUT #reset_registration_token' do

View File

@ -653,7 +653,7 @@ RSpec.describe 'Admin updates settings' do
visit network_admin_application_settings_path
page.within('.as-issue-limits') do
fill_in 'Max requests per minute per user', with: 0
fill_in 'Maximum number of requests per minute', with: 0
click_button 'Save changes'
end
@ -661,6 +661,18 @@ RSpec.describe 'Admin updates settings' do
expect(current_settings.issues_create_limit).to eq(0)
end
it 'changes Pipelines rate limits settings' do
visit network_admin_application_settings_path
page.within('.as-pipeline-limits') do
fill_in 'Maximum number of requests per minute', with: 10
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(current_settings.pipeline_limit_per_project_user_sha).to eq(10)
end
it 'changes Users API rate limits settings' do
visit network_admin_application_settings_path

View File

@ -1,11 +1,11 @@
import { GlIntersectionObserver } from '@gitlab/ui';
import { GlBadge, GlIntersectionObserver } from '@gitlab/ui';
import MockAdapter from 'axios-mock-adapter';
import { nextTick } from 'vue';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import '~/behaviors/markdown/render_gfm';
import { IssuableStatus, IssuableStatusText } from '~/issues/constants';
import { IssuableStatus, IssuableStatusText, IssuableType } from '~/issues/constants';
import IssuableApp from '~/issues/show/components/app.vue';
import DescriptionComponent from '~/issues/show/components/description.vue';
import EditedComponent from '~/issues/show/components/edited.vue';
@ -475,6 +475,23 @@ describe('Issuable output', () => {
expect(findStickyHeader().text()).toContain('Sticky header title');
});
it.each`
issuableType | issuableStatus | statusIcon
${IssuableType.Issue} | ${IssuableStatus.Open} | ${'issues'}
${IssuableType.Issue} | ${IssuableStatus.Closed} | ${'issue-closed'}
${IssuableType.Epic} | ${IssuableStatus.Open} | ${'epic'}
${IssuableType.Epic} | ${IssuableStatus.Closed} | ${'epic-closed'}
`(
'shows with state icon "$statusIcon" for $issuableType when status is $issuableStatus',
async ({ issuableType, issuableStatus, statusIcon }) => {
wrapper.setProps({ issuableType, issuableStatus });
await nextTick();
expect(findStickyHeader().findComponent(GlBadge).props('icon')).toBe(statusIcon);
},
);
it.each`
title | state
${'shows with Open when status is opened'} | ${IssuableStatus.Open}

View File

@ -257,7 +257,7 @@ describe('issue_comment_form component', () => {
({ confidential, placeholder }) => {
mountComponent({
mountFunction: mount,
noteableData: createNotableDataMock({ confidential }),
initialData: { noteIsConfidential: confidential },
});
expect(findTextArea().attributes('placeholder')).toBe(placeholder);

Some files were not shown because too many files have changed in this diff Show More