Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-11-02 12:11:04 +00:00
parent 4483783083
commit ed50918678
161 changed files with 699 additions and 461 deletions

View File

@ -1,63 +0,0 @@
---
# Cop supports --auto-correct.
Style/CaseLikeIf:
Details: grace period
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/helpers/todos_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'
- 'app/services/user_project_access_changed_service.rb'
- 'ee/app/controllers/concerns/credentials_inventory_actions.rb'
- 'ee/app/finders/ee/notes_finder.rb'
- 'ee/app/finders/security/scan_execution_policies_finder.rb'
- 'ee/app/finders/security/training_providers/secure_code_warrior_url_finder.rb'
- 'ee/app/helpers/ee/branches_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/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'
- '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/personal_access_tokens_spec.rb'
- 'spec/requests/api/rubygem_packages_spec.rb'
- 'spec/requests/api/terraform/modules/v1/packages_spec.rb'
- 'spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb'
- 'spec/services/resource_events/change_state_service_spec.rb'
- 'spec/support/helpers/filter_spec_helper.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

@ -94,83 +94,4 @@ Style/RedundantInterpolation:
- 'qa/qa/tools/generate_perf_testdata.rb'
- 'scripts/perf/gc/print_gc_stats.rb'
- 'scripts/qa/testcases-check'
- 'spec/controllers/admin/integrations_controller_spec.rb'
- 'spec/features/commits_spec.rb'
- 'spec/features/issues/user_edits_issue_spec.rb'
- 'spec/features/merge_request/user_scrolls_to_note_on_load_spec.rb'
- 'spec/features/merge_request/user_sees_deployment_widget_spec.rb'
- 'spec/features/one_trust_spec.rb'
- 'spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb'
- 'spec/features/projects/jobs/user_browses_jobs_spec.rb'
- 'spec/graphql/resolvers/container_repositories_resolver_spec.rb'
- 'spec/helpers/environments_helper_spec.rb'
- 'spec/helpers/snippets_helper_spec.rb'
- 'spec/lib/api/helpers/packages/dependency_proxy_helpers_spec.rb'
- 'spec/lib/api/validations/validators/git_ref_spec.rb'
- 'spec/lib/api/validations/validators/limit_spec.rb'
- 'spec/lib/backup/database_backup_error_spec.rb'
- 'spec/lib/backup/file_backup_error_spec.rb'
- 'spec/lib/banzai/filter/autolink_filter_spec.rb'
- 'spec/lib/banzai/filter/issuable_reference_expansion_filter_spec.rb'
- 'spec/lib/banzai/filter/references/alert_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/commit_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/issue_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/label_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/project_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/user_reference_filter_spec.rb'
- 'spec/lib/feature_spec.rb'
- 'spec/lib/gitlab/background_migration/legacy_upload_mover_spec.rb'
- 'spec/lib/gitlab/background_migration/populate_vulnerability_reads_spec.rb'
- 'spec/lib/gitlab/ci/config/entry/job_spec.rb'
- 'spec/lib/gitlab/ci/config/entry/processable_spec.rb'
- 'spec/lib/gitlab/ci/reports/test_suite_spec.rb'
- 'spec/lib/gitlab/database/batch_count_spec.rb'
- 'spec/lib/gitlab/database/load_balancing/connection_proxy_spec.rb'
- 'spec/lib/gitlab/import_export/group/tree_saver_spec.rb'
- 'spec/lib/gitlab/inactive_projects_deletion_warning_tracker_spec.rb'
- 'spec/lib/gitlab/metrics/dashboard/url_spec.rb'
- 'spec/lib/gitlab/redis/multi_store_spec.rb'
- 'spec/lib/grafana/client_spec.rb'
- 'spec/mailers/notify_spec.rb'
- 'spec/migrations/20220107064845_populate_vulnerability_reads_spec.rb'
- 'spec/models/active_session_spec.rb'
- 'spec/models/clusters/platforms/kubernetes_spec.rb'
- 'spec/models/diff_discussion_spec.rb'
- 'spec/models/namespace_spec.rb'
- 'spec/presenters/project_presenter_spec.rb'
- 'spec/rack_servers/configs/config.ru'
- 'spec/requests/api/alert_management_alerts_spec.rb'
- 'spec/requests/api/markdown_spec.rb'
- 'spec/requests/api/merge_requests_spec.rb'
- 'spec/requests/api/metrics/dashboard/annotations_spec.rb'
- 'spec/requests/api/tags_spec.rb'
- 'spec/requests/api/terraform/state_spec.rb'
- 'spec/requests/projects/google_cloud/deployments_controller_spec.rb'
- 'spec/requests/projects/google_cloud/service_accounts_controller_spec.rb'
- 'spec/routing/project_routing_spec.rb'
- 'spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb'
- 'spec/services/groups/transfer_service_spec.rb'
- 'spec/services/members/invite_service_spec.rb'
- 'spec/services/todo_service_spec.rb'
- 'spec/services/todos/destroy/entity_leave_service_spec.rb'
- 'spec/services/users/approve_service_spec.rb'
- 'spec/services/users/ban_service_spec.rb'
- 'spec/services/users/reject_service_spec.rb'
- 'spec/services/users/unban_service_spec.rb'
- 'spec/support/google_api/cloud_platform_helpers.rb'
- 'spec/support/helpers/features/releases_helpers.rb'
- 'spec/support/helpers/graphql_helpers.rb'
- 'spec/support/helpers/kubernetes_helpers.rb'
- 'spec/support/matchers/exceed_query_limit.rb'
- 'spec/support/shared_examples/graphql/notes_creation_shared_examples.rb'
- 'spec/support/shared_examples/graphql/resolvers/packages_resolvers_shared_examples.rb'
- 'spec/support/shared_examples/lib/sentry/client_shared_examples.rb'
- 'spec/support/shared_examples/mailers/notify_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/issues_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/notes_shared_examples.rb'
- 'spec/support/shared_examples/services/users/dismiss_user_callout_service_shared_examples.rb'
- 'spec/support_specs/graphql/arguments_spec.rb'
- 'spec/views/projects/commit/_commit_box.html.haml_spec.rb'
- 'tooling/rspec_flaky/flaky_example.rb'

View File

@ -88,6 +88,7 @@ export default {
:discussions-by-diff-order="true"
:line="line"
:help-page-path="helpPagePath"
:should-scroll-to-note="false"
@noteDeleted="deleteNoteHandler"
>
<template v-if="renderAvatarBadge" #avatar-badge>

View File

@ -52,6 +52,11 @@ export default {
required: false,
default: false,
},
shouldScrollToNote: {
type: Boolean,
required: false,
default: true,
},
},
computed: {
...mapGetters(['userCanReply']),
@ -133,6 +138,7 @@ export default {
:discussion-root="true"
:discussion-resolve-path="discussion.resolve_path"
:is-overview-tab="isOverviewTab"
:should-scroll-to-note="shouldScrollToNote"
@handleDeleteNote="$emit('deleteNote')"
@startReplying="$emit('startReplying')"
>
@ -183,6 +189,7 @@ export default {
:discussion-root="index === 0"
:discussion-resolve-path="discussion.resolve_path"
:is-overview-tab="isOverviewTab"
:should-scroll-to-note="shouldScrollToNote"
@handleDeleteNote="$emit('deleteNote')"
>
<template #avatar-badge>

View File

@ -73,6 +73,11 @@ export default {
required: false,
default: false,
},
shouldScrollToNote: {
type: Boolean,
required: false,
default: true,
},
},
data() {
return {
@ -288,6 +293,7 @@ export default {
:line="line"
:should-group-replies="shouldGroupReplies"
:is-overview-tab="isOverviewTab"
:should-scroll-to-note="shouldScrollToNote"
@startReplying="showReplyForm"
@deleteNote="deleteNoteHandler"
>

View File

@ -91,6 +91,11 @@ export default {
required: false,
default: false,
},
shouldScrollToNote: {
type: Boolean,
required: false,
default: true,
},
},
data() {
return {
@ -222,7 +227,7 @@ export default {
},
mounted() {
if (this.isTarget) {
if (this.isTarget && this.shouldScrollToNote) {
this.scrollToNoteIfNeeded($(this.$el));
}
},

View File

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

View File

@ -170,9 +170,10 @@ module IssuableActions
discussions = Discussion.build_collection(notes, issuable)
if issuable.is_a?(MergeRequest)
case issuable
when MergeRequest
render_mr_discussions(discussions, discussion_serializer, discussion_cache_context)
elsif issuable.is_a?(Issue)
when Issue
render json: discussion_serializer.represent(discussions, context: self) if stale?(etag: [discussion_cache_context, discussions])
else
render json: discussion_serializer.represent(discussions, context: self)

View File

@ -21,10 +21,11 @@ module Groups
user_or_deploy_token = ::DependencyProxy::AuthTokenService.user_or_deploy_token_from_jwt(token)
if user_or_deploy_token.is_a?(User)
case user_or_deploy_token
when User
@authentication_result = Gitlab::Auth::Result.new(user_or_deploy_token, nil, :user, [])
sign_in(user_or_deploy_token)
elsif user_or_deploy_token.is_a?(DeployToken)
when DeployToken
@authentication_result = Gitlab::Auth::Result.new(user_or_deploy_token, nil, :deploy_token, [])
end
end

View File

@ -4,7 +4,7 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
include InitializesCurrentUserMode
include Gitlab::Utils::StrongMemoize
before_action :verify_confirmed_email!
before_action :verify_confirmed_email!, :verify_admin_allowed!
layout 'profile'
@ -97,4 +97,19 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
pre_auth.error = :unconfirmed_email
render "doorkeeper/authorizations/error"
end
def verify_admin_allowed!
render "doorkeeper/authorizations/forbidden" if disallow_connect?
end
def disallow_connect?
# we're disabling Cop/UserAdmin as OAuth tokens don't seem to respect admin mode
current_user&.admin? && Gitlab::CurrentSettings.disable_admin_oauth_scopes && dangerous_scopes? # rubocop:disable Cop/UserAdmin
end
def dangerous_scopes?
doorkeeper_application&.includes_scope?(*::Gitlab::Auth::API_SCOPE, *::Gitlab::Auth::READ_API_SCOPE,
*::Gitlab::Auth::ADMIN_SCOPES, *::Gitlab::Auth::REPOSITORY_SCOPES,
*::Gitlab::Auth::REGISTRY_SCOPES) && !doorkeeper_application&.trusted?
end
end

View File

@ -52,6 +52,7 @@ class Projects::IssuesController < Projects::ApplicationController
before_action only: :show do
push_frontend_feature_flag(:issue_assignees_widget, project)
push_frontend_feature_flag(:realtime_labels, project)
push_frontend_feature_flag(:work_items_mvc, project&.group)
push_force_frontend_feature_flag(:work_items_mvc_2, project&.work_items_mvc_2_feature_flag_enabled?)
push_frontend_feature_flag(:work_items_hierarchy, project)
push_frontend_feature_flag(:epic_widget_edit_confirmation, project)

View File

@ -68,9 +68,10 @@ class Projects::LabelsController < Projects::ApplicationController
def generate
Gitlab::IssuesLabels.generate(@project)
if params[:redirect] == 'issues'
case params[:redirect]
when 'issues'
redirect_to project_issues_path(@project)
elsif params[:redirect] == 'merge_requests'
when 'merge_requests'
redirect_to project_merge_requests_path(@project)
else
redirect_to project_labels_path(@project)

View File

@ -8,9 +8,10 @@ module Types
possible_types Types::Ci::JobType, Types::Ci::BuildNeedType
def self.resolve_type(object, context)
if object.is_a?(::Ci::BuildNeed)
case object
when ::Ci::BuildNeed
Types::Ci::BuildNeedType
elsif object.is_a?(CommitStatus)
when CommitStatus
Types::Ci::JobType
else
raise TypeNotSupportedError

View File

@ -221,6 +221,7 @@ module ApplicationSettingsHelper
:default_projects_limit,
:default_snippet_visibility,
:delete_inactive_projects,
:disable_admin_oauth_scopes,
:disable_feed_token,
:disabled_oauth_sign_in_sources,
:domain_denylist,

View File

@ -105,9 +105,10 @@ module AvatarsHelper
end
def avatar_without_link(resource, options = {})
if resource.is_a?(Namespaces::UserNamespace)
case resource
when Namespaces::UserNamespace
user_avatar_without_link(options.merge(user: resource.first_owner))
elsif resource.is_a?(Group)
when Group
group_icon(resource, options.merge(class: 'avatar'))
end
end

View File

@ -77,11 +77,12 @@ module BroadcastMessagesHelper
return unless current_user.present?
strong_memoize(:current_user_access_level_for_project_or_group) do
if controller.is_a? Projects::ApplicationController
case controller
when Projects::ApplicationController
next unless @project
@project.team.max_member_access(current_user.id)
elsif controller.is_a? Groups::ApplicationController
when Groups::ApplicationController
next unless @group
@group.max_member_access_for_user(current_user)

View File

@ -108,9 +108,10 @@ module IssuesHelper
def awards_sort(awards)
awards.sort_by do |award, award_emojis|
if award == "thumbsup"
case award
when "thumbsup"
0
elsif award == "thumbsdown"
when "thumbsdown"
1
else
2

View File

@ -43,11 +43,12 @@ module Routing
private
def mask_id(value)
if @request.path_parameters[:controller] == 'projects/blob'
case @request.path_parameters[:controller]
when 'projects/blob'
':repository_path'
elsif @request.path_parameters[:controller] == 'projects'
when 'projects'
"project#{@project&.id}"
elsif @request.path_parameters[:controller] == 'groups'
when 'groups'
"namespace#{@group&.id}"
else
value

View File

@ -121,9 +121,10 @@ module TodosHelper
case todo.target
when MergeRequest
if state == 'closed'
case state
when 'closed'
background_class = 'gl-bg-red-500'
elsif state == 'merged'
when 'merged'
background_class = 'gl-bg-blue-500'
end
when Issue

View File

@ -689,6 +689,9 @@ class ApplicationSetting < ApplicationRecord
validates :disable_feed_token,
inclusion: { in: [true, false], message: N_('must be a boolean value') }
validates :disable_admin_oauth_scopes,
inclusion: { in: [true, false], message: N_('must be a boolean value') }
before_validation :ensure_uuid!
before_validation :coerce_repository_storages_weighted, if: :repository_storages_weighted_changed?
before_validation :normalize_default_branch_name

View File

@ -62,6 +62,7 @@ module ApplicationSettingImplementation
diff_max_patch_bytes: Gitlab::Git::Diff::DEFAULT_MAX_PATCH_BYTES,
diff_max_files: Commit::DEFAULT_MAX_DIFF_FILES_SETTING,
diff_max_lines: Commit::DEFAULT_MAX_DIFF_LINES_SETTING,
disable_admin_oauth_scopes: false,
disable_feed_token: false,
disabled_oauth_sign_in_sources: [],
dns_rebinding_protection_enabled: true,

View File

@ -532,13 +532,14 @@ module Integrations
end
def build_entity_meta(entity)
if entity.is_a?(Commit)
case entity
when Commit
{
id: entity.short_id,
description: entity.safe_message,
branch: branch_name(entity)
}
elsif entity.is_a?(MergeRequest)
when MergeRequest
{
id: entity.to_reference,
branch: entity.source_branch

View File

@ -34,9 +34,10 @@ class MemberTask < ApplicationRecord
end
def project_in_member_source
if member.is_a?(GroupMember)
case member
when GroupMember
errors.add(:project, _('is not in the member group')) unless project.namespace == member.source
elsif member.is_a?(ProjectMember)
when ProjectMember
errors.add(:project, _('is not the member project')) unless project == member.source
end
end

View File

@ -550,11 +550,12 @@ class Namespace < ApplicationRecord
end
def shared_runners_setting_higher_than?(other_setting)
if other_setting == SR_ENABLED
case other_setting
when SR_ENABLED
false
elsif other_setting == SR_DISABLED_WITH_OVERRIDE
when SR_DISABLED_WITH_OVERRIDE
shared_runners_setting == SR_ENABLED
elsif other_setting == SR_DISABLED_AND_UNOVERRIDABLE
when SR_DISABLED_AND_UNOVERRIDABLE
shared_runners_setting == SR_ENABLED || shared_runners_setting == SR_DISABLED_WITH_OVERRIDE
else
raise ArgumentError

View File

@ -21,9 +21,10 @@ module Packages
raise ArgumentError, "mod is required" unless mod
raise ArgumentError, "commit is required" unless commit
if type == :ref
case type
when :ref
raise ArgumentError, "ref is required" unless ref
elsif type == :pseudo
when :pseudo
raise ArgumentError, "name is required" unless name
raise ArgumentError, "semver is required" unless semver
end

View File

@ -12,12 +12,15 @@ module WorkItems
# Base types need to exist on the DB on app startup
# This constant is used by the DB seeder
# TODO - where to add new icon names created?
BASE_TYPES = {
issue: { name: 'Issue', icon_name: 'issue-type-issue', enum_value: 0 },
incident: { name: 'Incident', icon_name: 'issue-type-incident', enum_value: 1 },
test_case: { name: 'Test Case', icon_name: 'issue-type-test-case', enum_value: 2 }, ## EE-only
requirement: { name: 'Requirement', icon_name: 'issue-type-requirements', enum_value: 3 }, ## EE-only
task: { name: 'Task', icon_name: 'issue-type-task', enum_value: 4 }
task: { name: 'Task', icon_name: 'issue-type-task', enum_value: 4 },
objective: { name: 'Objective', icon_name: 'issue-type-objective', enum_value: 5 }, ## EE-only
key_result: { name: 'Key Result', icon_name: 'issue-type-keyresult', enum_value: 6 } ## EE-only
}.freeze
WIDGETS_FOR_TYPE = {
@ -27,7 +30,9 @@ module WorkItems
test_case: [Widgets::Description],
requirement: [Widgets::Description],
task: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::Hierarchy, Widgets::StartAndDueDate,
Widgets::Milestone]
Widgets::Milestone],
objective: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::Hierarchy],
key_result: [Widgets::Assignees, Widgets::Labels, Widgets::Description, Widgets::StartAndDueDate]
}.freeze
WI_TYPES_WITH_CREATED_HEADER = %w[issue incident].freeze
@ -69,7 +74,7 @@ module WorkItems
end
def self.allowed_types_for_issues
base_types.keys.excluding('task')
base_types.keys.excluding('task', 'objective', 'key_result')
end
def default?

View File

@ -39,12 +39,13 @@ class GroupChildSerializer < BaseSerializer
def represent_hierarchy(hierarchy, opts)
serializer = self.class.new(params)
if hierarchy.is_a?(Hash)
case hierarchy
when Hash
hierarchy.map do |parent, children|
serializer.represent(parent, opts)
.merge(children: Array.wrap(serializer.represent_hierarchy(children, opts)))
end
elsif hierarchy.is_a?(Array)
when Array
hierarchy.flat_map { |child| serializer.represent_hierarchy(child, opts) }
else
serializer.represent(hierarchy, opts)

View File

@ -34,7 +34,8 @@ module GoogleCloud
end
def generate_commit_attributes
if action == ACTION_DEPLOY_TO_CLOUD_RUN
case action
when ACTION_DEPLOY_TO_CLOUD_RUN
branch_name = "deploy-to-cloud-run-#{SecureRandom.hex(8)}"
{
commit_message: 'Enable Cloud Run deployments',
@ -43,7 +44,7 @@ module GoogleCloud
branch_name: branch_name,
start_branch: branch_name
}
elsif action == ACTION_DEPLOY_TO_CLOUD_STORAGE
when ACTION_DEPLOY_TO_CLOUD_STORAGE
branch_name = "deploy-to-cloud-storage-#{SecureRandom.hex(8)}"
{
commit_message: 'Enable Cloud Storage deployments',

View File

@ -68,9 +68,10 @@ module Issuable
end
def find_issuables(parent, model_class, ids)
if parent.is_a?(Project)
case parent
when Project
projects = parent
elsif parent.is_a?(Group)
when Group
projects = parent.all_projects
else
return

View File

@ -329,11 +329,12 @@ class TodoService
commit_id: nil
}
if target.is_a?(Commit)
case target
when Commit
attributes.merge!(target_id: nil, commit_id: target.id)
elsif target.is_a?(Issue)
when Issue
attributes[:issue_type] = target.issue_type
elsif target.is_a?(Discussion)
when Discussion
attributes.merge!(target_type: nil, target_id: nil, discussion: target)
end

View File

@ -21,9 +21,10 @@ class UserProjectAccessChangedService
if blocking
AuthorizedProjectsWorker.bulk_perform_and_wait(bulk_args)
else
if priority == HIGH_PRIORITY
case priority
when HIGH_PRIORITY
AuthorizedProjectsWorker.bulk_perform_async(bulk_args) # rubocop:disable Scalability/BulkPerformWithContext
elsif priority == MEDIUM_PRIORITY
when MEDIUM_PRIORITY
AuthorizedProjectUpdate::UserRefreshWithLowUrgencyWorker.bulk_perform_in(MEDIUM_DELAY, bulk_args, batch_size: 100, batch_delay: 30.seconds) # rubocop:disable Scalability/BulkPerformWithContext
else
with_related_class_context do

View File

@ -0,0 +1,5 @@
%h1.page-title.gl-font-size-h-display= _("Forbidden")
%main{ :role => "main" }
%p
= sprite_icon('warning-solid')
= (_("Administrators are not permitted to connect applications with these scopes: %{code_open}api%{code_close}, %{code_open}read_api%{code_close}, %{code_open}read_repository%{code_close}, %{code_open}write_repository%{code_close}, %{code_open}write_registry%{code_close}, %{code_open}read_registry%{code_close}, and %{code_open}sudo%{code_close}. To permit this, change the %{code_open}disable_admin_oauth_scopes%{code_close} setting using the API.") % { code_open: '<code>', code_close: '</code>' }).html_safe

View File

@ -0,0 +1,8 @@
---
name: work_items_mvc
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101062"
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/377912
milestone: '15.5'
type: development
group: group::project management
default_enabled: false

View File

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

View File

@ -0,0 +1,56 @@
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddObjectiveAndKeyresultToWorkItemTypes < Gitlab::Database::Migration[2.0]
# Added the following statements as per https://docs.gitlab.com/ee/development/database/migrations_for_multiple_databases.html
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
OBJECTIVE_ENUM_VALUE = 5
KEY_RESULT_ENUM_VALUE = 6
class WorkItemType < MigrationRecord
self.inheritance_column = :_type_disabled
self.table_name = 'work_item_types'
end
def up
# New instances will not run this migration and add this type via fixtures
# checking if record exists mostly because migration specs will run all migrations
# and that will conflict with the preloaded base work item types
objective_work_item = WorkItemType.find_by(base_type: OBJECTIVE_ENUM_VALUE, name: 'Objective', namespace_id: nil)
key_result_work_item = WorkItemType.find_by(base_type: KEY_RESULT_ENUM_VALUE, name: 'Key Result', namespace_id: nil)
if objective_work_item
say('Objective item record exist, skipping creation')
else
execute(
<<~SQL
INSERT INTO work_item_types (base_type, icon_name, name, created_at, updated_at) VALUES(
#{OBJECTIVE_ENUM_VALUE}, 'issue-type-objective', 'Objective', NOW(), NOW()
) ON CONFLICT DO NOTHING;
SQL
)
end
if key_result_work_item
say('Keyresult item record exist, skipping creation')
else
execute(
<<~SQL
INSERT INTO work_item_types (base_type, icon_name, name, created_at, updated_at) VALUES(
#{KEY_RESULT_ENUM_VALUE}, 'issue-type-keyresult', 'Key Result', NOW(), NOW()
) ON CONFLICT DO NOTHING;
SQL
)
end
end
def down
# There's the remote possibility that issues could already be
# using this issue type, with a tight foreign constraint.
# Therefore we will not attempt to remove any data.
end
end

View File

@ -0,0 +1 @@
704d0973ce5fec01228a28d5551ecc88ccf057e246ee75f8f5b0cc0a08815095

View File

@ -0,0 +1 @@
05754025966b87f6998a0801e76c811b0cd42b2a77f35e8129a0c47f935e9bc4

View File

@ -11494,6 +11494,7 @@ CREATE TABLE application_settings (
password_expires_notice_before_days integer DEFAULT 7 NOT NULL,
product_analytics_enabled boolean DEFAULT false NOT NULL,
email_confirmation_setting smallint DEFAULT 2,
disable_admin_oauth_scopes boolean DEFAULT false 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_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)),

View File

@ -219,9 +219,6 @@ The availability objectives for Gitaly clusters assuming a single node failure a
second. Failover requires ten consecutive failed health checks on each
Praefect node.
Faster outage detection, to improve this speed to less than 1 second,
is tracked [in this issue](https://gitlab.com/gitlab-org/gitaly/-/issues/2608).
WARNING:
If complete cluster failure occurs, disaster recovery plans should be executed. These can affect the
RPO and RTO discussed above.

View File

@ -295,6 +295,7 @@ listed in the descriptions of the relevant settings.
| `diff_max_patch_bytes` | integer | no | Maximum [diff patch size](../user/admin_area/diff_limits.md), in bytes. |
| `diff_max_files` | integer | no | Maximum [files in a diff](../user/admin_area/diff_limits.md). |
| `diff_max_lines` | integer | no | Maximum [lines in a diff](../user/admin_area/diff_limits.md). |
| `disable_admin_oauth_scopes` | boolean | no | Stops administrators from connecting their GitLab accounts to non-trusted OAuth 2.0 applications that have the `api`, `read_api`, `read_repository`, `write_repository`, `read_registry`, `write_registry`, or `sudo` scopes. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/375043) in GitLab 15.6. |
| `disable_feed_token` | boolean | no | Disable display of RSS/Atom and calendar feed tokens. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/231493) in GitLab 13.7. |
| `disabled_oauth_sign_in_sources` | array of strings | no | Disabled OAuth sign-in sources. |
| `dns_rebinding_protection_enabled` | boolean | no | Enforce DNS rebinding attack protection. |

View File

@ -160,11 +160,64 @@ A number of technical issues need to be resolved to implement Pods (in no partic
1. How are Pods provisioned?
1. How can Pods implement disaster recovery capabilities?
## Cross-section impact
Pods is a fundamental architecture change that impacts other sections and stages. This section summarizes and links to other groups that may be impacted and highlights potential conflicts that need to be resolved. The Pods group is not responsible for achieving the goals of other groups but we want to ensure that dependencies are resolved.
### Summary
Based on discussions with other groups the net impact of introducing Pods and a new entity called organizations is mostly neutral. It may slow down development in some areas. We did not discover major blockers for other teams.
1. We need to resolve naming conflicts (proposal is TBD)
1. Pods requires introducing Organizations. Organizations are a new entity **above** top-level groups. Because this is a new entity, it may impact the ability to consolidate settings for Group Workspace and influence their decision on [how to approach introducing a workspace](https://gitlab.com/gitlab-org/gitlab/-/issues/376285#approach-2-workspace-is-built-on-top-of-top-level-groups)
1. Organizations may make it slightly easier for Fulfillment to realize their billing plans.
### Impact on Group Manage Workspace
We synced with the Workspace PM and Designer ([recording](https://youtu.be/b5Opn9cFWFk)) and discussed the similarities and differences between the Pods and Workspace proposal ([presentation](https://docs.google.com/presentation/d/1FsUi22Up15b_tu6p2m-yLML3hCZ3rgrZrmzJAxUsNmU/edit?usp=sharing)).
#### Goals of Group Manage Workspace
As defined in the [workspace documentation](../../../user/workspace/index.md):
1. Create an entity to manage everything you do as a GitLab administrator, including:
1. Defining and applying settings to all of your groups, subgroups, and projects.
1. Aggregating data from all your groups, subgroups, and projects.
1. Reach feature parity between SaaS and self-managed installations, with all Admin Area settings moving to groups (?). Hardware controls remain on the instance level.
The [workspace roadmap outlines](https://gitlab.com/gitlab-org/gitlab/-/issues/368237#high-level-goals) the current goals in detail.
#### Potential conflicts with Pods
- Workspace and Organization are different terms for the same entity. Both define a new entity as the primary organizational object for groups and projects. This is mainly a semantic difference and **we need to decide on a name** following [user research to decide if workspace](https://gitlab.com/gitlab-org/ux-research/-/issues/2147). This is also driven by the fact that the Remote Development team is looking at better names and [are considering the term Workspace as well](https://gitlab.com/gitlab-com/Product/-/issues/4812).
- We will only introduce one entity
- Group workspace highlighted the need to further validate the key assumption that users only care about what happens within their organization.
### Impact on Fulfillment
We synced with Fulfillment ([recording](https://youtu.be/FkQF3uF7vTY)) to discuss how Pods would impact them. Fulfillment is supportive of an entity above top-level namespaces. Their perspective is outline in [!5639](https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/5639/diffs).
#### Goals of Fulfillment
- Fulfillment has a longstanding plan to move billing from the top-level namespace to a level above. This would mean that a license applies for an organization and all its top-level namespaces.
- Fulfillment uses Zuora for billing and would like to have a 1-to-1 relationship between an organization and their Zuora entity called BillingAccount. They want to move away from tying a license to a single user.
- If a customer needs multiple organizations, the corresponding BillingAccounts can be rolled up into a consolidated billing account (similar to [AWS consolidated billing](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/consolidated-billing.html))
- Ideally, a self-managed instance has a single Organization by default, which should be enough for most customers.
- Fulfillment prefers only one additional entity.
A rough representation of this is:
![Pods and Fulfillment](pods-and-fulfillment.png)
#### Potential conflicts with Pods
- There are no known conflicts between Fulfillment's plans and Pods
## Iteration plan
We can't ship the entire Pods architecture in one go - it is too large. Instead, we are adopting an iteration plan that provides value along the way.
1. Introduce organizations
1. Introduce organizations
1. Migrate existing top-level namespaces to organizations
1. Create new organizations on `pod_0`
1. Migrate existing organizations from `pod_0` to `pod_n`

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -3,39 +3,42 @@ stage: Data Stores
group: Global Search
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
type: drawer
source: /doc/user/search/global_search/advanced_search_syntax.md
source: /doc/user/search/advanced_search.md
---
# Search tips
<!-- markdownlint-disable -->
| Use | Description | Example |
|------|-------------|---------|
| `"` | Exact search | [`"gem sidekiq"`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=%22gem+sidekiq%22) |
| <code>&#124;</code> | Or | [<code>display &#124; banner</code>](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+%7C+banner) |
| `+` | And | [`display +banner`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=display+%2Bbanner&snippets=) |
| `-` | Exclude | [`display -banner`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+-banner) |
| `*` | Partial | [`bug error 50*`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=bug+error+50%2A&snippets=) |
| `\` | Escape | [`\*md`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=%5C*md&group_id=9970&project_id=278964) |
| Syntax | Description | Example |
|--------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `"` | Exact search | [`"gem sidekiq"`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=%22gem+sidekiq%22) |
| <code>&#124;</code> | Or | [<code>display &#124; banner</code>](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+%7C+banner) |
| `+` | And | [`display +banner`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=display+%2Bbanner&snippets=) |
| `-` | Exclude | [`display -banner`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+-banner) |
| `*` | Partial | [`bug error 50*`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=bug+error+50%2A&snippets=) |
| `\` | Escape | [`\*md`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=%5C*md&group_id=9970&project_id=278964) |
| `#` | Issue ID | [`#23456`](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=%2323456&group_id=9970&project_id=278964) |
| `!` | Merge request ID | [`!23456`](https://gitlab.com/search?snippets=&scope=merge_requests&repository_ref=&search=%2123456&group_id=9970&project_id=278964) |
## Code search
| Use | Description | Example |
|------|-------------|---------|
| `filename:` | Filename | [`filename:*spec.rb`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=filename%3A*spec.rb&group_id=9970&project_id=278964) |
| `path:` | Repository location | [`path:spec/workers/`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=path%3Aspec%2Fworkers&snippets=) |
| `extension:` | File extension, without the `.` | [`extension:js`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=extension%3Ajs&snippets=) |
| `blob:` | Git object ID | [`blob:998707*`](https://gitlab.com/search?snippets=false&scope=blobs&repository_ref=&search=blob%3A998707*&group_id=9970) |
| Syntax | Description | Example |
|--------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `filename:` | Filename | [`filename:*spec.rb`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=filename%3A*spec.rb&group_id=9970&project_id=278964) |
| `path:` | Repository location | [`path:spec/workers/`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=path%3Aspec%2Fworkers&snippets=) |
| `extension:` | File extension without `.` | [`extension:js`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=extension%3Ajs&snippets=) |
| `blob:` | Git object ID | [`blob:998707*`](https://gitlab.com/search?snippets=false&scope=blobs&repository_ref=&search=blob%3A998707*&group_id=9970) |
`extension` and `blob` return exact matches only.
`extension:` and `blob:` return exact matches only.
## Examples
| Use | Description |
|------|-------------|
| [`rails -filename:gemfile.lock`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=rails+-filename%3Agemfile.lock&snippets=) | Show _rails_ in all files except the _`gemfile.lock`_ file. |
| [`RSpec.describe Resolvers -*builder`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=RSpec.describe+Resolvers+-*builder) | Show all _RSpec.describe Resolvers_ that don't start with _builder_. |
| [<code>bug &#124; (display +banner)</code>](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964) | Show _bug_ **or** _display_ **and** _banner_. |
| Query | Description |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [`rails -filename:gemfile.lock`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=rails+-filename%3Agemfile.lock&snippets=) | Returns `rails` in all files except the `gemfile.lock` file. |
| [`RSpec.describe Resolvers -*builder`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=RSpec.describe+Resolvers+-*builder) | Returns `RSpec.describe Resolvers` that does not start with `builder`. |
| [<code>bug &#124; (display +banner)</code>](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964) | Returns `bug` or both `display` and `banner`. |
| [<code>helper -extension:yml -extension:js</code>](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=helper+-extension%3Ayml+-extension%3Ajs&snippets=) | Returns `helper` in all files except files with a `.yml` or `.js` extension. |
<!-- markdownlint-enable -->

View File

@ -212,8 +212,8 @@ More [complex Elasticsearch API calls](https://www.elastic.co/guide/en/elasticse
If the results:
- Sync up, please check that you are using [supported syntax](../../user/search/global_search/advanced_search_syntax.md). Note that Advanced Search does not support [exact substring matching](https://gitlab.com/gitlab-org/gitlab/-/issues/325234).
- Do not match up, this indicates a problem with the documents generated from the project. It is best to [re-index that project](../advanced_search/elasticsearch.md#indexing-a-range-of-projects-or-a-specific-project)
- Sync up, check that you are using [supported syntax](../../user/search/advanced_search.md#syntax). Advanced Search does not support [exact substring matching](https://gitlab.com/gitlab-org/gitlab/-/issues/325234).
- Do not match up, this indicates a problem with the documents generated from the project. It is best to [re-index that project](../advanced_search/elasticsearch.md#indexing-a-range-of-projects-or-a-specific-project).
NOTE:
The above instructions are not to be used for scenarios that only index a [subset of namespaces](elasticsearch.md#limit-the-number-of-namespaces-and-projects-that-can-be-indexed).

View File

@ -119,9 +119,10 @@ NOTE:
Testing is not supported for some types of events for project and groups webhooks.
Read more in [issue 379201](https://gitlab.com/gitlab-org/gitlab/-/issues/379201).
Prerequisite:
Prerequisites:
- To test group webhooks, you must have administrator access for your instance.
- To test project webhooks, you must have at least the Maintainer role for the project.
- To test group webhooks, you must have the Owner role for the group.
To test a webhook:
@ -245,9 +246,10 @@ Webhook requests to your endpoint include the following headers:
GitLab records the history of each webhook request.
You can view requests made in the last 2 days in the **Recent events** table.
Prerequisite:
Prerequisites:
- To troubleshoot group webhooks, you must have administrator access for your instance.
- To troubleshoot project webhooks, you must have at least the Maintainer role for the project.
- To troubleshoot group webhooks, you must have the Owner role for the group.
To view the table:

View File

@ -37,9 +37,39 @@ You can use Advanced Search in:
## Syntax
See [Advanced Search syntax](global_search/advanced_search_syntax.md) for more information.
Advanced Search uses [Elasticsearch syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html#simple-query-string-syntax). The syntax supports both exact and fuzzy search queries.
## Search by ID
<!-- markdownlint-disable -->
- To search by issue ID, use the `#` prefix followed by the issue ID (for example, [`#23456`](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=%2323456&group_id=9970&project_id=278964)).
- To search by merge request ID, use the `!` prefix followed by the merge request ID (for example, [`!23456`](https://gitlab.com/search?snippets=&scope=merge_requests&repository_ref=&search=%2123456&group_id=9970&project_id=278964)).
| Syntax | Description | Example |
|--------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `"` | Exact search | [`"gem sidekiq"`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=%22gem+sidekiq%22) |
| <code>&#124;</code> | Or | [<code>display &#124; banner</code>](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+%7C+banner) |
| `+` | And | [`display +banner`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=display+%2Bbanner&snippets=) |
| `-` | Exclude | [`display -banner`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+-banner) |
| `*` | Partial | [`bug error 50*`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=bug+error+50%2A&snippets=) |
| `\` | Escape | [`\*md`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=%5C*md&group_id=9970&project_id=278964) |
| `#` | Issue ID | [`#23456`](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=%2323456&group_id=9970&project_id=278964) |
| `!` | Merge request ID | [`!23456`](https://gitlab.com/search?snippets=&scope=merge_requests&repository_ref=&search=%2123456&group_id=9970&project_id=278964) |
### Code search
| Syntax | Description | Example |
|--------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `filename:` | Filename | [`filename:*spec.rb`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=filename%3A*spec.rb&group_id=9970&project_id=278964) |
| `path:` | Repository location | [`path:spec/workers/`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=path%3Aspec%2Fworkers&snippets=) |
| `extension:` | File extension without `.` | [`extension:js`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=extension%3Ajs&snippets=) |
| `blob:` | Git object ID | [`blob:998707*`](https://gitlab.com/search?snippets=false&scope=blobs&repository_ref=&search=blob%3A998707*&group_id=9970) |
`extension:` and `blob:` return exact matches only.
### Examples
| Query | Description |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [`rails -filename:gemfile.lock`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=rails+-filename%3Agemfile.lock&snippets=) | Returns `rails` in all files except the `gemfile.lock` file. |
| [`RSpec.describe Resolvers -*builder`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=RSpec.describe+Resolvers+-*builder) | Returns `RSpec.describe Resolvers` that does not start with `builder`. |
| [<code>bug &#124; (display +banner)</code>](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964) | Returns `bug` or both `display` and `banner`. |
| [<code>helper -extension:yml -extension:js</code>](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=helper+-extension%3Ayml+-extension%3Ajs&snippets=) | Returns `helper` in all files except files with a `.yml` or `.js` extension. |
<!-- markdownlint-enable -->

View File

@ -1,52 +1,11 @@
---
stage: Data Stores
group: Global Search
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
redirect_to: '../advanced_search.md'
remove_date: '2023-02-02'
---
# Advanced Search syntax **(PREMIUM)**
This document was moved to [another location](../advanced_search.md).
With [Advanced Search](../advanced_search.md), you can perform a thorough
search of your entire GitLab instance.
The Advanced Search syntax supports fuzzy or exact search queries with prefixes,
boolean operators, and more. Advanced Search uses
[Elasticsearch's syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html#simple-query-string-syntax).
WARNING:
Advanced Search searches default project branches only.
## General search
<!-- markdownlint-disable -->
| Use | Description | Example |
|-----|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `"` | Exact search | [`"gem sidekiq"`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=%22gem+sidekiq%22) |
| <code>&#124;</code> | Or | [<code>display &#124; banner</code>](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+%7C+banner) |
| `+` | And | [`display +banner`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=display+%2Bbanner&snippets=) |
| `-` | Exclude | [`display -banner`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+-banner) |
| `*` | Partial | [`bug error 50*`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=bug+error+50%2A&snippets=) |
| <code>&#92;</code> | Escape | [`\*md`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=%5C*md&group_id=9970&project_id=278964) |
## Code search
| Use | Description | Example |
|--------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `filename:` | Filename | [`filename:*spec.rb`](https://gitlab.com/search?snippets=&scope=blobs&repository_ref=&search=filename%3A*spec.rb&group_id=9970&project_id=278964) |
| `path:` | Repository location | [`path:spec/workers/`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=path%3Aspec%2Fworkers&snippets=) |
| `extension:` | File extension, without the `.` | [`extension:js`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=extension%3Ajs&snippets=) |
| `blob:` | Git object ID | [`blob:998707*`](https://gitlab.com/search?snippets=false&scope=blobs&repository_ref=&search=blob%3A998707*&group_id=9970) |
`extension` and `blob` return exact matches only.
## Examples
| Example | Description |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [`rails -filename:gemfile.lock`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=rails+-filename%3Agemfile.lock&snippets=) | Show _rails_ in all files except the _`gemfile.lock`_ file. |
| [`RSpec.describe Resolvers -*builder`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=RSpec.describe+Resolvers+-*builder) | Show all _RSpec.describe Resolvers_ that don't start with _builder_. |
| [<code>bug &#124; (display +banner)</code>](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964) | Show _bug_ **or** _display_ **and** _banner_. |
| [<code>helper -extension:yml -extension:js</code>](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=helper+-extension%3Ayml+-extension%3Ajs&snippets=) | Show _helper_ in all files, except for files with _`.yml`_ **or** _`.js`_ extensions. |
<!-- markdownlint-enable -->
<!-- This redirect file can be deleted after <2023-02-02>. -->
<!-- Redirects that point to other docs in the same project expire in three months. -->
<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html -->

View File

@ -137,9 +137,10 @@ module API
end
def create_service_params(parent)
if parent.is_a?(Project)
case parent
when Project
{ project: parent }
elsif parent.is_a?(Group)
when Group
{ group: parent }
else
raise TypeError, 'Parent type is not supported'

View File

@ -53,6 +53,7 @@ module API
optional :default_project_visibility, type: String, values: Gitlab::VisibilityLevel.string_values, desc: 'The default project visibility'
optional :default_projects_limit, type: Integer, desc: 'The maximum number of personal projects'
optional :default_snippet_visibility, type: String, values: Gitlab::VisibilityLevel.string_values, desc: 'The default snippet visibility'
optional :disable_admin_oauth_scopes, type: Boolean, desc: 'Stop administrators from connecting to non-trusted OAuth applications.'
optional :disable_feed_token, type: Boolean, desc: 'Disable display of RSS/Atom and Calendar `feed_tokens`'
optional :disabled_oauth_sign_in_sources, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Disable certain OAuth sign-in sources'
optional :domain_denylist_enabled, type: Boolean, desc: 'Enable domain denylist for sign ups'

View File

@ -312,9 +312,10 @@ module Gitlab
normalized_section = section_to_class_name(section)
if action == "start"
case action
when "start"
handle_section_start(normalized_section, timestamp)
elsif action == "end"
when "end"
handle_section_end(normalized_section, timestamp)
end
end

View File

@ -107,9 +107,10 @@ module Gitlab
section_name = sanitize_section_name(section)
if action == 'start'
case action
when 'start'
handle_section_start(scanner, section_name, timestamp, options)
elsif action == 'end'
when 'end'
handle_section_end(scanner, section_name, timestamp)
else
raise 'unsupported action'

View File

@ -24,10 +24,11 @@ module Gitlab
end
def initialize(image)
if image.is_a?(String)
case image
when String
@name = image
@ports = []
elsif image.is_a?(Hash)
when Hash
@alias = image[:alias]
@command = image[:command]
@entrypoint = image[:entrypoint]

View File

@ -5,10 +5,11 @@
module Gitlab
module Identifier
def identify(identifier)
if identifier =~ /\Auser-\d+\Z/
case identifier
when /\Auser-\d+\Z/
# git push over http
identify_using_user(identifier)
elsif identifier =~ /\Akey-\d+\Z/
when /\Akey-\d+\Z/
# git push over ssh
identify_using_ssh_key(identifier)
end

View File

@ -136,9 +136,10 @@ module Gitlab
current_rebalancing_containers.each do |string|
container_type, container_id = string.split('/', 2).map(&:to_i)
if container_type == NAMESPACE
case container_type
when NAMESPACE
namespace_ids << container_id
elsif container_type == PROJECT
when PROJECT
project_ids << container_id
end
end

View File

@ -35,11 +35,12 @@ module Gitlab
def keyset_pagination_enabled?(finder)
return false unless params[:pagination] == "keyset"
if finder.is_a?(BranchesFinder)
case finder
when BranchesFinder
Feature.enabled?(:branch_list_keyset_pagination, project)
elsif finder.is_a?(TagsFinder)
when TagsFinder
true
elsif finder.is_a?(::Repositories::TreeFinder)
when ::Repositories::TreeFinder
Feature.enabled?(:repository_tree_gitaly_pagination, project)
else
false
@ -49,11 +50,12 @@ module Gitlab
def paginate_first_page?(finder)
return false unless params[:page].blank? || params[:page].to_i == 1
if finder.is_a?(BranchesFinder)
case finder
when BranchesFinder
Feature.enabled?(:branch_list_keyset_pagination, project)
elsif finder.is_a?(TagsFinder)
when TagsFinder
true
elsif finder.is_a?(::Repositories::TreeFinder)
when ::Repositories::TreeFinder
Feature.enabled?(:repository_tree_gitaly_pagination, project)
else
false

View File

@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'digest'
require 'msgpack'
module Gitlab
module SidekiqMiddleware

View File

@ -167,9 +167,10 @@ module Gitlab
end
def deep_indifferent_access(data)
if data.is_a?(Array)
case data
when Array
data.map(&method(:deep_indifferent_access))
elsif data.is_a?(Hash)
when Hash
data.with_indifferent_access
else
data
@ -177,9 +178,10 @@ module Gitlab
end
def deep_symbolized_access(data)
if data.is_a?(Array)
case data
when Array
data.map(&method(:deep_symbolized_access))
elsif data.is_a?(Hash)
when Hash
data.deep_symbolize_keys
else
data

View File

@ -88,9 +88,10 @@ module Gitlab
#
# Depending on a type ensure that there's a single memory allocation
def ivar(name)
if name.is_a?(Symbol)
case name
when Symbol
name.to_s.prepend("@").to_sym
elsif name.is_a?(String)
when String
:"@#{name}"
else
raise ArgumentError, "Invalid type of '#{name}'"

View File

@ -3451,6 +3451,9 @@ msgstr ""
msgid "Administrators"
msgstr ""
msgid "Administrators are not permitted to connect applications with these scopes: %{code_open}api%{code_close}, %{code_open}read_api%{code_close}, %{code_open}read_repository%{code_close}, %{code_open}write_repository%{code_close}, %{code_open}write_registry%{code_close}, %{code_open}read_registry%{code_close}, and %{code_open}sudo%{code_close}. To permit this, change the %{code_open}disable_admin_oauth_scopes%{code_close} setting using the API."
msgstr ""
msgid "Admin|Additional users must be reviewed and approved by a system administrator. Learn more about %{help_link_start}usage caps%{help_link_end}."
msgstr ""
@ -17175,6 +17178,9 @@ msgstr ""
msgid "For more information, see the File Hooks documentation."
msgstr ""
msgid "Forbidden"
msgstr ""
msgid "Forgot your password?"
msgstr ""

View File

@ -305,11 +305,12 @@ module QA
prefix = "-o merge_request"
opts.each_with_object([]) do |(key, value), options|
if value.is_a?(Array)
case value
when Array
value.each do |item|
options << "#{prefix}.#{key}=\"#{item}\""
end
elsif value == true
when true
options << "#{prefix}.#{key}"
else
options << "#{prefix}.#{key}=\"#{value}\""

View File

@ -19,7 +19,8 @@ module QA
options.to_a.each do |opt|
# The argument for the --set-feature-flags option should look something like "flag1=enabled,flag2=disabled"
# Here we translate that string into a hash, e.g.: { 'flag1' => 'enabled', 'flag2' => "disabled" }
if opt.name == :set_feature_flags
case opt.name
when :set_feature_flags
parser.on(opt.arg, opt.desc) do |flags|
value = flags.split(',').each_with_object({}) do |pair, hash|
flag_name, flag_value = pair.split('=')
@ -31,7 +32,7 @@ module QA
end
next
elsif opt.name == :count_examples_only || opt.name == :test_metadata_only
when :count_examples_only, :test_metadata_only
parser.on(opt.arg, opt.desc) do |value|
QA::Runtime::Env.dry_run = true
Runtime::Scenario.define(opt.name, value)

View File

@ -19,7 +19,7 @@ RSpec.describe Admin::IntegrationsController do
describe '#edit' do
Integration.available_integration_names.each do |integration_name|
context "#{integration_name}" do
context integration_name.to_s do
it 'successfully displays the template' do
get :edit, params: { id: integration_name }

View File

@ -213,6 +213,75 @@ RSpec.describe Oauth::AuthorizationsController do
expect(response).to redirect_to(new_user_session_path)
end
end
context 'when the user is admin' do
context 'when disable_admin_oauth_scopes is set' do
before do
stub_application_setting(disable_admin_oauth_scopes: true)
scopes = Doorkeeper::OAuth::Scopes.from_string('api')
allow(Doorkeeper.configuration).to receive(:scopes).and_return(scopes)
end
let(:user) { create(:user, :admin) }
it 'returns 200 and renders forbidden view' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/forbidden')
end
end
context 'when disable_admin_oauth_scopes is set and the application is trusted' do
before do
stub_application_setting(disable_admin_oauth_scopes: true)
application.update!(trusted: true)
end
let(:application_scopes) { 'api' }
let(:user) { create(:user, :admin) }
it 'returns 200 and renders redirect view' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/redirect')
end
end
context 'when disable_admin_oauth_scopes is disabled' do
before do
stub_application_setting(disable_admin_oauth_scopes: false)
end
let(:application_scopes) { 'api' }
let(:user) { create(:user, :admin) }
it 'returns 200 and renders new view' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/new')
end
end
end
context 'when the user is not admin' do
context 'when disable_admin_oauth_scopes is enabled' do
before do
stub_application_setting(disable_admin_oauth_scopes: true)
end
it 'returns 200 and renders new view' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('doorkeeper/authorizations/new')
end
end
end
end
describe 'POST #create' do

View File

@ -1088,6 +1088,24 @@ RSpec.describe Projects::IssuesController do
end
end
context 'when trying to create a objective' do
it 'defaults to issue type' do
issue = post_new_issue(issue_type: 'objective')
expect(issue.issue_type).to eq('issue')
expect(issue.work_item_type.base_type).to eq('issue')
end
end
context 'when trying to create a key_result' do
it 'defaults to issue type' do
issue = post_new_issue(issue_type: 'key_result')
expect(issue.issue_type).to eq('issue')
expect(issue.work_item_type.base_type).to eq('issue')
end
end
context 'when create service return an unrecoverable error with http_status' do
let(:http_status) { 403 }

View File

@ -35,9 +35,10 @@ RSpec.describe 'User adds lists', :js do
set_cookie('sidebar_collapsed', 'true')
if board_type == :project
case board_type
when :project
visit project_board_path(project, project_board)
elsif board_type == :group
when :group
visit group_board_path(group, group_board)
end

View File

@ -212,13 +212,13 @@ RSpec.describe 'Commits' do
end
context 'author is just a name' do
let(:author) { "#{author_commit.author_name}" }
let(:author) { author_commit.author_name.to_s }
it_behaves_like 'show commits by author'
end
context 'author is just an email' do
let(:author) { "#{author_commit.author_email}" }
let(:author) { author_commit.author_email.to_s }
it_behaves_like 'show commits by author'
end

View File

@ -186,7 +186,7 @@ RSpec.describe "Issues > User edits issue", :js do
visit project_issue_path(project, issue)
page.within('.assignee') do
expect(page).to have_content "#{user.name}"
expect(page).to have_content user.name.to_s
click_link 'Edit'
click_link 'Unassigned'
@ -261,7 +261,7 @@ RSpec.describe "Issues > User edits issue", :js do
visit project_issue_path(project, issue)
page.within('.assignee') do
expect(page).to have_content "#{user.name}"
expect(page).to have_content user.name.to_s
click_button('Edit')
wait_for_requests

View File

@ -19,7 +19,7 @@ RSpec.describe 'Merge request > User scrolls to note on load', :js do
wait_for_all_requests
expect(page).to have_selector("#{fragment_id}")
expect(page).to have_selector(fragment_id.to_s)
page_scroll_y = page.evaluate_script("window.scrollY")
fragment_position_top = page.evaluate_script("Math.round(document.querySelector('#{fragment_id}').getBoundingClientRect().top + window.pageYOffset)")

View File

@ -15,7 +15,7 @@ RSpec.describe 'OneTrust' do
end
it 'has the OneTrust CSP settings', :aggregate_failures do
expect(response_headers['Content-Security-Policy']).to include("#{onetrust_url}")
expect(response_headers['Content-Security-Policy']).to include(onetrust_url.to_s)
expect(page.html).to include("https://cdn.cookielaw.org/consent/#{one_trust_id}/OtAutoBlock.js")
end
end

View File

@ -102,8 +102,8 @@ RSpec.describe 'viewing an issue with cross project references' do
it 'shows only the link to the cross project references' do
visit project_issue_path(project, issue)
expect(page).to have_link("#{other_issue.to_reference(project)}")
expect(page).to have_link("#{other_merge_request.to_reference(project)}")
expect(page).to have_link(other_issue.to_reference(project).to_s)
expect(page).to have_link(other_merge_request.to_reference(project).to_s)
expect(page).not_to have_content("#{other_issue.to_reference(project)} (#{other_issue.state})")
expect(page).not_to have_xpath("//a[@title='#{other_issue.title}']")
expect(page).not_to have_content("#{other_merge_request.to_reference(project)} (#{other_merge_request.state})")
@ -113,7 +113,7 @@ RSpec.describe 'viewing an issue with cross project references' do
it 'does not link a cross project confidential issue if the user does not have access' do
visit project_issue_path(project, issue)
expect(page).not_to have_link("#{other_confidential_issue.to_reference(project)}")
expect(page).not_to have_link(other_confidential_issue.to_reference(project).to_s)
expect(page).not_to have_xpath("//a[@title='#{other_confidential_issue.title}']")
end
@ -122,7 +122,7 @@ RSpec.describe 'viewing an issue with cross project references' do
visit project_issue_path(project, issue)
expect(page).to have_link("#{other_confidential_issue.to_reference(project)}")
expect(page).to have_link(other_confidential_issue.to_reference(project).to_s)
expect(page).not_to have_xpath("//a[@title='#{other_confidential_issue.title}']")
end

View File

@ -203,15 +203,15 @@ RSpec.describe 'User browses jobs' do
end
it 'contains a link to the job sha' do
expect(page.find('[data-testid="job-sha"]')).to have_content "#{job.sha[0..7]}"
expect(page.find('[data-testid="job-sha"]')).to have_content job.sha[0..7].to_s
end
it 'contains a link to the job id' do
expect(page.find('[data-testid="job-id-link"]')).to have_content "#{job.id}"
expect(page.find('[data-testid="job-id-link"]')).to have_content job.id.to_s
end
it 'contains a link to the job ref' do
expect(page.find('[data-testid="job-ref"]')).to have_content "#{job.ref}"
expect(page.find('[data-testid="job-ref"]')).to have_content job.ref.to_s
end
end
end

View File

@ -2,7 +2,7 @@
exports[`note_app when sort direction is asc shows skeleton notes after the loaded discussions 1`] = `
"<ul id=\\"notes-list\\" class=\\"notes main-notes-list timeline\\">
<noteable-discussion-stub discussion=\\"[object Object]\\" renderdifffile=\\"true\\" helppagepath=\\"\\" isoverviewtab=\\"true\\"></noteable-discussion-stub>
<noteable-discussion-stub discussion=\\"[object Object]\\" renderdifffile=\\"true\\" helppagepath=\\"\\" isoverviewtab=\\"true\\" shouldscrolltonote=\\"true\\"></noteable-discussion-stub>
<skeleton-loading-container-stub class=\\"note-skeleton\\"></skeleton-loading-container-stub>
<!---->
</ul>"
@ -11,7 +11,7 @@ exports[`note_app when sort direction is asc shows skeleton notes after the load
exports[`note_app when sort direction is desc shows skeleton notes before the loaded discussions 1`] = `
"<ul id=\\"notes-list\\" class=\\"notes main-notes-list timeline\\">
<skeleton-loading-container-stub class=\\"note-skeleton\\"></skeleton-loading-container-stub>
<noteable-discussion-stub discussion=\\"[object Object]\\" renderdifffile=\\"true\\" helppagepath=\\"\\" isoverviewtab=\\"true\\"></noteable-discussion-stub>
<noteable-discussion-stub discussion=\\"[object Object]\\" renderdifffile=\\"true\\" helppagepath=\\"\\" isoverviewtab=\\"true\\" shouldscrolltonote=\\"true\\"></noteable-discussion-stub>
<!---->
</ul>"
`;

View File

@ -43,7 +43,7 @@ RSpec.describe Resolvers::ContainerRepositoriesResolver do
end
[:created_desc, :updated_asc, :name_desc].each do |order|
context "#{order}" do
context order.to_s do
let(:args) { { sort: order } }
it { is_expected.to eq([sort_repository2, sort_repository]) }
@ -51,7 +51,7 @@ RSpec.describe Resolvers::ContainerRepositoriesResolver do
end
[:created_asc, :updated_desc, :name_asc].each do |order|
context "#{order}" do
context order.to_s do
let(:args) { { sort: order } }
it { is_expected.to eq([sort_repository, sort_repository2]) }

View File

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Types::IssueTypeEnum do
specify { expect(described_class.graphql_name).to eq('IssueType') }
it 'exposes all the existing issue type values' do
it 'exposes all the existing issue type values except objective & key_result' do
expect(described_class.values.keys).to match_array(
%w[ISSUE INCIDENT TEST_CASE REQUIREMENT TASK]
)

View File

@ -33,7 +33,7 @@ RSpec.describe EnvironmentsHelper do
'default_branch' => 'master',
'project_path' => project_path(project),
'tags_path' => project_tags_path(project),
'has_metrics' => "#{environment.has_metrics?}",
'has_metrics' => environment.has_metrics?.to_s,
'external_dashboard_url' => nil,
'environment_state' => environment.state,
'custom_metrics_path' => project_prometheus_metrics_path(project),

View File

@ -174,7 +174,7 @@ RSpec.describe IntegrationsHelper do
end
it "only consider these enumeration values are valid" do
expected_valid_types = %w[issue incident test_case requirement task]
expected_valid_types = %w[issue incident test_case requirement task objective key_result]
expect(Issue.issue_types.keys).to contain_exactly(*expected_valid_types)
end
end

View File

@ -74,7 +74,7 @@ RSpec.describe SnippetsHelper do
let(:snippet) { public_personal_snippet }
it 'returns copy button of embedded snippets' do
expect(subject).to eq(copy_button("#{blob.id}"))
expect(subject).to eq(copy_button(blob.id.to_s))
end
end
@ -82,7 +82,7 @@ RSpec.describe SnippetsHelper do
let(:snippet) { public_project_snippet }
it 'returns copy button of embedded snippets' do
expect(subject).to eq(copy_button("#{blob.id}"))
expect(subject).to eq(copy_button(blob.id.to_s))
end
end

View File

@ -120,7 +120,7 @@ RSpec.describe API::Helpers::Packages::DependencyProxyHelpers do
end
Packages::Package.package_types.keys.without('maven', 'npm', 'pypi').each do |pkg_type|
context "#{pkg_type}" do
context pkg_type.to_s do
let(:package_type) { pkg_type.to_sym }
it 'raises an error' do

View File

@ -38,7 +38,7 @@ RSpec.describe API::Validations::Validators::GitRef do
expect_validation_error('test' => 'heads/f[/bar')
expect_validation_error('test' => "heads/foo\t")
expect_validation_error('test' => "heads/foo\177")
expect_validation_error('test' => "#{'a' * 1025}")
expect_validation_error('test' => 'a' * 1025)
expect_validation_error('test' => nil)
expect_validation_error('test' => '')
end

View File

@ -13,13 +13,13 @@ RSpec.describe API::Validations::Validators::Limit do
it 'does not raise a validation error' do
expect_no_validation_error('test' => '123-456')
expect_no_validation_error('test' => '00000000-ffff-0000-ffff-000000000000')
expect_no_validation_error('test' => "#{'a' * 255}")
expect_no_validation_error('test' => 'a' * 255)
end
end
context 'longer than limit param' do
it 'raises a validation error' do
expect_validation_error('test' => "#{'a' * 256}")
expect_validation_error('test' => 'a' * 256)
end
end

View File

@ -19,12 +19,12 @@ RSpec.describe Backup::DatabaseBackupError do
it { is_expected.to respond_to :db_file_name }
it 'expects exception message to include database file' do
expect(subject.message).to include("#{db_file_name}")
expect(subject.message).to include(db_file_name.to_s)
end
it 'expects exception message to include database paths being back-up' do
expect(subject.message).to include("#{config[:host]}")
expect(subject.message).to include("#{config[:port]}")
expect(subject.message).to include("#{config[:database]}")
expect(subject.message).to include(config[:host].to_s)
expect(subject.message).to include(config[:port].to_s)
expect(subject.message).to include(config[:database].to_s)
end
end

View File

@ -13,11 +13,11 @@ RSpec.describe Backup::FileBackupError do
it { is_expected.to respond_to :backup_tarball }
it 'expects exception message to include file backup path location' do
expect(subject.message).to include("#{subject.backup_tarball}")
expect(subject.message).to include(subject.backup_tarball.to_s)
end
it 'expects exception message to include file being back-up' do
expect(subject.message).to include("#{subject.app_files_dir}")
expect(subject.message).to include(subject.app_files_dir.to_s)
end
end

View File

@ -195,7 +195,7 @@ RSpec.describe Banzai::Filter::AutolinkFilter do
it 'escapes RTLO and other characters' do
# rendered text looks like "http://example.com/evilexe.mp3"
evil_link = "#{link}evil\u202E3pm.exe"
doc = filter("#{evil_link}")
doc = filter(evil_link.to_s)
expect(doc.at_css('a')['href']).to eq "http://about.gitlab.com/evil%E2%80%AE3pm.exe"
end

View File

@ -91,7 +91,7 @@ RSpec.describe Banzai::Filter::IssuableReferenceExpansionFilter do
link = create_link(closed_issue.to_reference(other_project), issue: closed_issue.id, reference_type: 'issue')
doc = filter(link, context.merge(project: other_project))
expect(doc.css('a').last.text).to eq("#{closed_issue.to_reference(other_project)}")
expect(doc.css('a').last.text).to eq(closed_issue.to_reference(other_project).to_s)
end
it 'does not append state when filter is not enabled' do

View File

@ -229,7 +229,7 @@ RSpec.describe Banzai::Filter::References::AlertReferenceFilter do
let(:alert2_reference) { alert2.to_reference(full: true) }
it 'does not have N+1 per multiple references per project', :use_sql_query_cache do
markdown = "#{alert_reference}"
markdown = alert_reference.to_s
max_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
reference_filter(markdown)
end.count

View File

@ -282,7 +282,7 @@ RSpec.describe Banzai::Filter::References::CommitReferenceFilter do
let(:commit3_reference) { commit3.to_reference(full: true) }
it 'does not have N+1 per multiple references per project', :use_sql_query_cache do
markdown = "#{commit_reference}"
markdown = commit_reference.to_s
max_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
reference_filter(markdown)
end.count

View File

@ -392,7 +392,7 @@ RSpec.describe Banzai::Filter::References::IssueReferenceFilter do
context 'cross-project URL in link href' do
let(:reference_link) { %{<a href="#{reference}">Reference</a>} }
let(:reference) { "#{issue_url + "#note_123"}" }
let(:reference) { (issue_url + "#note_123").to_s }
let(:issue) { create(:issue, project: project2) }
let(:project2) { create(:project, :public, namespace: namespace) }
let(:namespace) { create(:namespace, name: 'cross-reference') }
@ -497,7 +497,7 @@ RSpec.describe Banzai::Filter::References::IssueReferenceFilter do
end
it 'links to a valid reference for cross-reference in link href' do
reference = "#{issue_url + "#note_123"}"
reference = (issue_url + "#note_123").to_s
reference_link = %{<a href="#{reference}">Reference</a>}
doc = reference_filter("See #{reference_link}", context)

View File

@ -715,13 +715,13 @@ RSpec.describe Banzai::Filter::References::LabelReferenceFilter do
let_it_be(:project_label2) { create(:label, project: project) }
let_it_be(:project2_label) { create(:label, project: project2) }
let_it_be(:group2_label) { create(:group_label, group: group2, color: '#00ff00') }
let_it_be(:project_reference) { "#{project_label.to_reference}" }
let_it_be(:project_reference2) { "#{project_label2.to_reference}" }
let_it_be(:project2_reference) { "#{project2_label.to_reference}" }
let_it_be(:project_reference) { project_label.to_reference.to_s }
let_it_be(:project_reference2) { project_label2.to_reference.to_s }
let_it_be(:project2_reference) { project2_label.to_reference.to_s }
let_it_be(:group2_reference) { "#{project2.full_path}~#{group2_label.name}" }
it 'does not have N+1 per multiple references per project', :use_sql_query_cache do
markdown = "#{project_reference}"
markdown = project_reference.to_s
control_count = 1
expect do
@ -737,7 +737,7 @@ RSpec.describe Banzai::Filter::References::LabelReferenceFilter do
it 'has N+1 for multiple unique project/group references', :use_sql_query_cache do
# reference to already loaded project, only one query
markdown = "#{project_reference}"
markdown = project_reference.to_s
control_count = 1
expect do

View File

@ -490,13 +490,13 @@ RSpec.describe Banzai::Filter::References::MilestoneReferenceFilter do
let_it_be(:project_milestone2) { create(:milestone, project: project) }
let_it_be(:project2_milestone) { create(:milestone, project: project2) }
let_it_be(:group2_milestone) { create(:milestone, group: group2) }
let_it_be(:project_reference) { "#{project_milestone.to_reference}" }
let_it_be(:project_reference2) { "#{project_milestone2.to_reference}" }
let_it_be(:project2_reference) { "#{project2_milestone.to_reference(full: true)}" }
let_it_be(:project_reference) { project_milestone.to_reference.to_s }
let_it_be(:project_reference2) { project_milestone2.to_reference.to_s }
let_it_be(:project2_reference) { project2_milestone.to_reference(full: true).to_s }
let_it_be(:group2_reference) { "#{project2.full_path}%\"#{group2_milestone.name}\"" }
it 'does not have N+1 per multiple references per project', :use_sql_query_cache do
markdown = "#{project_reference}"
markdown = project_reference.to_s
control_count = 4
expect do
@ -511,7 +511,7 @@ RSpec.describe Banzai::Filter::References::MilestoneReferenceFilter do
end
it 'has N+1 for multiple unique project/group references', :use_sql_query_cache do
markdown = "#{project_reference}"
markdown = project_reference.to_s
control_count = 4
expect do

View File

@ -6,7 +6,7 @@ RSpec.describe Banzai::Filter::References::ProjectReferenceFilter do
include FilterSpecHelper
def invalidate_reference(reference)
"#{reference.reverse}"
reference.reverse.to_s
end
def get_reference(project)
@ -109,7 +109,7 @@ RSpec.describe Banzai::Filter::References::ProjectReferenceFilter do
let_it_be(:nested_project_reference) { get_reference(nested_project) }
it 'does not have N+1 per multiple project references', :use_sql_query_cache do
markdown = "#{normal_project_reference}"
markdown = normal_project_reference.to_s
# warm up first
reference_filter(markdown)

View File

@ -209,7 +209,7 @@ RSpec.describe Banzai::Filter::References::UserReferenceFilter do
let(:reference3) { group.to_reference }
it 'does not have N+1 per multiple user references', :use_sql_query_cache do
markdown = "#{reference}"
markdown = reference.to_s
control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
reference_filter(markdown)

View File

@ -522,7 +522,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :enable }
let(:expected_extra) { { "extra.thing" => "#{thing.flipper_id}" } }
let(:expected_extra) { { "extra.thing" => thing.flipper_id.to_s } }
end
end
end
@ -548,7 +548,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :disable }
let(:expected_extra) { { "extra.thing" => "#{thing.flipper_id}" } }
let(:expected_extra) { { "extra.thing" => thing.flipper_id.to_s } }
end
end
end
@ -561,7 +561,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :enable_percentage_of_time }
let(:expected_extra) { { "extra.percentage" => "#{percentage}" } }
let(:expected_extra) { { "extra.percentage" => percentage.to_s } }
end
end
@ -584,7 +584,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :enable_percentage_of_actors }
let(:expected_extra) { { "extra.percentage" => "#{percentage}" } }
let(:expected_extra) { { "extra.percentage" => percentage.to_s } }
end
end

View File

@ -89,12 +89,13 @@ RSpec.describe Gitlab::Auth::AuthFinders do
context 'with a running job' do
let(:token) { job.token }
if without_job_token_allowed == :error
case without_job_token_allowed
when :error
it 'returns an Unauthorized exception' do
expect { subject }.to raise_error(Gitlab::Auth::UnauthorizedError)
expect(@current_authenticated_job).to be_nil
end
elsif without_job_token_allowed == :user
when :user
it 'returns the user' do
expect(subject).to eq(user)
expect(@current_authenticated_job).to eq job

View File

@ -241,7 +241,7 @@ RSpec.describe Gitlab::BackgroundMigration::LegacyUploadMover, :aggregate_failur
context 'when legacy uploads are stored in object storage' do
let(:legacy_upload) { create_remote_upload(note, filename) }
let(:remote_file) do
{ key: "#{legacy_upload.path}" }
{ key: legacy_upload.path.to_s }
end
let(:connection) { ::Fog::Storage.new(FileUploader.object_store_credentials) }

View File

@ -28,7 +28,7 @@ RSpec.describe Gitlab::BackgroundMigration::PopulateVulnerabilityReads, :migrati
project_id: project.id,
external_type: 'uuid-v5',
external_id: 'uuid-v5',
fingerprint: Digest::SHA1.hexdigest("#{vulnerability.id}"),
fingerprint: Digest::SHA1.hexdigest(vulnerability.id.to_s),
name: 'Identifier for UUIDv5')
create_finding!(

View File

@ -673,7 +673,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do
with_them do
let(:config) { { script: 'ls', rules: rules, only: only }.compact }
it "#{name}" do
it name.to_s do
expect(workflow).to receive(:has_rules?) { has_workflow_rules? }
entry.compose!(deps)

View File

@ -248,7 +248,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
with_them do
let(:config) { { script: 'ls', rules: rules, only: only }.compact }
it "#{name}" do
it name.to_s do
expect(workflow).to receive(:has_rules?) { has_workflow_rules? }
entry.compose!(deps)

View File

@ -209,7 +209,7 @@ RSpec.describe Gitlab::Ci::Reports::TestSuite do
Gitlab::Ci::Reports::TestCase::STATUS_TYPES.each do |status_type|
describe "##{status_type}" do
subject { test_suite.public_send("#{status_type}") }
subject { test_suite.public_send(status_type.to_s) }
context "when #{status_type} test case exists" do
before do

View File

@ -330,7 +330,7 @@ RSpec.describe Gitlab::Database::BatchCount do
end
it 'counts with "id" field' do
expect(described_class.batch_distinct_count(model, "#{column}")).to eq(2)
expect(described_class.batch_distinct_count(model, column.to_s)).to eq(2)
end
it 'counts with table.column field' do

View File

@ -53,7 +53,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::ConnectionProxy do
end
Gitlab::Database::LoadBalancing::ConnectionProxy::NON_STICKY_READS.each do |name|
describe "#{name}" do
describe name.to_s do
it 'runs the query on the replica' do
expect(proxy).to receive(:read_using_load_balancer)
.with(name, 'foo')
@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::ConnectionProxy do
end
Gitlab::Database::LoadBalancing::ConnectionProxy::STICKY_WRITES.each do |name|
describe "#{name}" do
describe name.to_s do
it 'runs the query on the primary and sticks to it' do
session = Gitlab::Database::LoadBalancing::Session.new

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