Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-05-10 18:08:27 +00:00
parent 758b97662c
commit 56b3925584
116 changed files with 505 additions and 522 deletions

View File

@ -152,11 +152,6 @@ Rails/NegateInclude:
Rails/RakeEnvironment:
Enabled: false
# Offense count: 278
# Cop supports --auto-correct.
Rails/SquishedSQLHeredocs:
Enabled: false
# Offense count: 44
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.

View File

@ -0,0 +1,217 @@
---
# Cop supports --auto-correct.
Rails/SquishedSQLHeredocs:
# Offense count: 356
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/finders/members_finder.rb'
- 'app/models/analytics/cycle_analytics/stage_event_hash.rb'
- 'app/models/ci/resource_group.rb'
- 'app/models/clusters/clusters_hierarchy.rb'
- 'app/models/concerns/analytics/cycle_analytics/stage_event_model.rb'
- 'app/models/concerns/has_environment_scope.rb'
- 'app/models/customer_relations/contact.rb'
- 'app/models/customer_relations/organization.rb'
- 'app/models/deployment.rb'
- 'app/models/issue/metrics.rb'
- 'app/models/merge_request/metrics.rb'
- 'app/models/namespace/traversal_hierarchy.rb'
- 'app/models/namespaces/traversal/linear.rb'
- 'app/models/project.rb'
- 'app/models/user.rb'
- 'app/services/issuable/destroy_label_links_service.rb'
- 'app/services/issues/relative_position_rebalancing_service.rb'
- 'app/services/projects/fetch_statistics_increment_service.rb'
- 'app/services/todos/destroy/destroyed_issuable_service.rb'
- 'app/workers/users/deactivate_dormant_users_worker.rb'
- 'db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb'
- 'db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb'
- 'db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb'
- 'db/migrate/20210617022324_create_incident_management_pending_alert_escalations.rb'
- 'db/migrate/20210621043337_rename_services_to_integrations.rb'
- 'db/migrate/20210621044000_rename_services_indexes_to_integrations.rb'
- 'db/migrate/20210706152139_add_index_type_to_postgres_indexes_view.rb'
- 'db/migrate/20210719145532_add_foreign_keys_view.rb'
- 'db/migrate/20210721135638_add_triggers_to_integrations_type_new.rb'
- 'db/migrate/20210721174453_remove_schedule_and_status_null_constraints_from_pending_escalations_alert.rb'
- 'db/migrate/20210722150102_operations_feature_flags_correct_flexible_rollout_values.rb'
- 'db/migrate/20210730194555_create_incident_management_pending_issue_escalations.rb'
- 'db/migrate/20210818175949_update_integrations_trigger_type_new_on_insert.rb'
- 'db/migrate/20210825104656_create_analytics_cycle_analytics_merge_request_stage_events.rb'
- 'db/migrate/20210825110016_create_analytics_cycle_analytics_issue_stage_events.rb'
- 'db/migrate/20210826122748_create_loose_foreign_keys_deleted_records.rb'
- 'db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb'
- 'db/migrate/20210903054158_recreate_stage_issue_events_table_with_bigints.rb'
- 'db/migrate/20210906100021_delete_project_namespace_trigger.rb'
- 'db/migrate/20210929032555_create_verification_codes.rb'
- 'db/migrate/20211005092428_drop_time_range_partitioned_loose_fk.rb'
- 'db/migrate/20211005093558_add_range_partitioned_loose_fk_table.rb'
- 'db/migrate/20211005100112_recreate_loose_fk_insert_function.rb'
- 'db/migrate/20211007090229_create_issue_search_table.rb'
- 'db/migrate/20211011141242_create_namespaces_sync_trigger.rb'
- 'db/migrate/20211011141243_create_projects_sync_trigger.rb'
- 'db/migrate/20211012015903_next_traversal_ids_sibling_function.rb'
- 'db/migrate/20211018161447_fix_double_entries_in_postgres_index_view.rb'
- 'db/migrate/20211112155416_populate_default_value_for_personal_access_tokens_prefix.rb'
- 'db/migrate/20211118103439_remove_hardcoded_partition_from_loose_fk_trigger_function.rb'
- 'db/migrate/20211123135255_create_batched_background_migration_job_transition_logs.rb'
- 'db/migrate/20220106111958_add_insert_or_update_vulnerability_reads_trigger.rb'
- 'db/migrate/20220106112043_add_update_vulnerability_reads_trigger.rb'
- 'db/migrate/20220106112085_add_update_vulnerability_reads_location_trigger.rb'
- 'db/migrate/20220106163326_add_has_issues_on_vulnerability_reads_trigger.rb'
- 'db/migrate/20220208171826_update_default_scan_method_of_dast_site_profile.rb'
- 'db/migrate/20220211214605_update_integrations_trigger_type_new_on_insert_null_safe.rb'
- 'db/migrate/20220213100000_remove_integration_type_triggers.rb'
- 'db/migrate/20220304052335_remove_not_null_contraint_on_title_from_sprints.rb'
- 'db/migrate/20220321234317_remove_all_issuable_escalation_statuses.rb'
- 'db/migrate/20220329110630_add_ci_namespace_mirrors_unnest_index_on_traversal_ids.rb'
- 'db/migrate/20220412060931_add_nullify_build_data_trigger_on_merge_request_metrics.rb'
- 'db/migrate/20220413124200_add_view_for_per_table_autovacuum_status.rb'
- 'db/migrate/20220415015143_replace_iterations_cadence_date_range_constraint.rb'
- 'db/migrate/20220422200633_fix_view_for_per_table_autovacuum_status.rb'
- 'db/migrate/20220422220507_remove_tmp_index_supporting_leaky_regex_cleanup.rb'
- 'db/post_migrate/20210302074524_backfill_namespace_statistics_with_wiki_size.rb'
- 'db/post_migrate/20210311045138_set_traversal_ids_for_gitlab_org_group_staging.rb'
- 'db/post_migrate/20210311045139_set_traversal_ids_for_gitlab_org_group_com.rb'
- 'db/post_migrate/20210311093723_add_partial_index_on_ci_pipelines_by_cancelable_status_and_users.rb'
- 'db/post_migrate/20210317104032_set_iteration_cadence_automatic_to_false.rb'
- 'db/post_migrate/20210331105335_drop_non_partitioned_audit_events.rb'
- 'db/post_migrate/20210430134202_copy_adoption_snapshot_namespace.rb'
- 'db/post_migrate/20210430135954_copy_adoption_segments_namespace.rb'
- 'db/post_migrate/20210525075724_clean_up_pending_builds_table.rb'
- 'db/post_migrate/20210609125005_drop_non_partitioned_web_hook_logs.rb'
- 'db/post_migrate/20210610102413_migrate_protected_attribute_to_pending_builds.rb'
- 'db/post_migrate/20210610141711_disable_expiration_policies_linked_to_no_container_images.rb'
- 'db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb'
- 'db/post_migrate/20210721174521_add_non_null_constraint_for_escalation_rule_on_pending_alert_escalations.rb'
- 'db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb'
- 'db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb'
- 'db/post_migrate/20210910194952_update_report_type_for_existing_approval_project_rules.rb'
- 'db/post_migrate/20211105135157_drop_ci_build_trace_sections.rb'
- 'db/post_migrate/20211112113300_remove_ci_pipeline_chat_data_fk_on_chat_names.rb'
- 'db/post_migrate/20211130165043_backfill_sequence_column_for_sprints_table.rb'
- 'db/post_migrate/20211206161271_add_indexes_for_primary_email_cleanup_migration.rb'
- 'db/post_migrate/20211220064757_drop_temporary_indexes_for_primary_email_migration.rb'
- 'db/post_migrate/20220128155251_remove_dangling_running_builds.rb'
- 'db/post_migrate/20220204095121_backfill_namespace_statistics_with_dependency_proxy_size.rb'
- 'db/post_migrate/20220204110725_backfill_cycle_analytics_aggregations.rb'
- 'db/post_migrate/20220213103859_remove_integrations_type.rb'
- 'db/post_migrate/20220309084954_remove_leftover_external_pull_request_deletions.rb'
- 'db/post_migrate/20220318111040_add_indexes_for_primary_email_second_cleanup_migration.rb'
- 'db/post_migrate/20220318111949_drop_temporary_indexes_for_primary_email_migration_second_cleanup.rb'
- 'db/post_migrate/20220329175119_remove_leftover_ci_job_artifact_deletions.rb'
- 'db/post_migrate/20220420135946_update_batched_background_migration_arguments.rb'
- 'ee/app/models/dora/daily_metrics.rb'
- 'ee/app/models/ee/group.rb'
- 'ee/app/models/ee/issue.rb'
- 'ee/app/models/iterations/cadence.rb'
- 'ee/app/models/vulnerabilities/statistic.rb'
- 'ee/app/services/analytics/cycle_analytics/consistency_check_service.rb'
- 'ee/app/services/security/ingestion/bulk_updatable_task.rb'
- 'ee/app/services/security/ingestion/tasks/ingest_vulnerability_statistics.rb'
- 'ee/app/services/vulnerabilities/historical_statistics/adjustment_service.rb'
- 'ee/app/services/vulnerabilities/statistics/adjustment_service.rb'
- 'ee/app/services/vulnerabilities/statistics/update_service.rb'
- 'ee/db/geo/migrate/20170906174622_remove_duplicates_from_project_registry.rb'
- 'ee/db/geo/migrate/20180510223634_set_resync_flag_for_retried_projects.rb'
- 'ee/db/geo/post_migrate/20210217020154_add_unique_index_on_container_repository_registry.rb'
- 'ee/db/geo/post_migrate/20210217020156_add_unique_index_on_terraform_state_version_registry.rb'
- 'ee/lib/ee/gitlab/background_migration/backfill_iteration_cadence_id_for_boards.rb'
- 'ee/lib/ee/gitlab/background_migration/create_security_setting.rb'
- 'ee/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids.rb'
- 'ee/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column.rb'
- 'ee/lib/ee/gitlab/background_migration/populate_status_column_of_security_scans.rb'
- 'ee/lib/ee/gitlab/background_migration/populate_test_reports_issue_id.rb'
- 'ee/lib/ee/gitlab/background_migration/update_vulnerability_occurrences_location.rb'
- 'ee/lib/ee/gitlab/usage_data.rb'
- 'ee/lib/gitlab/geo/base_batcher.rb'
- 'ee/spec/models/ee/user_spec.rb'
- 'lib/gitlab/background_migration/backfill_ci_namespace_mirrors.rb'
- 'lib/gitlab/background_migration/backfill_ci_project_mirrors.rb'
- 'lib/gitlab/background_migration/backfill_group_features.rb'
- 'lib/gitlab/background_migration/backfill_integrations_type_new.rb'
- 'lib/gitlab/background_migration/backfill_issue_search_data.rb'
- 'lib/gitlab/background_migration/backfill_namespace_id_for_project_route.rb'
- 'lib/gitlab/background_migration/backfill_namespace_traversal_ids_children.rb'
- 'lib/gitlab/background_migration/backfill_project_settings.rb'
- 'lib/gitlab/background_migration/backfill_projects_with_coverage.rb'
- 'lib/gitlab/background_migration/backfill_upvotes_count_on_issues.rb'
- 'lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans.rb'
- 'lib/gitlab/background_migration/disable_expiration_policies_linked_to_no_container_images.rb'
- 'lib/gitlab/background_migration/encrypt_static_object_token.rb'
- 'lib/gitlab/background_migration/fix_duplicate_project_name_and_path.rb'
- 'lib/gitlab/background_migration/fix_first_mentioned_in_commit_at.rb'
- 'lib/gitlab/background_migration/fix_projects_without_project_feature.rb'
- 'lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb'
- 'lib/gitlab/background_migration/move_container_registry_enabled_to_project_feature.rb'
- 'lib/gitlab/background_migration/populate_container_repository_migration_plan.rb'
- 'lib/gitlab/background_migration/populate_topics_non_private_projects_count.rb'
- 'lib/gitlab/background_migration/populate_topics_total_projects_count_cache.rb'
- 'lib/gitlab/background_migration/populate_vulnerability_reads.rb'
- 'lib/gitlab/background_migration/project_namespaces/backfill_project_namespaces.rb'
- 'lib/gitlab/background_migration/update_timelogs_null_spent_at.rb'
- 'lib/gitlab/background_migration/update_timelogs_project_id.rb'
- 'lib/gitlab/background_migration/update_users_where_two_factor_auth_required_from_group.rb'
- 'lib/gitlab/database/bulk_update.rb'
- 'lib/gitlab/database/count/tablesample_count_strategy.rb'
- 'lib/gitlab/database/load_balancing/load_balancer.rb'
- 'lib/gitlab/database/migration_helpers.rb'
- 'lib/gitlab/database/migration_helpers/loose_foreign_key_helpers.rb'
- 'lib/gitlab/database/migration_helpers/v2.rb'
- 'lib/gitlab/database/migrations/batched_background_migration_helpers.rb'
- 'lib/gitlab/database/migrations/observers/query_statistics.rb'
- 'lib/gitlab/database/partitioning/replace_table.rb'
- 'lib/gitlab/database/partitioning/single_numeric_list_partition.rb'
- 'lib/gitlab/database/partitioning/sliding_list_strategy.rb'
- 'lib/gitlab/database/partitioning/time_partition.rb'
- 'lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table.rb'
- 'lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb'
- 'lib/gitlab/database/postgres_hll/batch_distinct_counter.rb'
- 'lib/gitlab/database/schema_helpers.rb'
- 'lib/gitlab/database/schema_migrations/migrations.rb'
- 'lib/gitlab/database/unidirectional_copy_trigger.rb'
- 'lib/gitlab/graphql/pagination/keyset/conditions/not_null_condition.rb'
- 'lib/gitlab/graphql/pagination/keyset/conditions/null_condition.rb'
- 'lib/gitlab/pagination/keyset/in_operator_optimization/query_builder.rb'
- 'lib/gitlab/sql/glob.rb'
- 'lib/tasks/dev.rake'
- 'qa/qa/service/praefect_manager.rb'
- 'spec/db/schema_spec.rb'
- 'spec/initializers/00_rails_disable_joins_spec.rb'
- 'spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb'
- 'spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb'
- 'spec/lib/gitlab/database/migration_helpers_spec.rb'
- 'spec/lib/gitlab/database/migrations/observers/query_statistics_spec.rb'
- 'spec/lib/gitlab/database/partitioning/detached_partition_dropper_spec.rb'
- 'spec/lib/gitlab/database/partitioning/monthly_strategy_spec.rb'
- 'spec/lib/gitlab/database/partitioning/partition_manager_spec.rb'
- 'spec/lib/gitlab/database/partitioning/replace_table_spec.rb'
- 'spec/lib/gitlab/database/partitioning/sliding_list_strategy_spec.rb'
- 'spec/lib/gitlab/database/partitioning/time_partition_spec.rb'
- 'spec/lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table_spec.rb'
- 'spec/lib/gitlab/database/partitioning_migration_helpers/foreign_key_helpers_spec.rb'
- 'spec/lib/gitlab/database/partitioning_migration_helpers/index_helpers_spec.rb'
- 'spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb'
- 'spec/lib/gitlab/database/partitioning_spec.rb'
- 'spec/lib/gitlab/database/postgres_foreign_key_spec.rb'
- 'spec/lib/gitlab/database/postgres_index_bloat_estimate_spec.rb'
- 'spec/lib/gitlab/database/postgres_index_spec.rb'
- 'spec/lib/gitlab/database/postgres_partition_spec.rb'
- 'spec/lib/gitlab/database/postgres_partitioned_table_spec.rb'
- 'spec/lib/gitlab/database/reindexing/reindex_concurrently_spec.rb'
- 'spec/lib/gitlab/database/reindexing_spec.rb'
- 'spec/lib/gitlab/database/schema_migrations/migrations_spec.rb'
- 'spec/lib/gitlab/database/similarity_score_spec.rb'
- 'spec/lib/gitlab/database/unidirectional_copy_trigger_spec.rb'
- 'spec/lib/gitlab/graphql/pagination/keyset/conditions/not_null_condition_spec.rb'
- 'spec/lib/gitlab/graphql/pagination/keyset/conditions/null_condition_spec.rb'
- 'spec/lib/gitlab/pagination/keyset/in_operator_optimization/strategies/record_loader_strategy_spec.rb'
- 'spec/lib/gitlab/pagination/keyset/order_spec.rb'
- 'spec/models/application_record_spec.rb'
- 'spec/models/concerns/after_commit_queue_spec.rb'
- 'spec/support/db_cleaner.rb'
- 'spec/support/helpers/database/partitioning_helpers.rb'
- 'spec/support/helpers/database/table_schema_helpers.rb'
- 'spec/support/helpers/database/trigger_helpers.rb'
- 'spec/support/shared_examples/loose_foreign_keys/have_loose_foreign_key.rb'

View File

@ -1 +1 @@
6aeaf165b7624e55e418cf29f634076658cb28bc
4729c4575139660a3aa945bd6df3c66996e26e0f

View File

@ -0,0 +1,35 @@
# frozen_string_literal: true
module Groups
module ProjectsRequiringAuthorizationsRefresh
class Base
def initialize(group)
@group = group
end
private
def ids_of_projects_in_hierarchy_and_project_shares(group)
project_ids = Set.new
ids_of_projects_in_hierarchy = group.all_projects.pluck(:id) # rubocop: disable CodeReuse/ActiveRecord
ids_of_projects_in_project_shares = ids_of_projects_shared_with_self_and_descendant_groups(group)
project_ids.merge(ids_of_projects_in_hierarchy)
project_ids.merge(ids_of_projects_in_project_shares)
project_ids
end
def ids_of_projects_shared_with_self_and_descendant_groups(group, batch_size: 50)
project_ids = Set.new
group.self_and_descendants_ids.each_slice(batch_size) do |group_ids|
project_ids.merge(ProjectGroupLink.in_group(group_ids).pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord
end
project_ids
end
end
end
end

View File

@ -8,11 +8,7 @@
module Groups
module ProjectsRequiringAuthorizationsRefresh
class OnDirectMembershipFinder
def initialize(group)
@group = group
end
class OnDirectMembershipFinder < Base
def execute
project_ids = Set.new
@ -24,28 +20,6 @@ module Groups
private
def ids_of_projects_in_hierarchy_and_project_shares(group)
project_ids = Set.new
ids_of_projects_in_hierarchy = group.all_projects.pluck(:id) # rubocop: disable CodeReuse/ActiveRecord
ids_of_projects_in_project_shares = ids_of_projects_shared_with_self_and_descendant_groups(group)
project_ids.merge(ids_of_projects_in_hierarchy)
project_ids.merge(ids_of_projects_in_project_shares)
project_ids
end
def ids_of_projects_shared_with_self_and_descendant_groups(group, batch_size: 50)
project_ids = Set.new
group.self_and_descendants_ids.each_slice(batch_size) do |group_ids|
project_ids.merge(ProjectGroupLink.in_group(group_ids).pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord
end
project_ids
end
def ids_of_projects_in_hierarchy_and_project_shares_of_shared_groups(group, batch_size: 10)
project_ids = Set.new

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
# Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder
#
# Given a group, this finder can be used to obtain a list of Project IDs of projects
# that requires their `project_authorizations` records to be refreshed in the event where
# the group has been transferred.
module Groups
module ProjectsRequiringAuthorizationsRefresh
class OnTransferFinder < Base
def execute
ids_of_projects_in_hierarchy_and_project_shares(@group).to_a
end
end
end
end

View File

@ -26,12 +26,6 @@ module Mutations
private
# TODO: remove this method when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
def find_object(id:)
super(id: ::Types::GlobalIDType[::Awardable].coerce_isolated_input(id))
end
def authorize!(object)
super
raise_resource_not_available_error!(NOT_EMOJI_AWARDABLE) unless object.emoji_awardable?

View File

@ -4,7 +4,6 @@ module Mutations
class BaseMutation < GraphQL::Schema::RelayClassicMutation
include Gitlab::Graphql::Authorize::AuthorizeResource
prepend Gitlab::Graphql::CopyFieldDescription
prepend ::Gitlab::Graphql::GlobalIDCompatibility
ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'

View File

@ -33,9 +33,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Board].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -11,9 +11,6 @@ module Mutations
description: 'ID of the job to mutate.'
def find_object(id: )
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = JobID.coerce_isolated_input(id)
GlobalID::Locator.locate(id)
end
end

View File

@ -13,9 +13,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = PipelineID.coerce_isolated_input(id)
GlobalID::Locator.locate(id)
end
end

View File

@ -23,10 +23,6 @@ module Mutations
end
def find_object(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = RunnerID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -61,10 +61,6 @@ module Mutations
end
def find_object(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = RunnerID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -58,9 +58,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ClusterAgentID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -24,9 +24,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = TokenID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -28,9 +28,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = AgentID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -8,9 +8,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::ContainerRepository].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -59,7 +59,7 @@ module Mutations
def set_organization!(args)
return unless args[:organization_id]
args[:organization_id] = resolve_ids(args[:organization_id], ::Types::GlobalIDType[::CustomerRelations::Organization])[0]
args[:organization_id] = args[:organization_id].model_id
end
end
end

View File

@ -35,9 +35,6 @@ module Mutations
end
def find_design(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = DesignID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end

View File

@ -54,9 +54,6 @@ module Mutations
end
def find_object(id:)
# TODO: remove explicit coercion once compatibility layer has been removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = Types::GlobalIDType[Discussion].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end

View File

@ -36,8 +36,6 @@ module Mutations
end
def find_object(id:)
# TODO: remove as part of https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Environment].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end

View File

@ -23,9 +23,6 @@ module Mutations
merge_request = authorized_find!(project_path: project_path, iid: iid)
project = merge_request.project
# TODO: remove this line when the compatibility layer is removed:
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
label_ids = label_ids.map { |id| ::Types::GlobalIDType[::Label].coerce_isolated_input(id) }
# MergeRequests::UpdateService expects integers
label_ids = label_ids.compact.map(&:model_id)

View File

@ -96,16 +96,7 @@ module Mutations
end
def annotation_source(args)
# TODO: remove these lines when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
annotation_source_id = if args[:cluster_id]
::Types::GlobalIDType[::Clusters::Cluster].coerce_isolated_input(args[:cluster_id])
else
::Types::GlobalIDType[::Environment].coerce_isolated_input(args[:environment_id])
end
# TODO: uncomment following line once lines above are removed
# annotation_source_id = args[:cluster_id] || args[:environment_id]
annotation_source_id = args[:cluster_id] || args[:environment_id]
authorized_find!(id: annotation_source_id)
end
end

View File

@ -17,9 +17,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove explicit coercion once compatibility layer has been removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Note].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -42,9 +42,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove explicit coercion once compatibility layer has been removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Noteable].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end

View File

@ -22,11 +22,8 @@ module Mutations
def create_note_params(noteable, args)
discussion_id = nil
if args[:discussion_id]
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
discussion_gid = ::Types::GlobalIDType[::Discussion].coerce_isolated_input(args[:discussion_id])
discussion = GitlabSchema.find_by_gid(discussion_gid)
if gid = args[:discussion_id]
discussion = GitlabSchema.find_by_gid(gid)
authorize_discussion!(discussion)

View File

@ -27,9 +27,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Packages::Package].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -25,9 +25,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Packages::PackageFile].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -29,10 +29,6 @@ module Mutations
end
def find_object(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ReleaseAssetLinkID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -54,10 +54,6 @@ module Mutations
end
def find_object(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ReleaseAssetLinkID.coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -28,10 +28,6 @@ module Mutations
end
def find_object(id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Users::SavedReply].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -26,8 +26,6 @@ module Mutations
end
def find_object(id:)
# TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Timelog].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -6,9 +6,6 @@ module Mutations
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Todo].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -17,8 +17,7 @@ module Mutations
description: 'To-do item created.'
def resolve(target_id:)
id = ::Types::GlobalIDType[Todoable].coerce_isolated_input(target_id)
target = authorized_find!(id)
target = authorized_find!(target_id)
todo = TodoService.new.mark_todo(target, current_user)&.first
errors = errors_on_object(todo) if todo

View File

@ -39,7 +39,7 @@ module Mutations
if args[:target_id].present?
target = Gitlab::Graphql::Lazy.force(
GitlabSchema.find_by_gid(TodoableID.coerce_isolated_input(args[:target_id]))
GitlabSchema.find_by_gid(args[:target_id])
)
raise Gitlab::Graphql::Errors::ResourceNotAvailable, "Resource not available: #{args[:target_id]}" if target.nil?

View File

@ -33,9 +33,6 @@ module Mutations
def model_ids_of(ids)
ids.map do |gid|
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
gid = ::Types::GlobalIDType[::Todo].coerce_isolated_input(gid)
gid.model_id.to_i
end.compact
end

View File

@ -53,9 +53,6 @@ module Mutations
private
def global_id_compatibility_params(params)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
params[:work_item_type_id] = ::Types::GlobalIDType[::WorkItems::Type].coerce_isolated_input(params[:work_item_type_id]) if params[:work_item_type_id]
params[:work_item_type_id] = params[:work_item_type_id]&.model_id
params

View File

@ -55,8 +55,6 @@ module Mutations
private
def find_object(id:)
# TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -38,8 +38,6 @@ module Mutations
private
def find_object(id:)
# TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -52,8 +52,6 @@ module Mutations
private
def find_object(id:)
# TODO: Remove coercion when working on https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -26,8 +26,7 @@ module Resolvers
private
def integrations_by(gid:)
id = Types::GlobalIDType[::AlertManagement::HttpIntegration].coerce_isolated_input(gid)
object = GitlabSchema.find_by_gid(id)
object = GitlabSchema.find_by_gid(gid)
defer { object }.then do |integration|
ret = integration if project == integration&.project

View File

@ -4,7 +4,6 @@ module Resolvers
class BaseResolver < GraphQL::Schema::Resolver
extend ::Gitlab::Utils::Override
include ::Gitlab::Utils::StrongMemoize
include ::Gitlab::Graphql::GlobalIDCompatibility
argument_class ::Types::BaseArgument

View File

@ -26,9 +26,6 @@ module Resolvers
def extract_board_id(id)
return unless id.present?
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = Types::GlobalIDType[Board].coerce_isolated_input(id)
id.model_id
end
end

View File

@ -3,13 +3,10 @@
module ResolvesIds
extend ActiveSupport::Concern
def resolve_ids(ids, type)
def resolve_ids(ids)
Array.wrap(ids).map do |id|
next unless id.present?
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = type.coerce_isolated_input(id)
id.model_id
end.compact
end

View File

@ -28,7 +28,7 @@ module ResolvesSnippets
def snippet_finder_params(args)
{
ids: resolve_ids(args[:ids], ::Types::GlobalIDType[::Snippet]),
ids: resolve_ids(args[:ids]),
scope: args[:visibility]
}.merge(options_by_type(args[:type]))
end

View File

@ -18,9 +18,6 @@ module Resolvers
end
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::DesignManagement::DesignAtVersion].coerce_isolated_input(id)
dav = GitlabSchema.find_by_gid(id)
return unless consistent?(dav)

View File

@ -54,10 +54,6 @@ module Resolvers
end
def parse_gid(gid)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
gid = ::Types::GlobalIDType[::DesignManagement::Design].coerce_isolated_input(gid)
gid.model_id
end
end

View File

@ -24,17 +24,17 @@ module Resolvers
end
def resolve(ids: nil, filenames: nil, at_version: nil)
# TODO: remove the coercion when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
context.scoped_set!(:at_version_argument, VersionID.coerce_isolated_input(at_version)) if at_version
::DesignManagement::DesignsFinder.new(
issue,
current_user,
ids: design_ids(ids),
filenames: filenames,
visible_at_version: version(at_version)
).execute
::Gitlab::Graphql::Lazy.with_value(version(at_version)) do |visible_at|
::DesignManagement::DesignsFinder.new(
issue,
current_user,
ids: design_ids(ids),
filenames: filenames,
visible_at_version: visible_at
).execute
end
end
private
@ -42,19 +42,12 @@ module Resolvers
def version(at_version)
return unless at_version
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
at_version = VersionID.coerce_isolated_input(at_version)
# TODO: when we get promises use this to make resolve lazy
Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(at_version))
GitlabSchema.find_by_gid(at_version)
end
def design_ids(gids)
return if gids.nil?
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
gids = gids.map { |id| DesignID.coerce_isolated_input(id) }
gids.map(&:model_id)
end

View File

@ -34,11 +34,6 @@ module Resolvers
def resolve(design_id: nil, filename: nil, design_at_version_id: nil)
validate_arguments(design_id, filename, design_at_version_id)
# TODO: remove this when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
design_id &&= DesignID.coerce_isolated_input(design_id)
design_at_version_id &&= DesignAtVersionID.coerce_isolated_input(design_at_version_id)
return unless Ability.allowed?(current_user, :read_design, issue)
return specific_design_at_version(design_at_version_id) if design_at_version_id

View File

@ -41,9 +41,6 @@ module Resolvers
def design_ids(gids)
return if gids.nil?
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
gids = gids.map { |id| DesignID.coerce_isolated_input(id) }
gids.map(&:model_id)
end

View File

@ -24,10 +24,6 @@ module Resolvers
description: "SHA256 of a specific version."
def resolve(version_id: nil, sha: nil)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
version_id &&= VersionID.coerce_isolated_input(version_id)
check_args(version_id, sha)
::DesignManagement::VersionsFinder

View File

@ -18,10 +18,6 @@ module Resolvers
end
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::DesignManagement::Version].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -25,9 +25,6 @@ module Resolvers
end
def resolve(id: nil, sha: nil)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id &&= VersionID.coerce_isolated_input(id)
version = cutoff(id, sha)
raise ::Gitlab::Graphql::Errors::ResourceNotAvailable, 'cutoff not found' unless version.present?

View File

@ -10,10 +10,6 @@ module Resolvers
description: 'ID of the Sentry issue.'
def resolve(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError].coerce_isolated_input(id)
# Get data from Sentry
response = ::ErrorTracking::IssueDetailsService.new(
project,

View File

@ -10,10 +10,6 @@ module Resolvers
description: 'ID of the Sentry issue.'
def resolve(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError].coerce_isolated_input(id)
# Get data from Sentry
response = ::ErrorTracking::IssueLatestEventService.new(
project,

View File

@ -17,9 +17,6 @@ module Resolvers
end
def resolve(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Packages::Package].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -38,11 +38,9 @@ module Resolvers
private
def snippet_finder_params(args)
# TODO: remove the type arguments when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
super
.merge(author: resolve_ids(args[:author_id], ::Types::GlobalIDType[::User]),
project: resolve_ids(args[:project_id], ::Types::GlobalIDType[::Project]),
.merge(author: resolve_ids(args[:author_id]),
project: resolve_ids(args[:project_id]),
explore: args[:explore])
end
end

View File

@ -3,7 +3,6 @@
module Resolvers
class TimelogResolver < BaseResolver
include LooksAhead
include ResolvesIds
type ::Types::TimelogType.connection_type, null: false
@ -100,14 +99,13 @@ module Resolvers
def apply_project_filter(timelogs, args)
return timelogs unless args[:project_id]
project = resolve_ids(args[:project_id], ::Types::GlobalIDType[::Project])
timelogs.in_project(project)
timelogs.in_project(args[:project_id].model_id)
end
def apply_group_filter(timelogs, args)
return timelogs unless args[:group_id]
group = Group.find_by_id(resolve_ids(args[:group_id], ::Types::GlobalIDType[::Group]))
group = Group.find_by_id(args[:group_id].model_id)
timelogs.in_group(group)
end

View File

@ -57,9 +57,6 @@ module Resolvers
end
def load_project(project_path, project_id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
project_id &&= ::Types::GlobalIDType[::Project].coerce_isolated_input(project_id)
@project = ::Gitlab::Graphql::Lazy.force(resolve_project(full_path: project_path, project_id: project_id))
end

View File

@ -20,9 +20,6 @@ module Resolvers
private
def find_object(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::WorkItem].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
end

View File

@ -15,10 +15,6 @@ module Subscriptions
end
def authorized?(issuable_id:)
# TODO: remove this check when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
raise Gitlab::Graphql::Errors::ArgumentError, 'Invalid IssuableID' unless issuable_id.is_a?(GlobalID)
issuable = force(GitlabSchema.find_by_gid(issuable_id))
unauthorized! unless issuable && Ability.allowed?(current_user, :"read_#{issuable.to_ability_name}", issuable)

View File

@ -195,7 +195,6 @@ module Types
raise ::Gitlab::Graphql::Errors::ArgumentError, 'One of id or name is required' unless id || name
if id
id = ::Types::GlobalIDType[::CommitStatus].coerce_isolated_input(id) if id
pipeline.statuses.id_in(id.model_id)
else
pipeline.statuses.by_name(name)

View File

@ -149,30 +149,22 @@ module Types
end
def issue(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::Issue].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
def merge_request(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::MergeRequest].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end
def milestone(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[Milestone].coerce_isolated_input(id)
# This field coerces its ID, and thus allows the use of ID typed values.
# This should be removed when app/graphql/queries/burndown_chart/burnup.query.graphql
# has been fixed/removed and as part of !83457
id = ::Types::GlobalIDType[Milestone].coerce_input(id, context)
GitlabSchema.find_by_gid(id)
end
def container_repository(id:)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
id = ::Types::GlobalIDType[::ContainerRepository].coerce_isolated_input(id)
GitlabSchema.find_by_gid(id)
end

View File

@ -24,10 +24,6 @@ module Types
class << self
def work_item_type_global_id(global_id)
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
global_id = ::Types::GlobalIDType[::WorkItems::Type].coerce_isolated_input(global_id)
global_id&.model_id
end
end

View File

@ -7,6 +7,8 @@ module AuthorizedProjectUpdate
end
def execute(blocking: true)
return if @project_ids.empty?
bulk_args = @project_ids.map { |id| [id] }
if blocking

View File

@ -191,18 +191,9 @@ module Groups
end
def refresh_project_authorizations
projects_to_update = Set.new
project_ids = Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder.new(@group).execute
# All projects in this hierarchy need to have their project authorizations recalculated
@group.all_projects.each_batch { |prjs| projects_to_update.merge(prjs.ids) } # rubocop: disable CodeReuse/ActiveRecord
# When a group is transferred, it also affects who gets access to the projects shared to
# the subgroups within its hierarchy, so we also schedule jobs that refresh authorizations for all such shared projects.
ProjectGroupLink.in_group(@group.self_and_descendants.select(:id)).each_batch do |project_group_links|
projects_to_update.merge(project_group_links.pluck(:project_id)) # rubocop: disable CodeReuse/ActiveRecord
end
AuthorizedProjectUpdate::ProjectAccessChangedService.new(projects_to_update.to_a).execute unless projects_to_update.empty?
AuthorizedProjectUpdate::ProjectAccessChangedService.new(project_ids).execute
end
def raise_transfer_error(message)

View File

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/358128
milestone: '15.0'
type: development
group: group::product intelligence
default_enabled: false
default_enabled: true

View File

@ -16,7 +16,7 @@
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'This introduced-in line is not formatted correctly.'
link: https://docs.gitlab.com/ee/development/documentation/styleguide/versions.html
link: https://docs.gitlab.com/ee/development/documentation/versions.html
level: error
scope: raw
raw:

View File

@ -177,7 +177,7 @@ Here is the detailed data flow:
### Limitations
- [Redis cluster is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/224171).
- [Redis Cluster is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/224171).
- You must configure [object storage for CI/CD artifacts, logs, and builds](job_artifacts.md#object-storage-settings)
before you enable the feature flag. After the flag is enabled, files cannot be written
to disk, and there is no protection against misconfiguration.

View File

@ -50,7 +50,8 @@ Example response:
"npm_max_file_size": 524288000,
"nuget_max_file_size": 524288000,
"pypi_max_file_size": 3221225472,
"terraform_module_max_file_size": 1073741824
"terraform_module_max_file_size": 1073741824,
"storage_size_limit": 15000
}
```
@ -81,6 +82,7 @@ PUT /application/plan_limits
| `nuget_max_file_size` | integer | no | Maximum NuGet package file size in bytes. |
| `pypi_max_file_size` | integer | no | Maximum PyPI package file size in bytes. |
| `terraform_module_max_file_size` | integer | no | Maximum Terraform Module package file size in bytes. |
| `storage_size_limit` | integer | no | Maximum storage size for the root namespace in megabytes. |
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/application/plan_limits?plan_name=default&conan_max_file_size=3221225472"

View File

@ -58,11 +58,9 @@ Button tags requires a `type` attribute according to the [W3C HTML specification
### Blank target
Avoid forcing links to open in a new window as this reduces the control the user has over the link.
However, it might be a good idea to use a blank target when replacing the current page with
the link makes the user lose content or progress.
Arbitrarily opening links in a new tab is not recommended, so refer to the [Pajamas guidelines on links](https://design.gitlab.com/product-foundations/interaction/#links) when considering adding `target="_blank"` to links.
Use `rel="noopener noreferrer"` whenever your links open in a new window, that is, `target="_blank"`. This prevents a security vulnerability [documented by JitBit](https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/).
When using `target="_blank"` with `a` tags, you must also add the `rel="noopener noreferrer"` attribute. This prevents a security vulnerability [documented by JitBit](https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/).
When using `gl-link`, using `target="_blank"` is sufficient as it automatically adds `rel="noopener noreferrer"` to the link.

View File

@ -93,23 +93,53 @@ sequenceDiagram
the required URL is <https://version.gitlab.com/>.
1. In case of an error, it will be reported to the Version application along with following pieces of information:
- `uuid` - GitLab instance unique identifier
- `hostname` - GitLab instance hostname
- `version` - GitLab instance current versions
- `elapsed` - Amount of time which passed since Service Ping report process started and moment of error occurrence
- `message` - Error message
- `uuid` - GitLab instance unique identifier
- `hostname` - GitLab instance hostname
- `version` - GitLab instance current versions
- `elapsed` - Amount of time which passed since Service Ping report process started and moment of error occurrence
- `message` - Error message
<pre>
<code>
{
"uuid"=>"02333324-1cd7-4c3b-a45b-a4993f05fb1d",
"hostname"=>"127.0.0.1",
"version"=>"14.7.0-pre",
"elapsed"=>0.006946,
"message"=>'PG::UndefinedColumn: ERROR: column \"non_existent_attribute\" does not exist\nLINE 1: SELECT COUNT(non_existent_attribute) FROM \"issues\" /*applica...'
}
</code>
</pre>
<pre>
<code>
{
"uuid"=>"02333324-1cd7-4c3b-a45b-a4993f05fb1d",
"hostname"=>"127.0.0.1",
"version"=>"14.7.0-pre",
"elapsed"=>0.006946,
"message"=>'PG::UndefinedColumn: ERROR: column \"non_existent_attribute\" does not exist\nLINE 1: SELECT COUNT(non_existent_attribute) FROM \"issues\" /*applica...'
}
</code>
</pre>
1. Finally, the timing metadata information that is used for diagnostic purposes is submitted to the Versions application. It consists of a list of metric identifiers and the time it took to calculate the metrics:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37911) in GitLab 15.0 [with a flag(../../user/feature_flags.md), enabled by default.
FLAG:
On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](../../administration/feature_flags.md) named `measure_service_ping_metric_collection`.
On GitLab.com, this feature is available.
```ruby
{"metadata"=>
{"metrics"=>
[{"name"=>"version", "time_elapsed"=>1.1811964213848114e-05},
{"name"=>"installation_type", "time_elapsed"=>0.00017242692410945892},
{"name"=>"license_billable_users", "time_elapsed"=>0.009520471096038818},
....
{"name"=>"counts.clusters_platforms_eks",
"time_elapsed"=>0.05638605775311589},
{"name"=>"counts.clusters_platforms_gke",
"time_elapsed"=>0.40995341585949063},
{"name"=>"counts.clusters_platforms_user",
"time_elapsed"=>0.06410990096628666},
{"name"=>"counts.clusters_management_project",
"time_elapsed"=>0.24020783510059118},
{"name"=>"counts.clusters_integrations_elastic_stack",
"time_elapsed"=>0.03484998410567641}
]
}
}
```
### On a Geo secondary site
@ -133,6 +163,25 @@ We also collect metrics specific to [Geo](../../administration/geo/index.md) sec
]
```
### Enable or disable service ping metadata reporting
Service Ping timing metadata reporting is under development but ready for production use.
It is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
can opt to disable it.
To enable it:
```ruby
Feature.enable(:measure_service_ping_metric_collection)
```
To disable it:
```ruby
Feature.disable(:measure_service_ping_metric_collection)
```
## Implementing Service Ping
See the [implement Service Ping](implement.md) guide.

View File

@ -197,7 +197,7 @@ can install it with:
sudo apt-get install -y postfix
```
Then select 'Internet Site' and press enter to confirm the hostname.
Then select 'Internet Site' and press <kbd>Enter</kbd> to confirm the hostname.
<!-- vale gitlab.Spelling = NO -->

View File

@ -326,7 +326,7 @@ To search runners' descriptions:
1. In the **Search or filter results...** field, type the description of the runner you want to
find.
1. Press Enter.
1. Press <kbd>Enter</kbd>.
You can also filter runners by status, type, and tag. To filter:

View File

@ -184,7 +184,7 @@ published to the GitLab Package Registry.
Project name (default: test):
```
1. Enter a project name or press Enter to use the directory name as project name.
1. Enter a project name or press <kbd>Enter</kbd> to use the directory name as project name.
## Authenticate to the Package Registry with Maven

View File

@ -189,7 +189,7 @@ You can filter and sort members in a project.
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Project information > Members**.
1. In the **Filter members** box, select `Membership` `=` `Inherited`.
1. Press Enter.
1. Press <kbd>Enter</kbd>.
![Project members filter inherited](img/project_members_filter_inherited_v14_4.png)
@ -198,7 +198,7 @@ You can filter and sort members in a project.
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Project information > Members**.
1. In the **Filter members** box, select `Membership` `=` `Direct`.
1. Press Enter.
1. Press <kbd>Enter</kbd>.
![Project members filter direct](img/project_members_filter_direct_v14_4.png)

View File

@ -106,7 +106,7 @@ If you do not have an existing SSH key pair, generate a new one:
ssh-keygen -t rsa -b 2048 -C "<comment>"
```
1. Press Enter. Output similar to the following is displayed:
1. Press <kbd>Enter</kbd>. Output similar to the following is displayed:
```plaintext
Generating public/private ed25519 key pair.
@ -172,7 +172,7 @@ You can update the passphrase for your SSH key:
ssh-keygen -p -f /path/to/ssh_key
```
1. At the prompts, enter the passphrase and then press Enter.
1. At the prompts, enter the passphrase and then press <kbd>Enter</kbd>.
### Upgrade your RSA key pair to a more secure format
@ -225,7 +225,7 @@ To generate ED25519_SK or ECDSA_SK SSH keys, you must use OpenSSH 8.2 or later:
from the security key by [`ssh-add -K`](https://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh-add.1#K)
or [`ssh-keygen -K`](https://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh-keygen#K).
1. Press Enter. Output similar to the following is displayed:
1. Press <kbd>Enter</kbd>. Output similar to the following is displayed:
```plaintext
Generating public/private ed25519-sk key pair.
@ -325,7 +325,7 @@ The following commands use the example hostname `gitlab.example.com`. Replace th
Warning: Permanently added 'gitlab.example.com' (ECDSA) to the list of known hosts.
```
Type `yes` and press Enter.
Type `yes` and press <kbd>Enter</kbd>.
1. Run the `ssh -T git@gitlab.example.com` command again. You should receive a _Welcome to GitLab, `@username`!_ message.

View File

@ -51,6 +51,7 @@ module API
optional :nuget_max_file_size, type: Integer, desc: 'Maximum NuGet package file size in bytes'
optional :pypi_max_file_size, type: Integer, desc: 'Maximum PyPI package file size in bytes'
optional :terraform_module_max_file_size, type: Integer, desc: 'Maximum Terraform Module package file size in bytes'
optional :storage_size_limit, type: Integer, desc: 'Maximum storage size for the root namespace in megabytes'
end
put "application/plan_limits" do
params = declared_params(include_missing: false)

View File

@ -19,6 +19,7 @@ module API
expose :nuget_max_file_size
expose :pypi_max_file_size
expose :terraform_module_max_file_size
expose :storage_size_limit
end
end
end

View File

@ -0,0 +1,59 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::ProjectsRequiringAuthorizationsRefresh::OnTransferFinder do
# rubocop:disable Layout/LineLength
# Group X Group A ------shared with-------------> Group B Group C
# | Group X_subgroup_1 | | |
# | | Project X_subgroup_1 ---shared with----->| Group A_subgroup_1 | Group B_subgroup_1 <--shared with--------- | Group C_subgroup_1
# | | | Project A_subgroup_1 | | Project B_subgroup_1 | | Project C_subgroup_1
# | Group A_subgroup_2 | Group B_subgroup_2 <----shared with ------- Project C
# | |Project A_subgroup_2 | | Project B_subgroup_2
# rubocop:enable Layout/LineLength
let_it_be(:group_x) { create(:group) }
let_it_be(:group_a) { create(:group) }
let_it_be(:group_b) { create(:group) }
let_it_be(:group_c) { create(:group) }
let_it_be(:group_x_subgroup_1) { create(:group, parent: group_x) }
let_it_be(:group_a_subgroup_1) { create(:group, parent: group_a) }
let_it_be(:group_a_subgroup_2) { create(:group, parent: group_a) }
let_it_be(:group_b_subgroup_1) { create(:group, parent: group_b) }
let_it_be(:group_b_subgroup_2) { create(:group, parent: group_b) }
let_it_be(:group_c_subgroup_1) { create(:group, parent: group_c) }
let_it_be(:project_x_subgroup_1) { create(:project, group: group_x_subgroup_1, name: 'project_x_subgroup_1') }
let_it_be(:project_a_subgroup_1) { create(:project, group: group_a_subgroup_1, name: 'project_a_subgroup_1') }
let_it_be(:project_a_subgroup_2) { create(:project, group: group_a_subgroup_2, name: 'project_a_subgroup_2') }
let_it_be(:project_b_subgroup_1) { create(:project, group: group_b_subgroup_1, name: 'project_b_subgroup_1') }
let_it_be(:project_b_subgroup_2) { create(:project, group: group_b_subgroup_2, name: 'project_b_subgroup_2') }
let_it_be(:project_c_subgroup_1) { create(:project, group: group_c_subgroup_1, name: 'project_c_subgroup_1') }
let_it_be(:project_c) { create(:project, group: group_c, name: 'project_c') }
describe '#execute' do
context 'projects requiring authorizations refresh when a group is transferred (here, `Group B`)' do
subject(:result) { described_class.new(group_b).execute }
before do
create(:project_group_link, project: project_x_subgroup_1, group: group_a_subgroup_1)
create(:project_group_link, project: project_c, group: group_b_subgroup_2)
create(:group_group_link, shared_group: group_a, shared_with_group: group_b)
create(:group_group_link, shared_group: group_c_subgroup_1, shared_with_group: group_b_subgroup_1)
end
it 'includes only the expected projects' do
expected_projects = Project.id_in(
[
project_b_subgroup_1,
project_b_subgroup_2,
project_c
]
)
expect(result).to match_array(expected_projects.ids)
end
end
end
end

View File

@ -29,14 +29,6 @@ RSpec.describe Mutations::Boards::Update do
end
end
context 'with invalid params' do
it 'raises an error' do
mutation_params[:id] = project.to_global_id
expect { subject }.to raise_error(::GraphQL::CoercionError)
end
end
context 'when user can update board' do
before do
board.resource_parent.add_reporter(user)

View File

@ -44,14 +44,6 @@ RSpec.describe Mutations::Ci::Runner::Delete do
end
end
context 'with invalid params' do
let(:mutation_params) { { id: "invalid-id" } }
it 'raises an error' do
expect { subject }.to raise_error(::GraphQL::CoercionError)
end
end
context 'when required arguments are missing' do
let(:mutation_params) { {} }

View File

@ -33,14 +33,6 @@ RSpec.describe Mutations::Ci::Runner::Update do
end
end
context 'with invalid params' do
it 'raises an error' do
mutation_params[:id] = "invalid-id"
expect { subject }.to raise_error(::GraphQL::CoercionError)
end
end
context 'when required arguments are missing' do
let(:mutation_params) { {} }

View File

@ -48,14 +48,6 @@ RSpec.describe Mutations::Clusters::AgentTokens::Create do
expect(token.description).to eq(description)
expect(token.name).to eq(name)
end
context 'invalid params' do
subject { mutation.resolve(cluster_agent_id: cluster_agent.id) }
it 'generates an error message when id invalid', :aggregate_failures do
expect { subject }.to raise_error(::GraphQL::CoercionError)
end
end
end
end
end

View File

@ -40,16 +40,6 @@ RSpec.describe Mutations::Clusters::AgentTokens::Revoke do
expect(token.reload).to be_revoked
end
context 'supplied ID is invalid' do
let(:global_id) { token.id }
it 'raises a coercion error' do
expect { subject }.to raise_error(::GraphQL::CoercionError)
expect(token.reload).not_to be_revoked
end
end
end
end
end

View File

@ -38,14 +38,5 @@ RSpec.describe Mutations::Clusters::Agents::Delete do
expect { cluster_agent.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
context 'with invalid params' do
subject { mutation.resolve(id: cluster_agent.id) }
it 'raises an error if the cluster agent id is invalid', :aggregate_failures do
expect { subject }.to raise_error(::GraphQL::CoercionError)
expect { cluster_agent.reload }.not_to raise_error
end
end
end
end

View File

@ -57,11 +57,5 @@ RSpec.describe Mutations::ContainerRepositories::Destroy do
it_behaves_like params[:shared_examples_name]
end
end
context 'with invalid id' do
let(:id) { 'gid://gitlab/ContainerRepository/5555' }
it_behaves_like 'denying access to container respository'
end
end
end

View File

@ -48,17 +48,6 @@ RSpec.describe Mutations::Discussions::ToggleResolve do
end
end
context 'when discussion is not a Discussion' do
let(:discussion) { create(:note, noteable: noteable, project: project) }
it 'raises an error' do
expect { subject }.to raise_error(
GraphQL::CoercionError,
"\"#{global_id_of(discussion)}\" does not represent an instance of Discussion"
)
end
end
shared_examples 'returns a resolved discussion without errors' do
it 'returns a resolved discussion' do
expect(mutated_discussion).to be_resolved

View File

@ -62,14 +62,6 @@ RSpec.describe Mutations::Environments::CanaryIngress::Update do
end
end
context 'when environment is not found' do
let(:environment_id) { non_existing_record_id.to_s }
it 'raises an error' do
expect { subject }.to raise_error(GraphQL::CoercionError)
end
end
context 'when user is reporter who does not have permission to access the environment' do
let(:user) { reporter }

View File

@ -60,14 +60,6 @@ RSpec.describe Mutations::ReleaseAssetLinks::Delete do
expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
end
end
context "when the provided ID is invalid" do
let(:mutation_arguments) { super().merge(id: 'not-a-valid-gid') }
it 'raises an error' do
expect { subject }.to raise_error(::GraphQL::CoercionError)
end
end
end
context 'when the current user does not have access to delete the link' do

View File

@ -194,13 +194,5 @@ RSpec.describe Mutations::ReleaseAssetLinks::Update do
expect { subject }.to raise_error(Gitlab::Graphql::Errors::ResourceNotAvailable)
end
end
context "when the provided ID is invalid" do
let(:mutation_arguments) { super().merge(id: 'not-a-valid-gid') }
it 'raises an error' do
expect { subject }.to raise_error(::GraphQL::CoercionError)
end
end
end
end

View File

@ -10,12 +10,19 @@ RSpec.describe Mutations::Todos::Create do
context 'when target does not support todos' do
it 'raises error' do
current_user = create(:user)
mutation = described_class.new(object: nil, context: { current_user: current_user }, field: nil)
target = create(:milestone)
expect { mutation.resolve(target_id: global_id_of(target)) }
.to raise_error(GraphQL::CoercionError)
ctx = { current_user: current_user }
input = { target_id: global_id_of(target).to_s }
mutation = graphql_mutation(described_class, input)
response = GitlabSchema.execute(mutation.query, context: ctx, variables: mutation.variables).to_h
expect(response).to include(
'errors' => contain_exactly(
include('message' => /invalid value for targetId/)
)
)
end
end

View File

@ -56,15 +56,6 @@ RSpec.describe Mutations::Todos::MarkDone do
expect(todo2.reload.state).to eq('done')
expect(other_user_todo.reload.state).to eq('pending')
end
it 'ignores invalid GIDs' do
expect { mutation.resolve(id: author.to_global_id.to_s) }
.to raise_error(::GraphQL::CoercionError)
expect(todo1.reload.state).to eq('pending')
expect(todo2.reload.state).to eq('done')
expect(other_user_todo.reload.state).to eq('pending')
end
end
def mark_done_mutation(todo)

View File

@ -49,13 +49,6 @@ RSpec.describe Mutations::Todos::RestoreMany do
expect_states_were_not_changed
end
it 'raises an error with invalid or non-Todo GIDs' do
expect { mutation.resolve(ids: [author.to_global_id.to_s]) }
.to raise_error(GraphQL::CoercionError)
expect_states_were_not_changed
end
it 'restores multiple todos' do
todo4 = create(:todo, user: current_user, author: author, state: :done)

View File

@ -56,15 +56,6 @@ RSpec.describe Mutations::Todos::Restore do
expect(todo2.reload.state).to eq('pending')
expect(other_user_todo.reload.state).to eq('done')
end
it 'raises error for invalid GID' do
expect { mutation.resolve(id: author.to_global_id.to_s) }
.to raise_error(::GraphQL::CoercionError)
expect(todo1.reload.state).to eq('done')
expect(todo2.reload.state).to eq('pending')
expect(other_user_todo.reload.state).to eq('done')
end
end
def restore_mutation(todo)

View File

@ -10,7 +10,6 @@ RSpec.describe ResolvesIds do
# gid://gitlab/Project/6 gid://gitlab/Issue/6
context 'with a single project' do
let(:ids) { global_id_of(model_name: 'Project', id: 6) }
let(:type) { ::Types::GlobalIDType[::Project] }
it 'returns the correct array' do
expect(resolve_ids).to contain_exactly('6')
@ -19,7 +18,6 @@ RSpec.describe ResolvesIds do
context 'with a single issue' do
let(:ids) { global_id_of(model_name: 'Issue', id: 9) }
let(:type) { ::Types::GlobalIDType[::Issue] }
it 'returns the correct array' do
expect(resolve_ids).to contain_exactly('9')
@ -28,7 +26,6 @@ RSpec.describe ResolvesIds do
context 'with multiple users' do
let(:ids) { [7, 13, 21].map { global_id_of(model_name: 'User', id: _1) } }
let(:type) { ::Types::GlobalIDType[::User] }
it 'returns the correct array' do
expect(resolve_ids).to eq %w[7 13 21]
@ -40,6 +37,6 @@ RSpec.describe ResolvesIds do
end
def resolve_ids
mock_resolver.resolve_ids(ids, type)
mock_resolver.resolve_ids(ids)
end
end

View File

@ -71,15 +71,6 @@ RSpec.describe Resolvers::DesignManagement::DesignResolver do
expect(resolve_design).to be_nil
end
end
context 'the ID does not belong to a design at all' do
let(:args) { { id: global_id_of(issue) } }
let(:msg) { /does not represent an instance of DesignManagement::Design/ }
it 'complains meaningfully' do
expect { resolve_design }.to raise_error(msg)
end
end
end
context 'by filename' do

View File

@ -50,15 +50,6 @@ RSpec.describe Resolvers::DesignManagement::VersionInCollectionResolver do
it { is_expected.to be_nil }
end
context 'we pass the id of something that is not a design_version' do
let(:params) { { id: global_id_of(project) } }
let(:appropriate_error) { ::GraphQL::CoercionError }
it 'raises an appropriate error' do
expect { result }.to raise_error(appropriate_error)
end
end
end
def resolve_version(obj, context = { current_user: current_user })

View File

@ -57,14 +57,6 @@ RSpec.describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do
expect(result).to be_nil
end
end
context 'with blank id' do
let(:args) { { id: '' } }
it 'responds with an error' do
expect { resolve_error(args) }.to raise_error(::GraphQL::CoercionError)
end
end
end
private

View File

@ -11,7 +11,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do
let(:user) { package.project.first_owner }
describe '#resolve' do
let(:returned_pipeline_ids) { graphql_dig_at(subject, 'data', 'package', 'pipelines', 'nodes', 'id') }
let(:returned_pipelines) { graphql_dig_at(subject, 'data', 'package', 'pipelines', 'nodes') }
let(:returned_errors) { graphql_dig_at(subject, 'errors', 'message') }
let(:pagination_args) { {} }
let(:query) do
@ -90,7 +90,7 @@ RSpec.describe Resolvers::PackagePipelinesResolver do
let_it_be(:user) { create(:user) }
it 'returns nothing' do
expect(returned_pipeline_ids).to eq(nil)
expect(returned_pipelines).to be_nil
end
end
@ -98,8 +98,8 @@ RSpec.describe Resolvers::PackagePipelinesResolver do
let_it_be_with_reload(:other_package) { create(:package, project: package.project) }
let_it_be(:other_pipelines) { create_list(:ci_pipeline, 3, project: package.project) }
let(:returned_pipeline_ids) do
graphql_dig_at(subject, 'data', 'project', 'packages', 'nodes', 'pipelines', 'nodes', 'id')
let(:returned_pipelines) do
graphql_dig_at(subject, 'data', 'project', 'packages', 'nodes', 'pipelines', 'nodes')
end
let(:query) do
@ -175,8 +175,8 @@ RSpec.describe Resolvers::PackagePipelinesResolver do
end
def expect_to_contain_exactly(*pipelines)
ids = pipelines.map { |pipeline| global_id_of(pipeline) }
expect(returned_pipeline_ids).to contain_exactly(*ids)
entities = pipelines.map { |pipeline| a_graphql_entity_for(pipeline) }
expect(returned_pipelines).to match_array(entities)
end
def expect_detect_mode(modes)

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