Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-12 18:12:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-12 18:12:27 +0300
commit00d1c402017269aa16bb71deca623a901baa113d (patch)
tree98513760b2550581234c0a8d1cf76be4edbe0bd3
parent3b260cb69f464d8dea681b747dcffdeebee348ff (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/merge_requests/components/sticky_header.vue6
-rw-r--r--app/assets/javascripts/search/sidebar/components/archived_filter/index.vue11
-rw-r--r--app/assets/stylesheets/fonts.scss10
-rw-r--r--app/assets/stylesheets/fonts_optional.scss1
-rw-r--r--app/assets/stylesheets/fonts_swap.scss3
-rw-r--r--app/helpers/application_settings_helper.rb4
-rw-r--r--app/models/application_setting.rb16
-rw-r--r--app/models/application_setting_implementation.rb4
-rw-r--r--app/views/layouts/_head.html.haml5
-rw-r--r--app/views/layouts/_loading_hints.html.haml5
-rw-r--r--app/views/layouts/component_preview.html.haml6
-rw-r--r--config/application.rb3
-rw-r--r--config/events/1651052988_gitlab__usage_data_counters__ci_template_unique_counter_ci_templates_unique.yml22
-rw-r--r--config/events/ci_template_included.yml24
-rw-r--r--config/feature_flags/development/font_display_swap.yml8
-rw-r--r--config/feature_flags/ops/skip_rugged_auto_detect.yml8
-rw-r--r--config/initializers/8_devise.rb12
-rw-r--r--config/metrics/counts_28d/count_distinct_project_id_from_ci_template_included_28d.yml28
-rw-r--r--config/metrics/counts_7d/count_distinct_project_id_from_ci_template_included_7d.yml28
-rw-r--r--db/migrate/20230918122420_add_max_login_attempts_to_application_settings.rb7
-rw-r--r--db/migrate/20230918122430_add_application_settings_max_login_attempts_constraint.rb15
-rw-r--r--db/migrate/20230918122440_add_failed_login_attempts_unlock_period_in_minutes_to_application_settings.rb7
-rw-r--r--db/migrate/20230918122450_add_application_settings_failed_login_attempts_unlock_period_in_minutes_constraint.rb15
-rw-r--r--db/post_migrate/20231003083900_swap_columns_for_ci_pipeline_messages_pipeline_id_bigint.rb57
-rw-r--r--db/schema_migrations/202309181224201
-rw-r--r--db/schema_migrations/202309181224301
-rw-r--r--db/schema_migrations/202309181224401
-rw-r--r--db/schema_migrations/202309181224501
-rw-r--r--db/schema_migrations/202310030839001
-rw-r--r--db/structure.sql8
-rw-r--r--doc/api/settings.md10
-rw-r--r--doc/architecture/blueprints/cells/index.md14
-rw-r--r--doc/ci/troubleshooting.md4
-rw-r--r--lib/api/ci/helpers/runner.rb2
-rw-r--r--lib/gitlab/git/rugged_impl/use_rugged.rb15
-rw-r--r--lib/gitlab/usage_data_counters/ci_template_unique_counter.rb6
-rw-r--r--locale/gitlab.pot3
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb6
-rw-r--r--spec/frontend/search/sidebar/components/archived_filter_spec.js21
-rw-r--r--spec/lib/api/ci/helpers/runner_spec.rb2
-rw-r--r--spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb117
-rw-r--r--spec/lib/gitlab/git/tree_spec.rb20
-rw-r--r--spec/lib/gitlab/usage_data_counters/ci_template_unique_counter_spec.rb16
-rw-r--r--spec/models/application_setting_spec.rb12
-rw-r--r--spec/requests/api/commits_spec.rb4
-rw-r--r--spec/requests/api/settings_spec.rb16
48 files changed, 361 insertions, 237 deletions
diff --git a/app/assets/javascripts/merge_requests/components/sticky_header.vue b/app/assets/javascripts/merge_requests/components/sticky_header.vue
index 24ac67a0964..acb7b8353c0 100644
--- a/app/assets/javascripts/merge_requests/components/sticky_header.vue
+++ b/app/assets/javascripts/merge_requests/components/sticky_header.vue
@@ -14,6 +14,7 @@ import TodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue
import SubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import titleSubscription from '../queries/title.subscription.graphql';
+import { badgeState } from './merge_request_header.vue';
export default {
TYPE_MERGE_REQUEST,
@@ -73,6 +74,9 @@ export default {
activeTab: (state) => state.page.activeTab,
doneFetchingBatchDiscussions: (state) => state.notes.doneFetchingBatchDiscussions,
}),
+ badgeState() {
+ return badgeState;
+ },
issuableId() {
return convertToGraphQLId(TYPENAME_MERGE_REQUEST, this.getNoteableData.id);
},
@@ -125,7 +129,7 @@ export default {
<status-badge
class="gl-align-self-center gl-mr-3"
:issuable-type="$options.TYPE_MERGE_REQUEST"
- :state="getNoteableData.state"
+ :state="badgeState.state"
/>
<a
v-safe-html:[$options.safeHtmlConfig]="titleHtml"
diff --git a/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue b/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue
index ece4a35b864..b0e84beabc4 100644
--- a/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue
+++ b/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue
@@ -1,7 +1,8 @@
<script>
-import { GlFormCheckboxGroup, GlFormCheckbox } from '@gitlab/ui';
+import { GlFormCheckboxGroup, GlFormCheckbox, GlTooltipDirective } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
import { mapState, mapActions } from 'vuex';
+import { s__ } from '~/locale';
import Tracking from '~/tracking';
import { parseBoolean } from '~/lib/utils/common_utils';
@@ -13,6 +14,12 @@ export default {
GlFormCheckboxGroup,
GlFormCheckbox,
},
+ directives: {
+ GlTooltip: GlTooltipDirective,
+ },
+ i18n: {
+ tooltip: s__('GlobalSearch|Include search results from archived projects'),
+ },
computed: {
...mapState(['urlQuery', 'useSidebarNavigation']),
selectedFilter: {
@@ -49,7 +56,7 @@ export default {
:class="$options.LABEL_DEFAULT_CLASSES"
:value="true"
>
- <span data-testid="label">
+ <span v-gl-tooltip="$options.i18n.tooltip" data-testid="label">
{{ $options.archivedFilterData.checkboxLabel }}
</span>
</gl-form-checkbox>
diff --git a/app/assets/stylesheets/fonts.scss b/app/assets/stylesheets/fonts.scss
index 2f7228766b9..6886e751b72 100644
--- a/app/assets/stylesheets/fonts.scss
+++ b/app/assets/stylesheets/fonts.scss
@@ -1,5 +1,3 @@
-$font-display: optional !default;
-
/* -------------------------------------------------------
Inter variable font.
@@ -9,7 +7,7 @@ Usage:
@font-face {
font-family: 'GitLab Sans';
font-weight: 100 900;
- font-display: $font-display;
+ font-display: swap;
font-style: normal;
/* stylelint-disable-next-line property-no-unknown */
font-named-instance: 'Regular';
@@ -19,7 +17,7 @@ Usage:
@font-face {
font-family: 'GitLab Sans';
font-weight: 100 900;
- font-display: $font-display;
+ font-display: swap;
font-style: italic;
/* stylelint-disable-next-line property-no-unknown */
font-named-instance: 'Regular';
@@ -35,7 +33,7 @@ Usage:
@font-face {
font-family: 'GitLab Mono';
font-weight: 100 900;
- font-display: $font-display;
+ font-display: swap;
font-style: normal;
src: font-url('gitlab-mono/GitLabMono.woff2') format('woff2');
}
@@ -43,7 +41,7 @@ Usage:
@font-face {
font-family: 'GitLab Mono';
font-weight: 100 900;
- font-display: $font-display;
+ font-display: swap;
font-style: italic;
src: font-url('gitlab-mono/GitLabMono-Italic.woff2') format('woff2');
}
diff --git a/app/assets/stylesheets/fonts_optional.scss b/app/assets/stylesheets/fonts_optional.scss
deleted file mode 100644
index 2b1a3796bbc..00000000000
--- a/app/assets/stylesheets/fonts_optional.scss
+++ /dev/null
@@ -1 +0,0 @@
-@import 'fonts';
diff --git a/app/assets/stylesheets/fonts_swap.scss b/app/assets/stylesheets/fonts_swap.scss
deleted file mode 100644
index b259b8ad103..00000000000
--- a/app/assets/stylesheets/fonts_swap.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-$font-display: swap;
-
-@import 'fonts';
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 0fd232a6088..e857d81886f 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -282,6 +282,7 @@ module ApplicationSettingsHelper
:external_pipeline_validation_service_timeout,
:external_pipeline_validation_service_token,
:external_pipeline_validation_service_url,
+ :failed_login_attempts_unlock_period_in_minutes,
:first_day_of_week,
:floc_enabled,
:force_pages_access_control,
@@ -316,10 +317,11 @@ module ApplicationSettingsHelper
:jira_connect_proxy_url,
:max_artifacts_size,
:max_attachment_size,
+ :max_decompressed_archive_size,
:max_export_size,
:max_import_size,
:max_import_remote_file_size,
- :max_decompressed_archive_size,
+ :max_login_attempts,
:max_pages_size,
:max_pages_custom_domains_per_project,
:max_terraform_state_size_bytes,
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 4e3c2028c54..14b5973b8b5 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -116,6 +116,10 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
validates :default_branch_protection_defaults, json_schema: { filename: 'default_branch_protection_defaults' }
validates :default_branch_protection_defaults, bytesize: { maximum: -> { DEFAULT_BRANCH_PROTECTIONS_DEFAULT_MAX_SIZE } }
+ validates :failed_login_attempts_unlock_period_in_minutes,
+ allow_nil: true,
+ numericality: { only_integer: true, greater_than: 0 }
+
validates :grafana_url,
system_hook_url: ADDRESSABLE_URL_VALIDATION_OPTIONS.merge({
blocked_message: "is blocked: %{exception_message}. #{GRAFANA_URL_ERROR_MESSAGE}"
@@ -263,6 +267,10 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
presence: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
+ validates :max_login_attempts,
+ allow_nil: true,
+ numericality: { only_integer: true, greater_than: 0 }
+
validates :max_pages_size,
presence: true,
numericality: {
@@ -954,6 +962,14 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
false
end
+ def max_login_attempts_column_exists?
+ self.class.database.cached_column_exists?(:max_login_attempts)
+ end
+
+ def failed_login_attempts_unlock_period_in_minutes_column_exists?
+ self.class.database.cached_column_exists?(:failed_login_attempts_unlock_period_in_minutes)
+ end
+
private
def self.human_attribute_name(attribute, *options)
diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb
index 18f1a53f8aa..06d4aab8b8e 100644
--- a/app/models/application_setting_implementation.rb
+++ b/app/models/application_setting_implementation.rb
@@ -88,6 +88,7 @@ module ApplicationSettingImplementation
external_pipeline_validation_service_timeout: nil,
external_pipeline_validation_service_token: nil,
external_pipeline_validation_service_url: nil,
+ failed_login_attempts_unlock_period_in_minutes: nil,
first_day_of_week: 0,
floc_enabled: false,
gitaly_timeout_default: 55,
@@ -120,10 +121,11 @@ module ApplicationSettingImplementation
mailgun_events_enabled: false,
max_artifacts_size: Settings.artifacts['max_size'],
max_attachment_size: Settings.gitlab['max_attachment_size'],
+ max_decompressed_archive_size: 25600,
max_export_size: 0,
max_import_size: 0,
max_import_remote_file_size: 10240,
- max_decompressed_archive_size: 25600,
+ max_login_attempts: nil,
max_terraform_state_size_bytes: 0,
max_yaml_size_bytes: 1.megabyte,
max_yaml_depth: 100,
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index 267c32e53bd..bb492913346 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -38,10 +38,7 @@
= stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations']
= stylesheet_link_tag "test_environment", media: "all" if Rails.env.test?
- - if ::Feature.enabled?(:font_display_swap, current_user)
- = stylesheet_link_tag_defer "fonts_swap"
- - else
- = stylesheet_link_tag_defer "fonts_optional"
+ = stylesheet_link_tag_defer "fonts"
= stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}"
diff --git a/app/views/layouts/_loading_hints.html.haml b/app/views/layouts/_loading_hints.html.haml
index b6b1fe716db..bf0421e9624 100644
--- a/app/views/layouts/_loading_hints.html.haml
+++ b/app/views/layouts/_loading_hints.html.haml
@@ -20,7 +20,4 @@
%link{ rel: 'preload', href: font_path('gitlab-sans/GitLabSans-Italic.woff2'), as: 'font', crossorigin: css_crossorigin }
%link{ rel: 'preload', href: font_path('gitlab-mono/GitLabMono.woff2'), as: 'font', crossorigin: css_crossorigin }
%link{ rel: 'preload', href: font_path('gitlab-mono/GitLabMono-Italic.woff2'), as: 'font', crossorigin: css_crossorigin }
- - if ::Feature.enabled?(:font_display_swap, current_user)
- = preload_link_tag(path_to_stylesheet('fonts_swap'), crossorigin: css_crossorigin)
- - else
- = preload_link_tag(path_to_stylesheet('fonts_optional'), crossorigin: css_crossorigin)
+ = preload_link_tag(path_to_stylesheet('fonts'), crossorigin: css_crossorigin)
diff --git a/app/views/layouts/component_preview.html.haml b/app/views/layouts/component_preview.html.haml
index 4ef7ba04868..82ad5e3e3bb 100644
--- a/app/views/layouts/component_preview.html.haml
+++ b/app/views/layouts/component_preview.html.haml
@@ -1,4 +1,5 @@
%head
+ = stylesheet_link_tag "fonts"
- if params[:lookbook][:display][:theme] == "light"
= stylesheet_link_tag "application"
= stylesheet_link_tag "application_utilities"
@@ -6,11 +7,6 @@
= stylesheet_link_tag "application_dark"
= stylesheet_link_tag "application_utilities_dark"
- - if ::Feature.enabled?(:font_display_swap, current_user)
- = stylesheet_link_tag_defer "fonts_swap"
- - else
- = stylesheet_link_tag_defer "fonts_optional"
-
%body
.gl-mt-6{ class: (params[:lookbook][:display][:layout] == "fluid" ? "container-fluid" : "container") }
- if params[:lookbook][:display][:bg_dark]
diff --git a/config/application.rb b/config/application.rb
index bc4809d0c53..4d62e39b931 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -368,8 +368,7 @@ module Gitlab
config.assets.precompile << "disable_animations.css"
config.assets.precompile << "test_environment.css"
config.assets.precompile << "snippets.css"
- config.assets.precompile << "fonts_optional.css"
- config.assets.precompile << "fonts_swap.css"
+ config.assets.precompile << "fonts.css"
config.assets.precompile << "locale/**/app.js"
config.assets.precompile << "emoji_sprites.css"
config.assets.precompile << "errors.css"
diff --git a/config/events/1651052988_gitlab__usage_data_counters__ci_template_unique_counter_ci_templates_unique.yml b/config/events/1651052988_gitlab__usage_data_counters__ci_template_unique_counter_ci_templates_unique.yml
deleted file mode 100644
index df807768090..00000000000
--- a/config/events/1651052988_gitlab__usage_data_counters__ci_template_unique_counter_ci_templates_unique.yml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-description: Run Pipeline
-category: Gitlab::UsageDataCounters::CiTemplateUniqueCounter
-action: ci_templates_unique
-label_description:
-property_description:
-value_description:
-extra_properties:
-identifiers:
-product_section: ops
-product_stage: deploy
-product_group: group::environments
-milestone: "15.0"
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84337
-distributions:
-- ce
-- ee
-tiers:
-- free
-- premium
-- ultimate
-
diff --git a/config/events/ci_template_included.yml b/config/events/ci_template_included.yml
new file mode 100644
index 00000000000..a00fdc628b0
--- /dev/null
+++ b/config/events/ci_template_included.yml
@@ -0,0 +1,24 @@
+---
+description: When a pipeline is created with a CI Template file included in its configuration.
+category: InternalEventTracking
+action: ci_template_included
+label_description:
+property_description:
+value_description:
+extra_properties:
+identifiers:
+- project
+- user
+- namespace
+product_section: ops
+product_stage: verify
+product_group: pipeline_authoring
+milestone: "16.5"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132819
+distributions:
+- ce
+- ee
+tiers:
+- free
+- premium
+- ultimate
diff --git a/config/feature_flags/development/font_display_swap.yml b/config/feature_flags/development/font_display_swap.yml
deleted file mode 100644
index cabe3ca614a..00000000000
--- a/config/feature_flags/development/font_display_swap.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: font_display_swap
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132798
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/426437
-milestone: '16.5'
-type: development
-group: group::foundations
-default_enabled: false
diff --git a/config/feature_flags/ops/skip_rugged_auto_detect.yml b/config/feature_flags/ops/skip_rugged_auto_detect.yml
deleted file mode 100644
index 57da3bba4ea..00000000000
--- a/config/feature_flags/ops/skip_rugged_auto_detect.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: skip_rugged_auto_detect
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95330
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/370708
-milestone: '15.3'
-type: ops
-group: group::gitaly
-default_enabled: true
diff --git a/config/initializers/8_devise.rb b/config/initializers/8_devise.rb
index 3682a391033..9ea26602a13 100644
--- a/config/initializers/8_devise.rb
+++ b/config/initializers/8_devise.rb
@@ -162,10 +162,18 @@ Devise.setup do |config|
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
- config.maximum_attempts = 10
+ config.maximum_attempts = if Gitlab::CurrentSettings.max_login_attempts_column_exists?
+ (Gitlab::CurrentSettings.max_login_attempts || 10)
+ else
+ 10
+ end
# Time interval to unlock the account if :time is enabled as unlock_strategy.
- config.unlock_in = 10.minutes
+ config.unlock_in = if Gitlab::CurrentSettings.failed_login_attempts_unlock_period_in_minutes_column_exists?
+ (Gitlab::CurrentSettings.failed_login_attempts_unlock_period_in_minutes || 10).minutes
+ else
+ 10.minutes
+ end
# ==> Configuration for :recoverable
#
diff --git a/config/metrics/counts_28d/count_distinct_project_id_from_ci_template_included_28d.yml b/config/metrics/counts_28d/count_distinct_project_id_from_ci_template_included_28d.yml
new file mode 100644
index 00000000000..6050662f99c
--- /dev/null
+++ b/config/metrics/counts_28d/count_distinct_project_id_from_ci_template_included_28d.yml
@@ -0,0 +1,28 @@
+---
+key_path: redis_hll_counters.ci_templates.count_distinct_project_id_from_ci_template_included_28d
+description: Monthly count of unique projects that created a pipeline with a CI Template included.
+product_section: ops
+product_stage: verify
+product_group: pipeline_authoring
+performance_indicator_type: []
+value_type: number
+status: active
+milestone: "16.5"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132819
+time_frame: 28d
+data_source: internal_events
+data_category: optional
+instrumentation_class: RedisHLLMetric
+distribution:
+- ce
+- ee
+tier:
+- free
+- premium
+- ultimate
+options:
+ events:
+ - ci_template_included
+events:
+ - name: ci_template_included
+ unique: project.id
diff --git a/config/metrics/counts_7d/count_distinct_project_id_from_ci_template_included_7d.yml b/config/metrics/counts_7d/count_distinct_project_id_from_ci_template_included_7d.yml
new file mode 100644
index 00000000000..4c6be227130
--- /dev/null
+++ b/config/metrics/counts_7d/count_distinct_project_id_from_ci_template_included_7d.yml
@@ -0,0 +1,28 @@
+---
+key_path: redis_hll_counters.ci_templates.count_distinct_project_id_from_ci_template_included_7d
+description: Weekly count of unique projects that created a pipeline with a CI Template included.
+product_section: ops
+product_stage: verify
+product_group: pipeline_authoring
+performance_indicator_type: []
+value_type: number
+status: active
+milestone: "16.5"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132819
+time_frame: 7d
+data_source: internal_events
+data_category: optional
+instrumentation_class: RedisHLLMetric
+distribution:
+- ce
+- ee
+tier:
+- free
+- premium
+- ultimate
+options:
+ events:
+ - ci_template_included
+events:
+ - name: ci_template_included
+ unique: project.id
diff --git a/db/migrate/20230918122420_add_max_login_attempts_to_application_settings.rb b/db/migrate/20230918122420_add_max_login_attempts_to_application_settings.rb
new file mode 100644
index 00000000000..b880d340a20
--- /dev/null
+++ b/db/migrate/20230918122420_add_max_login_attempts_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddMaxLoginAttemptsToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :application_settings, :max_login_attempts, :integer, null: true
+ end
+end
diff --git a/db/migrate/20230918122430_add_application_settings_max_login_attempts_constraint.rb b/db/migrate/20230918122430_add_application_settings_max_login_attempts_constraint.rb
new file mode 100644
index 00000000000..46cf77f5c90
--- /dev/null
+++ b/db/migrate/20230918122430_add_application_settings_max_login_attempts_constraint.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddApplicationSettingsMaxLoginAttemptsConstraint < Gitlab::Database::Migration[2.1]
+ CONSTRAINT_NAME = 'app_settings_max_login_attempts_positive'
+
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint :application_settings, 'max_login_attempts > 0', CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :application_settings, CONSTRAINT_NAME
+ end
+end
diff --git a/db/migrate/20230918122440_add_failed_login_attempts_unlock_period_in_minutes_to_application_settings.rb b/db/migrate/20230918122440_add_failed_login_attempts_unlock_period_in_minutes_to_application_settings.rb
new file mode 100644
index 00000000000..80d5934cdba
--- /dev/null
+++ b/db/migrate/20230918122440_add_failed_login_attempts_unlock_period_in_minutes_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddFailedLoginAttemptsUnlockPeriodInMinutesToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :application_settings, :failed_login_attempts_unlock_period_in_minutes, :integer, null: true
+ end
+end
diff --git a/db/migrate/20230918122450_add_application_settings_failed_login_attempts_unlock_period_in_minutes_constraint.rb b/db/migrate/20230918122450_add_application_settings_failed_login_attempts_unlock_period_in_minutes_constraint.rb
new file mode 100644
index 00000000000..3c0e68b4444
--- /dev/null
+++ b/db/migrate/20230918122450_add_application_settings_failed_login_attempts_unlock_period_in_minutes_constraint.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddApplicationSettingsFailedLoginAttemptsUnlockPeriodInMinutesConstraint < Gitlab::Database::Migration[2.1]
+ CONSTRAINT_NAME = 'app_settings_failed_login_attempts_unlock_period_positive'
+
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint :application_settings, 'failed_login_attempts_unlock_period_in_minutes > 0', CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :application_settings, CONSTRAINT_NAME
+ end
+end
diff --git a/db/post_migrate/20231003083900_swap_columns_for_ci_pipeline_messages_pipeline_id_bigint.rb b/db/post_migrate/20231003083900_swap_columns_for_ci_pipeline_messages_pipeline_id_bigint.rb
new file mode 100644
index 00000000000..678ff479687
--- /dev/null
+++ b/db/post_migrate/20231003083900_swap_columns_for_ci_pipeline_messages_pipeline_id_bigint.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+class SwapColumnsForCiPipelineMessagesPipelineIdBigint < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_pipeline_messages
+ TARGET_TABLE_NAME = :ci_pipelines
+ TRIGGER_FUNCTION_NAME = :trigger_bfad0e2b9c86
+ COLUMN_NAME = :pipeline_id
+ BIGINT_COLUMN_NAME = :pipeline_id_convert_to_bigint
+ FK_NAME = :fk_rails_8d3b04e3e1
+ BIGINT_FK_NAME = :fk_0946fea681
+ INDEX_NAME = :index_ci_pipeline_messages_on_pipeline_id
+ BIGINT_INDEX_NAME = :index_ci_pipeline_messages_on_pipeline_id_convert_to_bigint
+
+ def up
+ swap
+ end
+
+ def down
+ swap
+ end
+
+ private
+
+ def swap
+ with_lock_retries(raise_on_exhaustion: true) do
+ # Lock the tables involved.
+ execute "LOCK TABLE #{TARGET_TABLE_NAME}, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ # Rename the columns to swap names
+ temp_name = "temp_#{COLUMN_NAME}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN #{COLUMN_NAME} TO #{temp_name}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN #{BIGINT_COLUMN_NAME} TO #{COLUMN_NAME}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN #{temp_name} TO #{BIGINT_COLUMN_NAME}"
+
+ # Reset the trigger function
+ execute "ALTER FUNCTION #{quote_column_name(TRIGGER_FUNCTION_NAME)} RESET ALL"
+
+ # Swap the defaults
+ change_column_default TABLE_NAME, COLUMN_NAME, nil
+ change_column_default TABLE_NAME, BIGINT_COLUMN_NAME, 0
+
+ # Swap fkey constraint
+ temp_fk_name = "temp_#{FK_NAME}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME CONSTRAINT #{FK_NAME} TO #{temp_fk_name}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME CONSTRAINT #{BIGINT_FK_NAME} TO #{FK_NAME}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME CONSTRAINT #{temp_fk_name} TO #{BIGINT_FK_NAME}"
+
+ # Swap index
+ temp_index_name = "temp_#{INDEX_NAME}"
+ execute "ALTER INDEX #{INDEX_NAME} RENAME TO #{temp_index_name}"
+ execute "ALTER INDEX #{BIGINT_INDEX_NAME} RENAME TO #{INDEX_NAME}"
+ execute "ALTER INDEX #{temp_index_name} RENAME TO #{BIGINT_INDEX_NAME}"
+ end
+ end
+end
diff --git a/db/schema_migrations/20230918122420 b/db/schema_migrations/20230918122420
new file mode 100644
index 00000000000..b4a2571ce38
--- /dev/null
+++ b/db/schema_migrations/20230918122420
@@ -0,0 +1 @@
+ca7bee52564b9babd609d36fc42dbd78a78f8a7c46a94209b533150057985eed \ No newline at end of file
diff --git a/db/schema_migrations/20230918122430 b/db/schema_migrations/20230918122430
new file mode 100644
index 00000000000..3ca0a24e5bb
--- /dev/null
+++ b/db/schema_migrations/20230918122430
@@ -0,0 +1 @@
+8f1ad1125107ba9ccffb3ae9c16deab01e8efbd858a79a120e519bad409ba53c \ No newline at end of file
diff --git a/db/schema_migrations/20230918122440 b/db/schema_migrations/20230918122440
new file mode 100644
index 00000000000..b14853b530d
--- /dev/null
+++ b/db/schema_migrations/20230918122440
@@ -0,0 +1 @@
+9db2207a1a2a6240447d06d739da54e4ca13127860cc53a76ea19d9c2945667c \ No newline at end of file
diff --git a/db/schema_migrations/20230918122450 b/db/schema_migrations/20230918122450
new file mode 100644
index 00000000000..d922d6d0645
--- /dev/null
+++ b/db/schema_migrations/20230918122450
@@ -0,0 +1 @@
+fbfdb13d18c011b1a1936cece6b9f7bab96add19b60e556bf922cb276076b0f4 \ No newline at end of file
diff --git a/db/schema_migrations/20231003083900 b/db/schema_migrations/20231003083900
new file mode 100644
index 00000000000..20390cbb9f3
--- /dev/null
+++ b/db/schema_migrations/20231003083900
@@ -0,0 +1 @@
+1c4c519d896e77fe5bbd7f6fb301e075fef28c11a27a16f4450db4b3e1963697 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 90dafad1dc7..324888e9173 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -11851,6 +11851,8 @@ CREATE TABLE application_settings (
search_rate_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
snowplow_database_collector_hostname text,
container_registry_db_enabled boolean DEFAULT false NOT NULL,
+ failed_login_attempts_unlock_period_in_minutes integer,
+ max_login_attempts integer,
encrypted_vertex_ai_access_token bytea,
encrypted_vertex_ai_access_token_iv bytea,
project_jobs_api_rate_limit integer DEFAULT 600 NOT NULL,
@@ -11858,9 +11860,11 @@ CREATE TABLE application_settings (
CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)),
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)),
+ CONSTRAINT app_settings_failed_login_attempts_unlock_period_positive CHECK ((failed_login_attempts_unlock_period_in_minutes > 0)),
CONSTRAINT app_settings_git_rate_limit_users_alertlist_max_usernames CHECK ((cardinality(git_rate_limit_users_alertlist) <= 100)),
CONSTRAINT app_settings_git_rate_limit_users_allowlist_max_usernames CHECK ((cardinality(git_rate_limit_users_allowlist) <= 100)),
CONSTRAINT app_settings_max_decompressed_archive_size_positive CHECK ((max_decompressed_archive_size >= 0)),
+ CONSTRAINT app_settings_max_login_attempts_positive CHECK ((max_login_attempts > 0)),
CONSTRAINT app_settings_max_pages_custom_domains_per_project_check CHECK ((max_pages_custom_domains_per_project >= 0)),
CONSTRAINT app_settings_max_terraform_state_size_bytes_check CHECK ((max_terraform_state_size_bytes >= 0)),
CONSTRAINT app_settings_p_cleanup_package_file_worker_capacity_positive CHECK ((packages_cleanup_package_file_worker_capacity >= 0)),
@@ -13788,9 +13792,9 @@ ALTER SEQUENCE ci_pipeline_chat_data_id_seq OWNED BY ci_pipeline_chat_data.id;
CREATE TABLE ci_pipeline_messages (
id bigint NOT NULL,
severity smallint DEFAULT 0 NOT NULL,
- pipeline_id integer NOT NULL,
+ pipeline_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
content text NOT NULL,
- pipeline_id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
+ pipeline_id bigint NOT NULL,
CONSTRAINT check_58ca2981b2 CHECK ((char_length(content) <= 10000))
);
diff --git a/doc/api/settings.md b/doc/api/settings.md
index 15c5eea43ee..b5551962644 100644
--- a/doc/api/settings.md
+++ b/doc/api/settings.md
@@ -40,14 +40,16 @@ Example response:
"id" : 1,
"default_branch_protection" : 2,
"default_preferred_language" : "en",
+ "failed_login_attempts_unlock_period_in_minutes": 30,
"restricted_visibility_levels" : [],
"password_authentication_enabled_for_web" : true,
"after_sign_out_path" : null,
"max_attachment_size" : 10,
+ "max_decompressed_archive_size": 25600,
"max_export_size": 50,
"max_import_size": 50,
"max_import_remote_file_size": 10240,
- "max_decompressed_archive_size": 25600,
+ "max_login_attempts": 3,
"user_oauth_applications" : true,
"updated_at" : "2016-01-04T15:44:55.176Z",
"session_expire_delay" : 10080,
@@ -174,6 +176,7 @@ Example response:
"id": 1,
"default_projects_limit": 100000,
"default_preferred_language": "en",
+ "failed_login_attempts_unlock_period_in_minutes": 30,
"signup_enabled": false,
"password_authentication_enabled_for_web": true,
"gravatar_enabled": true,
@@ -183,10 +186,11 @@ Example response:
"default_branch_protection": 2,
"restricted_visibility_levels": [],
"max_attachment_size": 10,
+ "max_decompressed_archive_size": 25600,
"max_export_size": 50,
"max_import_size": 50,
"max_import_remote_file_size": 10240,
- "max_decompressed_archive_size": 25600,
+ "max_login_attempts": 3,
"session_expire_delay": 10080,
"default_ci_config_path" : null,
"default_project_visibility": "internal",
@@ -416,6 +420,7 @@ listed in the descriptions of the relevant settings.
| `external_pipeline_validation_service_timeout` | integer | no | How long to wait for a response from the pipeline validation service. Assumes `OK` if it times out. |
| `static_objects_external_storage_url` | string | no | URL to an external storage for repository static objects. |
| `static_objects_external_storage_auth_token` | string | required by: `static_objects_external_storage_url` | Authentication token for the external storage linked in `static_objects_external_storage_url`. |
+| `failed_login_attempts_unlock_period_in_minutes` | integer | no | Time period in minutes after which the user is unlocked when maximum number of failed sign-in attempts reached. |
| `file_template_project_id` **(PREMIUM ALL)** | integer | no | The ID of a project to load custom file templates from. |
| `first_day_of_week` | integer | no | Start day of the week for calendar views and date pickers. Valid values are `0` (default) for Sunday, `1` for Monday, and `6` for Saturday. |
| `globally_allowed_ips` | string | no | Comma-separated list of IP addresses and CIDRs always allowed for inbound traffic. For example, `1.1.1.1, 2.2.2.0/24`. |
@@ -460,6 +465,7 @@ listed in the descriptions of the relevant settings.
| `max_export_size` | integer | no | Maximum export size in MB. 0 for unlimited. Default = 0 (unlimited). |
| `max_import_size` | integer | no | Maximum import size in MB. 0 for unlimited. Default = 0 (unlimited). [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/251106) from 50 MB to 0 in GitLab 13.8. |
| `max_import_remote_file_size` | integer | no | Maximum remote file size for imports from external object storages. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/384976) in GitLab 16.3. |
+| `max_login_attempts` | integer | no | Maximum number of sign-in attempts before locking out the user. |
| `max_pages_size` | integer | no | Maximum size of pages repositories in MB. |
| `max_personal_access_token_lifetime` **(ULTIMATE SELF)** | integer | no | Maximum allowable lifetime for access tokens in days. When left blank, default value of 365 is applied. When set, value must be 365 or less. When changed, existing access tokens with an expiration date beyond the maximum allowable lifetime are revoked.|
| `max_ssh_key_lifetime` **(ULTIMATE SELF)** | integer | no | Maximum allowable lifetime for SSH keys in days. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/1007) in GitLab 14.6. |
diff --git a/doc/architecture/blueprints/cells/index.md b/doc/architecture/blueprints/cells/index.md
index 83e2bad8d09..1366d308487 100644
--- a/doc/architecture/blueprints/cells/index.md
+++ b/doc/architecture/blueprints/cells/index.md
@@ -121,9 +121,13 @@ The first 2-3 quarters are required to define a general split of data and build
The purpose is that `ci_pipelines` (like `ci_stages`, `ci_builds`, `ci_job_artifacts`) and adjacent tables are properly attributed to be Cell-local.
-1. **User can create issue, merge request, and merge it after it is green.**
+1. **User can create issue.**
- The purpose is to ensure that `issues` and `merge requests` are properly attributed to be `Cell-local`.
+ The purpose is to ensure that `issues` are properly attributed to be `Cell-local`.
+
+1. **User can create merge request, and merge it after it is green.**
+
+ The purpose is to ensure `merge requests` are properly attributed to be `Cell-local`.
1. **User can manage Group and Project members.**
@@ -284,7 +288,7 @@ One iteration describes one quarter's worth of work.
1. [Iteration 4](https://gitlab.com/groups/gitlab-org/-/epics/10998) - Expected delivery: 16.10 FY25Q1 - Planned
- - Essential workflows: User can create organization on Cell 2.
+ - Essential workflows: User can create Organization on Cell 2.
- Data access layer: Cluster-unique identifiers.
- Data access layer: Evaluate the efficiency of database-level access vs. API-oriented access layer.
- Data access layer: Data access layer.
@@ -294,11 +298,11 @@ One iteration describes one quarter's worth of work.
1. Iteration 5..N - starting FY25Q1
- Essential workflows: User can push to Git repository.
- - Essential workflows: User can create issue, merge request, and merge it after it is green.
- Essential workflows: User can run CI pipeline.
- Essential workflows: Instance-wide settings are shared across cluster.
- Essential workflows: User can change profile avatar that is shared in cluster.
- - Essential workflows: User can create issue, merge request, and merge it after it is green.
+ - Essential workflows: User can create issue.
+ - Essential workflows: User can create merge request, and merge it after it is green.
- Essential workflows: User can manage Group and Project members.
- Essential workflows: User can manage instance-wide runners.
- Essential workflows: User is part of Organization and can only see information from the Organization.
diff --git a/doc/ci/troubleshooting.md b/doc/ci/troubleshooting.md
index e0b8c6213de..24e3e6ad315 100644
--- a/doc/ci/troubleshooting.md
+++ b/doc/ci/troubleshooting.md
@@ -241,8 +241,8 @@ The configuration can be added to:
...
environment = [
"GIT_CONFIG_COUNT=1",
- "GIT_CONFIG_KEY_1=http.version",
- "GIT_CONFIG_VALUE_1=HTTP/1.1"
+ "GIT_CONFIG_KEY_0=http.version",
+ "GIT_CONFIG_VALUE_0=HTTP/1.1"
]
```
diff --git a/lib/api/ci/helpers/runner.rb b/lib/api/ci/helpers/runner.rb
index 542b2390df2..382528c814c 100644
--- a/lib/api/ci/helpers/runner.rb
+++ b/lib/api/ci/helpers/runner.rb
@@ -55,7 +55,7 @@ module API
def current_runner_manager
strong_memoize(:current_runner_manager) do
system_xid = params.fetch(:system_id, LEGACY_SYSTEM_XID)
- current_runner&.ensure_manager(system_xid) { |m| m.contacted_at = Time.current }
+ current_runner&.ensure_manager(system_xid)
end
end
diff --git a/lib/gitlab/git/rugged_impl/use_rugged.rb b/lib/gitlab/git/rugged_impl/use_rugged.rb
index 632b4133f2e..57cced97d02 100644
--- a/lib/gitlab/git/rugged_impl/use_rugged.rb
+++ b/lib/gitlab/git/rugged_impl/use_rugged.rb
@@ -4,15 +4,8 @@ module Gitlab
module Git
module RuggedImpl
module UseRugged
- def use_rugged?(repo, feature_key)
- return Feature.enabled?(feature_key) if Feature.persisted_name?(feature_key)
-
- # Disable Rugged auto-detect(can_use_disk?) when Puma threads>1
- # https://gitlab.com/gitlab-org/gitlab/issues/119326
- return false if running_puma_with_multiple_threads?
- return false if Feature.enabled?(:skip_rugged_auto_detect, type: :ops)
-
- Gitlab::GitalyClient.can_use_disk?(repo.storage)
+ def use_rugged?(_, _)
+ false
end
def execute_rugged_call(method_name, *args)
@@ -49,9 +42,7 @@ module Gitlab
end
def rugged_enabled_through_feature_flag?
- rugged_feature_keys.any? do |feature_key|
- Feature.enabled?(feature_key)
- end
+ false
end
end
end
diff --git a/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb b/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb
index eb141a2e2f6..e0a4f879f48 100644
--- a/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb
+++ b/lib/gitlab/usage_data_counters/ci_template_unique_counter.rb
@@ -13,11 +13,7 @@ module Gitlab::UsageDataCounters
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: project.id)
namespace = project.namespace
- context = Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll,
- event: event_name).to_context
- label = 'redis_hll_counters.ci_templates.ci_templates_total_unique_counts_monthly'
- Gitlab::Tracking.event(name, 'ci_templates_unique', namespace: namespace,
- project: project, context: [context], user: user, label: label)
+ Gitlab::InternalEvents.track_event('ci_template_included', namespace: namespace, project: project, user: user)
end
def ci_templates(relative_base = 'lib/gitlab/ci/templates')
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 3a88549292e..e973a940b82 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -22024,6 +22024,9 @@ msgstr ""
msgid "GlobalSearch|Include archived"
msgstr ""
+msgid "GlobalSearch|Include search results from archived projects"
+msgstr ""
+
msgid "GlobalSearch|Incremental indexing queue length"
msgstr ""
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb
index 2c33d777b0f..5c5d1d45dc0 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb
@@ -1,7 +1,11 @@
# frozen_string_literal: true
module QA
- RSpec.describe 'Create', :reliable, product_group: :source_code do
+ RSpec.describe 'Create', :reliable, product_group: :source_code,
+ quarantine: {
+ type: :investigating,
+ issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/427992"
+ } do
describe 'Multiple file snippet' do
let(:first_file_content) { 'First file content' }
let(:second_file_content) { 'Second file content' }
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
index 2bfc4d3af69..f080f12d40c 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
@@ -2,7 +2,11 @@
module QA
RSpec.describe 'Create' do
- describe 'Multiple file snippet', :reliable, product_group: :source_code do
+ describe 'Multiple file snippet', :reliable, product_group: :source_code,
+ quarantine: {
+ type: :investigating,
+ issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/427992"
+ } do
let(:snippet) do
Resource::Snippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Personal snippet with multiple files'
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
index 7e182fc2020..1a65676840b 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb
@@ -2,7 +2,11 @@
module QA
RSpec.describe 'Create' do
- describe 'Sharing snippets', :reliable, product_group: :source_code do
+ describe 'Sharing snippets', :reliable, product_group: :source_code,
+ quarantine: {
+ type: :investigating,
+ issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/427992"
+ } do
let(:snippet) do
Resource::Snippet.fabricate! do |snippet|
snippet.title = 'Shared snippet'
diff --git a/spec/frontend/search/sidebar/components/archived_filter_spec.js b/spec/frontend/search/sidebar/components/archived_filter_spec.js
index a4c1f3b758f..9ed677ca297 100644
--- a/spec/frontend/search/sidebar/components/archived_filter_spec.js
+++ b/spec/frontend/search/sidebar/components/archived_filter_spec.js
@@ -1,8 +1,9 @@
-import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
// eslint-disable-next-line no-restricted-imports
import Vuex from 'vuex';
import { GlFormCheckboxGroup } from '@gitlab/ui';
+import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
+import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import ArchivedFilter from '~/search/sidebar/components/archived_filter/index.vue';
import { archivedFilterData } from '~/search/sidebar/components/archived_filter/data';
@@ -22,12 +23,16 @@ describe('ArchivedFilter', () => {
actions: defaultActions,
});
- wrapper = shallowMount(ArchivedFilter, {
+ wrapper = shallowMountExtended(ArchivedFilter, {
store,
+ directives: {
+ GlTooltip: createMockDirective('gl-tooltip'),
+ },
});
};
const findCheckboxFilter = () => wrapper.findComponent(GlFormCheckboxGroup);
+ const findCheckboxFilterLabel = () => wrapper.findByTestId('label');
const findH5 = () => wrapper.findComponent('h5');
describe('old sidebar', () => {
@@ -43,6 +48,12 @@ describe('ArchivedFilter', () => {
expect(findH5().exists()).toBe(true);
expect(findH5().text()).toBe(archivedFilterData.headerLabel);
});
+
+ it('wraps the label element with a tooltip', () => {
+ const tooltip = getBinding(findCheckboxFilterLabel().element, 'gl-tooltip');
+ expect(tooltip).toBeDefined();
+ expect(tooltip.value).toBe('Include search results from archived projects');
+ });
});
describe('new sidebar', () => {
@@ -58,6 +69,12 @@ describe('ArchivedFilter', () => {
expect(findH5().exists()).toBe(true);
expect(findH5().text()).toBe(archivedFilterData.headerLabel);
});
+
+ it('wraps the label element with a tooltip', () => {
+ const tooltip = getBinding(findCheckboxFilterLabel().element, 'gl-tooltip');
+ expect(tooltip).toBeDefined();
+ expect(tooltip.value).toBe('Include search results from archived projects');
+ });
});
describe.each`
diff --git a/spec/lib/api/ci/helpers/runner_spec.rb b/spec/lib/api/ci/helpers/runner_spec.rb
index 70504a58af3..b74f5bf2de8 100644
--- a/spec/lib/api/ci/helpers/runner_spec.rb
+++ b/spec/lib/api/ci/helpers/runner_spec.rb
@@ -111,7 +111,7 @@ RSpec.describe API::Ci::Helpers::Runner do
expect(current_runner_manager).not_to be_nil
expect(current_runner_manager.system_xid).to eq('new_system_id')
- expect(current_runner_manager.contacted_at).to eq(Time.current)
+ expect(current_runner_manager.contacted_at).to be_nil
expect(current_runner_manager.runner).to eq(runner)
end
diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
index d320b9c4091..d5a0ab3d5e0 100644
--- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
+++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
@@ -1,18 +1,11 @@
# frozen_string_literal: true
require 'spec_helper'
-require 'json'
-require 'tempfile'
RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:feature_flag_name) { wrapper.rugged_feature_keys.first }
- let(:temp_gitaly_metadata_file) { create_temporary_gitaly_metadata_file }
-
- before_all do
- create_gitaly_metadata_file
- end
subject(:wrapper) do
klazz = Class.new do
@@ -24,11 +17,6 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do
klazz.new
end
- before do
- allow(Gitlab::GitalyClient).to receive(:can_use_disk?).and_call_original
- Gitlab::GitalyClient.instance_variable_set(:@can_use_disk, {})
- end
-
describe '#execute_rugged_call', :request_store do
let(:args) { ['refs/heads/master', 1] }
@@ -46,83 +34,9 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do
end
end
- context 'when feature flag is not persisted', stub_feature_flags: false do
- context 'when running puma with multiple threads' do
- before do
- allow(subject).to receive(:running_puma_with_multiple_threads?).and_return(true)
- end
-
- it 'returns false' do
- expect(subject.use_rugged?(repository, feature_flag_name)).to be false
- end
- end
-
- context 'when skip_rugged_auto_detect feature flag is enabled' do
- context 'when not running puma with multiple threads' do
- before do
- allow(subject).to receive(:running_puma_with_multiple_threads?).and_return(false)
- stub_feature_flags(feature_flag_name => nil)
- stub_feature_flags(skip_rugged_auto_detect: true)
- end
-
- it 'returns false' do
- expect(subject.use_rugged?(repository, feature_flag_name)).to be false
- end
- end
- end
-
- context 'when skip_rugged_auto_detect feature flag is disabled' do
- before do
- stub_feature_flags(skip_rugged_auto_detect: false)
- end
-
- context 'when not running puma with multiple threads' do
- before do
- allow(subject).to receive(:running_puma_with_multiple_threads?).and_return(false)
- end
-
- it 'returns true when gitaly matches disk' do
- expect(subject.use_rugged?(repository, feature_flag_name)).to be true
- end
-
- it 'returns false when disk access fails' do
- allow(Gitlab::GitalyClient).to receive(:storage_metadata_file_path).and_return("/fake/path/doesnt/exist")
-
- expect(subject.use_rugged?(repository, feature_flag_name)).to be false
- end
-
- it "returns false when gitaly doesn't match disk" do
- allow(Gitlab::GitalyClient).to receive(:storage_metadata_file_path).and_return(temp_gitaly_metadata_file)
-
- expect(subject.use_rugged?(repository, feature_flag_name)).to be_falsey
-
- File.delete(temp_gitaly_metadata_file)
- end
-
- it "doesn't lead to a second rpc call because gitaly client should use the cached value" do
- expect(subject.use_rugged?(repository, feature_flag_name)).to be true
-
- expect(Gitlab::GitalyClient).not_to receive(:filesystem_id)
-
- subject.use_rugged?(repository, feature_flag_name)
- end
- end
- end
- end
-
- context 'when feature flag is persisted' do
- it 'returns false when the feature flag is off' do
- Feature.disable(feature_flag_name)
-
- expect(subject.use_rugged?(repository, feature_flag_name)).to be_falsey
- end
-
- it "returns true when feature flag is on" do
- Feature.enable(feature_flag_name)
-
- allow(Gitlab::GitalyClient).to receive(:can_use_disk?).and_return(false)
-
- expect(subject.use_rugged?(repository, feature_flag_name)).to be true
+ describe '#use_rugged?' do
+ it 'returns false' do
+ expect(subject.use_rugged?(repository, feature_flag_name)).to be false
end
end
@@ -184,7 +98,7 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do
context 'all features are enabled' do
let(:feature_keys) { [:feature_key_1, :feature_key_2] }
- it { is_expected.to be_truthy }
+ it { is_expected.to be_falsey }
end
context 'all features are not enabled' do
@@ -196,28 +110,7 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged, feature_category: :gitaly do
context 'some feature is enabled' do
let(:feature_keys) { [:feature_key_4, :feature_key_2] }
- it { is_expected.to be_truthy }
- end
- end
-
- def create_temporary_gitaly_metadata_file
- tmp = Tempfile.new('.gitaly-metadata')
- gitaly_metadata = {
- "gitaly_filesystem_id" => "some-value"
- }
- tmp.write(gitaly_metadata.to_json)
- tmp.flush
- tmp.close
- tmp.path
- end
-
- def create_gitaly_metadata_file
- metadata_filename = File.join(TestEnv.repos_path, '.gitaly-metadata')
- File.open(metadata_filename, 'w+') do |f|
- gitaly_metadata = {
- "gitaly_filesystem_id" => SecureRandom.uuid
- }
- f.write(gitaly_metadata.to_json)
+ it { is_expected.to be_falsey }
end
end
end
diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb
index 896339be0e3..9675e48a77f 100644
--- a/spec/lib/gitlab/git/tree_spec.rb
+++ b/spec/lib/gitlab/git/tree_spec.rb
@@ -194,9 +194,9 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
end
describe '.where with Rugged enabled', :enable_rugged do
- it 'calls out to the Rugged implementation' do
+ it 'does not call to the Rugged implementation' do
allow_next_instance_of(Rugged) do |instance|
- allow(instance).to receive(:lookup).with(SeedRepo::Commit::ID)
+ allow(instance).not_to receive(:lookup)
end
described_class.where(repository, SeedRepo::Commit::ID, 'files', false, false)
@@ -216,10 +216,10 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
context 'when limit is equal to number of entries' do
let(:entries_count) { entries.count }
- it 'returns all entries without a cursor' do
+ it 'returns all entries with a cursor' do
result, cursor = Gitlab::Git::Tree.where(repository, sha, path, recursive, skip_flat_paths, rescue_not_found, { limit: entries_count, page_token: nil })
- expect(cursor).to be_nil
+ expect(cursor).to eq(Gitaly::PaginationCursor.new)
expect(result.entries.count).to eq(entries_count)
end
end
@@ -236,9 +236,9 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
context 'when limit is missing' do
let(:pagination_params) { { limit: nil, page_token: nil } }
- it 'returns empty result' do
- expect(entries).to eq([])
- expect(cursor).to be_nil
+ it 'returns all entries' do
+ expect(entries.count).to be < 20
+ expect(cursor).to eq(Gitaly::PaginationCursor.new)
end
end
@@ -249,7 +249,7 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
result, cursor = Gitlab::Git::Tree.where(repository, sha, path, recursive, skip_flat_paths, rescue_not_found, { limit: -1, page_token: nil })
expect(result.count).to eq(entries_count)
- expect(cursor).to be_nil
+ expect(cursor).to eq(Gitaly::PaginationCursor.new)
end
context 'when token is provided' do
@@ -260,7 +260,7 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
result, cursor = Gitlab::Git::Tree.where(repository, sha, path, recursive, skip_flat_paths, rescue_not_found, { limit: -1, page_token: token })
expect(result.count).to eq(entries.count - 2)
- expect(cursor).to be_nil
+ expect(cursor).to eq(Gitaly::PaginationCursor.new)
end
end
end
@@ -278,7 +278,7 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
it 'returns only available entries' do
expect(entries.count).to be < 20
- expect(cursor).to be_nil
+ expect(cursor).to eq(Gitaly::PaginationCursor.new)
end
end
diff --git a/spec/lib/gitlab/usage_data_counters/ci_template_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/ci_template_unique_counter_spec.rb
index eeef9406841..2c9506dd498 100644
--- a/spec/lib/gitlab/usage_data_counters/ci_template_unique_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/ci_template_unique_counter_spec.rb
@@ -17,24 +17,24 @@ RSpec.describe Gitlab::UsageDataCounters::CiTemplateUniqueCounter, feature_categ
described_class.ci_template_event_name(expanded_template_name, config_source)
end
- it "has an event defined for template" do
+ it 'has an event defined for template' do
expect do
subject
end.not_to raise_error
end
- it "tracks template" do
- expect(Gitlab::UsageDataCounters::HLLRedisCounter).to(receive(:track_event)).with(template_name, values: project.id)
+ it 'tracks template' do
+ expect(Gitlab::UsageDataCounters::HLLRedisCounter)
+ .to receive(:track_event).with(template_name, values: project.id).once
+ expect(Gitlab::UsageDataCounters::HLLRedisCounter)
+ .to receive(:track_event).with('ci_template_included', values: project.id).once
subject
end
- it_behaves_like 'Snowplow event tracking with RedisHLL context' do
- let(:category) { described_class.to_s }
- let(:action) { 'ci_templates_unique' }
+ it_behaves_like 'internal event tracking' do
+ let(:event) { 'ci_template_included' }
let(:namespace) { project.namespace }
- let(:label) { 'redis_hll_counters.ci_templates.ci_templates_total_unique_counts_monthly' }
- let(:context) { [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: template_name).to_context] }
end
end
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index ac07755e29c..52aa6085722 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -627,6 +627,18 @@ RSpec.describe ApplicationSetting, feature_category: :shared, type: :model do
end
specify do
+ is_expected.to validate_numericality_of(:failed_login_attempts_unlock_period_in_minutes)
+ .only_integer
+ .is_greater_than(0)
+ end
+
+ specify do
+ is_expected.to validate_numericality_of(:max_login_attempts)
+ .only_integer
+ .is_greater_than(0)
+ end
+
+ specify do
is_expected.to validate_numericality_of(:local_markdown_version)
.only_integer
.is_greater_than_or_equal_to(0)
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index 08a16ff96dd..c3a7dbdcdbb 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -2432,8 +2432,8 @@ RSpec.describe API::Commits, feature_category: :source_code_management do
get api(route, current_user)
expect(response).to have_gitlab_http_status(:ok)
- expect(json_response['signature_type']).to eq('PGP')
- expect(json_response['commit_source']).to eq('rugged')
+ expect(json_response['signature_type']).to eq('X509')
+ expect(json_response['commit_source']).to eq('gitaly')
end
end
end
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb
index ad52076523c..2fdcf710471 100644
--- a/spec/requests/api/settings_spec.rb
+++ b/spec/requests/api/settings_spec.rb
@@ -85,6 +85,8 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting, featu
expect(json_response['gitlab_shell_operation_limit']).to eq(600)
expect(json_response['namespace_aggregation_schedule_lease_duration_in_seconds']).to eq(300)
expect(json_response['default_branch_protection_defaults']).to be_kind_of(Hash)
+ expect(json_response['max_login_attempts']).to be_nil
+ expect(json_response['failed_login_attempts_unlock_period_in_minutes']).to be_nil
end
end
@@ -1046,5 +1048,19 @@ RSpec.describe API::Settings, 'Settings', :do_not_mock_admin_mode_setting, featu
end
end
end
+
+ context 'login attempts lock settings' do
+ it 'updates the settings' do
+ put(
+ api("/application/settings", admin),
+ params: { max_login_attempts: 3,
+ failed_login_attempts_unlock_period_in_minutes: 30 }
+ )
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['max_login_attempts']).to eq(3)
+ expect(json_response['failed_login_attempts_unlock_period_in_minutes']).to eq(30)
+ end
+ end
end
end