From f805496e2f458cc234ac5e52d09fa6d787ccaa97 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 4 Aug 2022 15:11:28 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop.yml | 4 + .rubocop_todo/capybara/visibility_matcher.yml | 21 ++- .../first_array_element_indentation.yml | 62 +++++++-- .../layout/first_hash_element_indentation.yml | 126 +++++++++++++++--- .../multiline_operation_indentation.yml | 34 +++-- .../layout/space_inside_block_braces.yml | 38 ++++-- .rubocop_todo/rails/rake_environment.yml | 25 ---- GITALY_SERVER_VERSION | 2 +- .../components/work_item_links/index.js | 6 +- .../work_item_links/work_item_links.vue | 112 +++++++++++++++- .../work_item_links/work_item_links_menu.vue | 81 +---------- .../graphql/work_item_links.query.graphql | 1 + app/views/profiles/preferences/show.html.haml | 2 +- .../issues/_work_item_links.html.haml | 2 +- ...eaming_git_operations_deploy_key_event.yml | 8 -- doc/administration/audit_event_streaming.md | 2 +- .../operations/ssh_certificates.md | 3 +- .../reference_architectures/index.md | 14 +- doc/ci/docker/using_kaniko.md | 7 + .../database/batched_background_migrations.md | 36 ++++- .../documentation/site_architecture/index.md | 2 +- doc/development/fe_guide/style/vue.md | 16 +-- doc/development/fe_guide/vue.md | 10 +- doc/development/github_importer.md | 2 +- .../specification_guide/index.md | 2 +- doc/development/integrations/index.md | 2 +- doc/development/integrations/secure.md | 2 +- .../merge_request_concepts/index.md | 2 +- doc/development/secure_coding_guidelines.md | 2 +- doc/development/service_ping/implement.md | 6 +- doc/development/shell_commands.md | 2 +- doc/development/snowplow/implementation.md | 2 +- .../dashboards/stage_group_dashboard.md | 2 +- .../testing_guide/end_to_end/index.md | 2 +- .../testing_guide/frontend_testing.md | 2 +- doc/development/testing_guide/review_apps.md | 2 +- .../testing_guide/testing_levels.md | 4 +- doc/development/workhorse/configuration.md | 6 +- doc/development/workhorse/gitlab_features.md | 2 +- doc/development/workhorse/index.md | 4 +- doc/install/installation.md | 2 +- doc/integration/saml.md | 2 - doc/integration/security_partners/index.md | 2 +- doc/topics/autodevops/index.md | 5 +- .../application_security/dast/checks/601.1.md | 2 +- doc/user/project/quick_actions.md | 1 + .../backfill_group_features.rb | 8 +- .../batched_migration_job.rb | 22 ++- ...y_column_using_background_migration_job.rb | 4 +- .../batched_migration_wrapper.rb | 3 +- .../work_item_links_menu_spec.js | 123 +---------------- .../work_item_links/work_item_links_spec.js | 110 ++++++++++++++- spec/frontend/work_items/mock_data.js | 3 + .../backfill_group_features_spec.rb | 3 +- .../batched_migration_job_spec.rb | 33 +++++ ...umn_using_background_migration_job_spec.rb | 58 +++++--- .../batched_migration_wrapper_spec.rb | 16 ++- ...ground_migration_worker_shared_examples.rb | 4 +- 58 files changed, 658 insertions(+), 403 deletions(-) delete mode 100644 .rubocop_todo/rails/rake_environment.yml delete mode 100644 config/feature_flags/development/audit_event_streaming_git_operations_deploy_key_event.yml diff --git a/.rubocop.yml b/.rubocop.yml index baac21de331..a348e799d89 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -290,6 +290,10 @@ Rails/MailerName: # See for the context on why it's excluded https://gitlab.com/gitlab-org/gitlab/-/issues/239356#note_956419227 - 'app/mailers/notify.rb' +Rails/RakeEnvironment: + # Context on why it's disabled: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93419#note_1048223982 + Enabled: false + # GitLab ################################################################### Gitlab/ModuleWithInstanceVariables: diff --git a/.rubocop_todo/capybara/visibility_matcher.yml b/.rubocop_todo/capybara/visibility_matcher.yml index 90d71fe2d3a..e236be2593e 100644 --- a/.rubocop_todo/capybara/visibility_matcher.yml +++ b/.rubocop_todo/capybara/visibility_matcher.yml @@ -1,24 +1,23 @@ --- Capybara/VisibilityMatcher: - # Offense count: 213 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - - 'ee/spec/features/billings/billing_plans_spec.rb' - 'ee/spec/features/boards/sidebar_spec.rb' - 'ee/spec/features/epics/epic_show_spec.rb' - 'ee/spec/features/epics/todo_spec.rb' + - 'ee/spec/features/epics/update_epic_spec.rb' - 'ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb' - 'ee/spec/features/groups/issues_spec.rb' - 'ee/spec/features/groups/saml_enforcement_spec.rb' + - 'ee/spec/features/groups/settings/protected_environments_spec.rb' - 'ee/spec/features/issues/related_issues_spec.rb' - 'ee/spec/features/projects/integrations/user_activates_jira_spec.rb' - - 'ee/spec/features/projects/path_locks_spec.rb' - 'ee/spec/features/projects/quality/test_case_show_spec.rb' - 'ee/spec/features/projects/requirements_management/requirements_list_spec.rb' - 'ee/spec/features/projects/settings/ee/repository_mirrors_settings_spec.rb' - 'ee/spec/features/promotion_spec.rb' - 'ee/spec/features/registrations/welcome_spec.rb' + - 'ee/spec/support/helpers/billing_plans_helpers.rb' + - 'ee/spec/support/shared_examples/features/password_complexity_shared_examples.rb' - 'ee/spec/support/shared_examples/views/issuable_bulk_dropdown_shared_examples.rb' - 'ee/spec/views/layouts/_search.html.haml_spec.rb' - 'ee/spec/views/registrations/welcome/show.html.haml_spec.rb' @@ -26,13 +25,6 @@ Capybara/VisibilityMatcher: - 'spec/features/dashboard/merge_requests_spec.rb' - 'spec/features/dashboard/todos/todos_spec.rb' - 'spec/features/groups/group_settings_spec.rb' - - 'spec/features/issues/filtered_search/dropdown_assignee_spec.rb' - - 'spec/features/issues/filtered_search/dropdown_author_spec.rb' - - 'spec/features/issues/filtered_search/dropdown_emoji_spec.rb' - - 'spec/features/issues/filtered_search/dropdown_hint_spec.rb' - - 'spec/features/issues/filtered_search/recent_searches_spec.rb' - - 'spec/features/issues/filtered_search/search_bar_spec.rb' - - 'spec/features/issues/filtered_search/visual_tokens_spec.rb' - 'spec/features/issues/service_desk_spec.rb' - 'spec/features/issues/todo_spec.rb' - 'spec/features/issues/user_creates_branch_and_merge_request_spec.rb' @@ -48,17 +40,19 @@ Capybara/VisibilityMatcher: - 'spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb' - 'spec/features/projects/ci/lint_spec.rb' - 'spec/features/projects/commit/comments/user_adds_comment_spec.rb' + - 'spec/features/projects/commits/multi_view_diff_spec.rb' - 'spec/features/projects/commits/user_browses_commits_spec.rb' - 'spec/features/projects/integrations/user_activates_jira_spec.rb' - 'spec/features/projects/issues/design_management/user_views_designs_with_svg_xss_spec.rb' - 'spec/features/projects/jobs_spec.rb' - 'spec/features/projects/network_graph_spec.rb' + - 'spec/features/projects/pipelines/legacy_pipeline_spec.rb' - 'spec/features/projects/pipelines/pipeline_spec.rb' - 'spec/features/projects/settings/lfs_settings_spec.rb' - 'spec/features/projects/settings/packages_settings_spec.rb' + - 'spec/features/projects/settings/repository_settings_spec.rb' - 'spec/features/projects/settings/visibility_settings_spec.rb' - 'spec/features/projects/show/user_manages_notifications_spec.rb' - - 'spec/features/projects/tags/user_edits_tags_spec.rb' - 'spec/features/projects/user_changes_project_visibility_spec.rb' - 'spec/features/projects/user_sees_user_popover_spec.rb' - 'spec/features/search/user_searches_for_commits_spec.rb' @@ -66,6 +60,7 @@ Capybara/VisibilityMatcher: - 'spec/features/task_lists_spec.rb' - 'spec/features/u2f_spec.rb' - 'spec/features/uploads/user_uploads_file_to_note_spec.rb' + - 'spec/features/users/email_verification_on_login_spec.rb' - 'spec/features/users/overview_spec.rb' - 'spec/features/users/user_browses_projects_on_user_page_spec.rb' - 'spec/features/webauthn_spec.rb' diff --git a/.rubocop_todo/layout/first_array_element_indentation.yml b/.rubocop_todo/layout/first_array_element_indentation.yml index e3bbf9dc25a..84e367e0514 100644 --- a/.rubocop_todo/layout/first_array_element_indentation.yml +++ b/.rubocop_todo/layout/first_array_element_indentation.yml @@ -1,9 +1,6 @@ --- # Cop supports --auto-correct. Layout/FirstArrayElementIndentation: - # Offense count: 1133 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/controllers/abuse_reports_controller.rb' - 'app/controllers/admin/application_settings_controller.rb' @@ -22,10 +19,12 @@ Layout/FirstArrayElementIndentation: - 'app/helpers/search_helper.rb' - 'app/models/ci/job_token/scope.rb' - 'app/models/container_repository.rb' + - 'app/models/customer_relations/contact.rb' + - 'app/models/customer_relations/organization.rb' - 'app/models/group.rb' - 'app/models/integration.rb' - - 'app/models/integrations/bamboo.rb' - 'app/models/internal_id.rb' + - 'app/models/issue.rb' - 'app/models/member.rb' - 'app/models/merge_request.rb' - 'app/models/namespace.rb' @@ -40,6 +39,7 @@ Layout/FirstArrayElementIndentation: - 'app/workers/ssh_keys/expired_notification_worker.rb' - 'config/initializers/postgres_partitioning.rb' - 'db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb' + - 'ee/app/controllers/groups/settings/reporting_controller.rb' - 'ee/app/controllers/projects/vulnerability_feedback_controller.rb' - 'ee/app/finders/autocomplete/project_invited_groups_finder.rb' - 'ee/app/finders/geo/project_registry_finder.rb' @@ -47,14 +47,19 @@ Layout/FirstArrayElementIndentation: - 'ee/app/graphql/mutations/vulnerabilities/create.rb' - 'ee/app/helpers/ee/application_settings_helper.rb' - 'ee/app/helpers/ee/trial_helper.rb' + - 'ee/app/models/analytics/devops_adoption/enabled_namespace.rb' - 'ee/app/models/ee/epic.rb' + - 'ee/app/models/ee/project.rb' - 'ee/app/models/ee/user.rb' + - 'ee/app/models/ee/vulnerability.rb' - 'ee/app/models/protected_environment.rb' + - 'ee/app/models/vulnerabilities/read.rb' - 'ee/app/serializers/dashboard_environments_serializer.rb' - 'ee/app/services/app_sec/dast/profiles/update_service.rb' - 'ee/app/services/vulnerabilities/create_service_base.rb' - 'ee/lib/ee/api/helpers/award_emoji.rb' - 'ee/lib/ee/gitlab/geo_git_access.rb' + - 'ee/lib/gitlab/contribution_analytics/data_collector.rb' - 'ee/lib/gitlab/elastic/helper.rb' - 'ee/lib/gitlab/sitemaps/url_extractor.rb' - 'ee/lib/tasks/gitlab/seed/metrics.rake' @@ -65,14 +70,17 @@ Layout/FirstArrayElementIndentation: - 'ee/spec/controllers/projects/merge_requests_controller_spec.rb' - 'ee/spec/features/admin/admin_dev_ops_reports_spec.rb' - 'ee/spec/features/boards/boards_licensed_features_spec.rb' + - 'ee/spec/features/groups/analytics/cycle_analytics/charts_spec.rb' - 'ee/spec/features/groups/group_roadmap_spec.rb' - 'ee/spec/finders/billed_users_finder_spec.rb' - 'ee/spec/finders/merge_requests/by_approvers_finder_spec.rb' - 'ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb' + - 'ee/spec/finders/security/scan_execution_policies_finder_spec.rb' - 'ee/spec/frontend/fixtures/dast_profiles.rb' - 'ee/spec/frontend/fixtures/search.rb' - 'ee/spec/graphql/mutations/incident_management/escalation_policy/create_spec.rb' - 'ee/spec/graphql/resolvers/dora_metrics_resolver_spec.rb' + - 'ee/spec/graphql/resolvers/security_orchestration/scan_execution_policy_resolver_spec.rb' - 'ee/spec/graphql/resolvers/timebox_report_resolver_spec.rb' - 'ee/spec/graphql/types/ci/pipeline_type_spec.rb' - 'ee/spec/graphql/types/dast_scanner_profile_type_spec.rb' @@ -89,6 +97,7 @@ Layout/FirstArrayElementIndentation: - 'ee/spec/lib/gitlab/ci/templates/Jobs/load_performance_testing_gitlab_ci_yaml_spec.rb' - 'ee/spec/lib/gitlab/ci/yaml_processor_spec.rb' - 'ee/spec/lib/gitlab/graphql/aggregations/epics/epic_node_spec.rb' + - 'ee/spec/lib/gitlab/graphql/aggregations/epics/lazy_links_aggregate_spec.rb' - 'ee/spec/lib/gitlab/graphql/aggregations/issues/lazy_links_aggregate_spec.rb' - 'ee/spec/lib/gitlab/graphql/loaders/bulk_epic_aggregate_loader_spec.rb' - 'ee/spec/lib/gitlab/usage/metrics/instrumentations/count_ci_builds_metric_spec.rb' @@ -104,6 +113,7 @@ Layout/FirstArrayElementIndentation: - 'ee/spec/models/ee/namespace_spec.rb' - 'ee/spec/models/ee/release_spec.rb' - 'ee/spec/models/group_wiki_repository_spec.rb' + - 'ee/spec/models/namespace_setting_spec.rb' - 'ee/spec/models/project_spec.rb' - 'ee/spec/models/requirements_management/test_report_spec.rb' - 'ee/spec/models/security/orchestration_policy_configuration_spec.rb' @@ -123,6 +133,7 @@ Layout/FirstArrayElementIndentation: - 'ee/spec/requests/api/graphql/project/alert_management/payload_fields_spec.rb' - 'ee/spec/requests/api/graphql/project/incident_management/escalation_policy/rules_spec.rb' - 'ee/spec/requests/api/graphql/project/merge_requests_spec.rb' + - 'ee/spec/requests/api/internal/kubernetes_spec.rb' - 'ee/spec/requests/api/ldap_group_links_spec.rb' - 'ee/spec/requests/api/members_spec.rb' - 'ee/spec/services/analytics/cycle_analytics/value_streams/update_service_spec.rb' @@ -130,16 +141,16 @@ Layout/FirstArrayElementIndentation: - 'ee/spec/services/gitlab_subscriptions/fetch_purchase_eligible_namespaces_service_spec.rb' - 'ee/spec/services/groups/seat_usage_export_service_spec.rb' - 'ee/spec/services/iterations/cadences/create_iterations_in_advance_service_spec.rb' - - 'ee/spec/services/iterations/cadences/create_service_spec.rb' - 'ee/spec/services/protected_environments/base_service_spec.rb' - 'ee/spec/services/search_service_spec.rb' + - 'ee/spec/services/security/ingestion/tasks/hooks_execution_spec.rb' - 'ee/spec/services/security/security_orchestration_policies/process_scan_result_policy_service_spec.rb' - 'ee/spec/services/security/store_findings_metadata_service_spec.rb' - 'ee/spec/services/timebox_report_service_spec.rb' - 'ee/spec/services/user_permissions/export_service_spec.rb' - 'ee/spec/support/shared_examples/services/search_notes_shared_examples.rb' - 'ee/spec/workers/geo/scheduler/scheduler_worker_spec.rb' - - 'lib/gitlab/background_migration/fix_merge_request_diff_commit_users.rb' + - 'lib/event_filter.rb' - 'lib/gitlab/database/migration_helpers.rb' - 'lib/gitlab/email/message/in_product_marketing/team.rb' - 'lib/gitlab/email/message/in_product_marketing/trial.rb' @@ -153,25 +164,27 @@ Layout/FirstArrayElementIndentation: - 'lib/gitlab/usage_data.rb' - 'lib/system_check/app/authorized_keys_permission_check.rb' - 'qa/qa/resource/protected_branch.rb' + - 'qa/qa/specs/features/api/1_manage/group_access_token_spec.rb' - 'qa/qa/specs/features/api/1_manage/project_access_token_spec.rb' - 'qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb' + - 'qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb' - 'qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb' + - 'qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb' - 'qa/qa/specs/features/api/3_create/gitaly/gitaly_mtls_spec.rb' - 'qa/qa/specs/features/api/3_create/gitaly/praefect_dataloss_spec.rb' + - 'qa/qa/specs/features/api/3_create/repository/commit_to_templated_project_spec.rb' + - 'qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb' - 'qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb' - - 'qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_group_level_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb' - - 'qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb' - - 'qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb' - 'qa/qa/specs/features/ee/api/1_manage/user/minimal_access_user_spec.rb' @@ -189,12 +202,14 @@ Layout/FirstArrayElementIndentation: - 'spec/controllers/projects/pipelines_controller_spec.rb' - 'spec/deprecation_toolkit_env.rb' - 'spec/features/clusters/create_agent_spec.rb' - - 'spec/features/issues/filtered_search/filter_issues_spec.rb' - - 'spec/features/issues/filtered_search/visual_tokens_spec.rb' + - 'spec/finders/bulk_imports/entities_finder_spec.rb' - 'spec/finders/ci/daily_build_group_report_results_finder_spec.rb' - 'spec/finders/deploy_tokens/tokens_finder_spec.rb' + - 'spec/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder_spec.rb' + - 'spec/finders/groups/projects_requiring_authorizations_refresh/on_transfer_finder_spec.rb' - 'spec/frontend/fixtures/search.rb' - 'spec/graphql/mutations/commits/create_spec.rb' + - 'spec/graphql/mutations/environments/canary_ingress/update_spec.rb' - 'spec/graphql/resolvers/ci/test_suite_resolver_spec.rb' - 'spec/graphql/types/ci/runner_architecture_type_spec.rb' - 'spec/graphql/types/ci/runner_platform_type_spec.rb' @@ -217,8 +232,10 @@ Layout/FirstArrayElementIndentation: - 'spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb' - 'spec/lib/gitlab/ci/ansi2json_spec.rb' - 'spec/lib/gitlab/ci/config/entry/product/parallel_spec.rb' - - 'spec/lib/gitlab/ci/config/entry/root_spec.rb' + - 'spec/lib/gitlab/ci/config/external/file/artifact_spec.rb' + - 'spec/lib/gitlab/ci/config/external/file/project_spec.rb' - 'spec/lib/gitlab/ci/config/external/mapper_spec.rb' + - 'spec/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator_spec.rb' - 'spec/lib/gitlab/ci/parsers/security/common_spec.rb' - 'spec/lib/gitlab/ci/reports/codequality_reports_comparer_spec.rb' - 'spec/lib/gitlab/ci/reports/codequality_reports_spec.rb' @@ -241,9 +258,13 @@ Layout/FirstArrayElementIndentation: - 'spec/lib/gitlab/diff/char_diff_spec.rb' - 'spec/lib/gitlab/diff/file_collection_sorter_spec.rb' - 'spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb' + - 'spec/lib/gitlab/git/repository_spec.rb' - 'spec/lib/gitlab/gitaly_client/blob_service_spec.rb' + - 'spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/issues_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb' + - 'spec/lib/gitlab/github_import/importer/notes_importer_spec.rb' - 'spec/lib/gitlab/github_import/parallel_scheduling_spec.rb' - - 'spec/lib/gitlab/gitlab_import/importer_spec.rb' - 'spec/lib/gitlab/grape_logging/formatters/lograge_with_timestamp_spec.rb' - 'spec/lib/gitlab/hook_data/release_builder_spec.rb' - 'spec/lib/gitlab/import_export/group/tree_restorer_spec.rb' @@ -263,13 +284,16 @@ Layout/FirstArrayElementIndentation: - 'spec/lib/gitlab/search/abuse_detection_spec.rb' - 'spec/lib/gitlab/search/found_blob_spec.rb' - 'spec/lib/gitlab/serializer/ci/variables_spec.rb' + - 'spec/lib/gitlab/sidekiq_config_spec.rb' - 'spec/lib/gitlab/ssh_public_key_spec.rb' - 'spec/lib/gitlab/usage_data/topology_spec.rb' - 'spec/lib/gitlab/usage_data_spec.rb' - 'spec/lib/gitlab/utils_spec.rb' - 'spec/lib/gitlab/webpack/manifest_spec.rb' + - 'spec/lib/google_api/cloud_platform/client_spec.rb' - 'spec/lib/peek/views/bullet_detailed_spec.rb' - 'spec/lib/system_check/incoming_email_check_spec.rb' + - 'spec/lib/unnested_in_filters/rewriter_spec.rb' - 'spec/migrations/add_premium_and_ultimate_plan_limits_spec.rb' - 'spec/migrations/backfill_escalation_policies_for_oncall_schedules_spec.rb' - 'spec/migrations/slice_merge_request_diff_commit_migrations_spec.rb' @@ -279,6 +303,7 @@ Layout/FirstArrayElementIndentation: - 'spec/models/ci/build_trace_spec.rb' - 'spec/models/ci/daily_build_group_report_result_spec.rb' - 'spec/models/ci/pipeline_spec.rb' + - 'spec/models/ci/runner_version_spec.rb' - 'spec/models/ci/unit_test_spec.rb' - 'spec/models/clusters/applications/cert_manager_spec.rb' - 'spec/models/clusters/platforms/kubernetes_spec.rb' @@ -293,6 +318,7 @@ Layout/FirstArrayElementIndentation: - 'spec/models/integration_spec.rb' - 'spec/models/integrations/chat_message/issue_message_spec.rb' - 'spec/models/integrations/chat_message/wiki_page_message_spec.rb' + - 'spec/models/integrations/jira_spec.rb' - 'spec/models/label_note_spec.rb' - 'spec/models/merge_request/cleanup_schedule_spec.rb' - 'spec/models/merge_request_diff_spec.rb' @@ -300,6 +326,8 @@ Layout/FirstArrayElementIndentation: - 'spec/models/operations/feature_flags/strategy_spec.rb' - 'spec/models/project_group_link_spec.rb' - 'spec/models/repository_spec.rb' + - 'spec/models/user_preference_spec.rb' + - 'spec/models/user_spec.rb' - 'spec/models/wiki_directory_spec.rb' - 'spec/policies/concerns/crud_policy_helpers_spec.rb' - 'spec/presenters/ci/build_runner_presenter_spec.rb' @@ -309,24 +337,30 @@ Layout/FirstArrayElementIndentation: - 'spec/requests/api/deploy_tokens_spec.rb' - 'spec/requests/api/graphql/ci/config_spec.rb' - 'spec/requests/api/graphql/ci/jobs_spec.rb' + - 'spec/requests/api/graphql/mutations/uploads/delete_spec.rb' - 'spec/requests/api/graphql/project/cluster_agents_spec.rb' - 'spec/requests/api/graphql/project/issue/designs/designs_spec.rb' - 'spec/requests/api/graphql/project/milestones_spec.rb' - 'spec/requests/api/graphql/usage_trends_measurements_spec.rb' + - 'spec/requests/api/graphql/work_item_spec.rb' - 'spec/requests/api/issues/post_projects_issues_spec.rb' - 'spec/requests/api/issues/put_projects_issues_spec.rb' - 'spec/requests/api/merge_requests_spec.rb' - 'spec/requests/api/task_completion_status_spec.rb' - 'spec/requests/projects/ci/promeheus_metrics/histograms_controller_spec.rb' - 'spec/requests/projects/issues_controller_spec.rb' + - 'spec/requests/projects/merge_requests_controller_spec.rb' - 'spec/serializers/build_trace_entity_spec.rb' - 'spec/serializers/ci/daily_build_group_report_result_serializer_spec.rb' - 'spec/serializers/merge_request_poll_widget_entity_spec.rb' - 'spec/services/award_emojis/copy_service_spec.rb' + - 'spec/services/bulk_update_integration_service_spec.rb' - 'spec/services/ci/compare_test_reports_service_spec.rb' + - 'spec/services/ci/create_pipeline_service/rules_spec.rb' - 'spec/services/ci/find_exposed_artifacts_service_spec.rb' - 'spec/services/design_management/move_designs_service_spec.rb' - 'spec/services/git/tag_hooks_service_spec.rb' + - 'spec/services/google_cloud/setup_cloudsql_instance_service_spec.rb' - 'spec/services/import/gitlab_projects/create_project_service_spec.rb' - 'spec/services/jira_connect/sync_service_spec.rb' - 'spec/services/merge_requests/link_lfs_objects_service_spec.rb' @@ -338,9 +372,9 @@ Layout/FirstArrayElementIndentation: - 'spec/simplecov_env.rb' - 'spec/support/atlassian/jira_connect/schemata.rb' - 'spec/support/capybara.rb' + - 'spec/support/helpers/project_template_test_helper.rb' - 'spec/support/helpers/test_env.rb' - 'spec/support/helpers/usage_data_helpers.rb' - - 'spec/support/matchers/background_migrations_matchers.rb' - 'spec/support/matchers/exceed_query_limit.rb' - 'spec/support/migrations_helpers/vulnerabilities_findings_helper.rb' - 'spec/support/prometheus/additional_metrics_shared_examples.rb' diff --git a/.rubocop_todo/layout/first_hash_element_indentation.yml b/.rubocop_todo/layout/first_hash_element_indentation.yml index 8f4d05b36ae..94ad3fde252 100644 --- a/.rubocop_todo/layout/first_hash_element_indentation.yml +++ b/.rubocop_todo/layout/first_hash_element_indentation.yml @@ -1,10 +1,9 @@ --- # Cop supports --auto-correct. Layout/FirstHashElementIndentation: - # Offense count: 1995 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: + - 'app/components/diffs/stats_component.rb' + - 'app/controllers/admin/ci/variables_controller.rb' - 'app/controllers/admin/system_info_controller.rb' - 'app/controllers/boards/issues_controller.rb' - 'app/controllers/concerns/issuable_actions.rb' @@ -13,7 +12,6 @@ Layout/FirstHashElementIndentation: - 'app/controllers/concerns/sourcegraph_decorator.rb' - 'app/controllers/profiles/two_factor_auths_controller.rb' - 'app/controllers/projects/badges_controller.rb' - - 'app/controllers/projects/merge_requests_controller.rb' - 'app/controllers/repositories/lfs_locks_api_controller.rb' - 'app/experiments/concerns/project_commit_count.rb' - 'app/graphql/mutations/clusters/agent_tokens/create.rb' @@ -26,12 +24,12 @@ Layout/FirstHashElementIndentation: - 'app/helpers/breadcrumbs_helper.rb' - 'app/helpers/broadcast_messages_helper.rb' - 'app/helpers/commits_helper.rb' - - 'app/helpers/diff_helper.rb' - 'app/helpers/environments_helper.rb' - 'app/helpers/icons_helper.rb' - 'app/helpers/keyset_helper.rb' - 'app/helpers/listbox_helper.rb' - 'app/helpers/page_layout_helper.rb' + - 'app/helpers/projects/project_members_helper.rb' - 'app/helpers/search_helper.rb' - 'app/helpers/sorting_helper.rb' - 'app/helpers/ssh_keys_helper.rb' @@ -45,6 +43,7 @@ Layout/FirstHashElementIndentation: - 'app/models/ci/build_metadata.rb' - 'app/models/ci/runner.rb' - 'app/models/clusters/applications/crossplane.rb' + - 'app/models/clusters/platforms/kubernetes.rb' - 'app/models/concerns/cross_database_modification.rb' - 'app/models/concerns/featurable.rb' - 'app/models/concerns/has_wiki_page_slug_attributes.rb' @@ -65,14 +64,27 @@ Layout/FirstHashElementIndentation: - 'app/serializers/cluster_serializer.rb' - 'app/serializers/detailed_status_entity.rb' - 'app/services/award_emojis/base_service.rb' + - 'app/services/ci/runners/reconcile_existing_runner_versions_service.rb' - 'app/services/google_cloud/create_service_accounts_service.rb' - 'app/services/members/create_service.rb' - 'app/services/notification_service.rb' - 'app/services/packages/composer/create_package_service.rb' + - 'app/services/pages/delete_service.rb' + - 'app/services/projects/after_rename_service.rb' + - 'app/services/projects/create_service.rb' + - 'app/services/projects/destroy_service.rb' + - 'app/services/projects/transfer_service.rb' + - 'app/services/projects/update_pages_service.rb' + - 'app/services/projects/update_service.rb' - 'app/services/resource_events/change_milestone_service.rb' - 'app/services/spam/ham_service.rb' + - 'app/services/timelogs/base_service.rb' - 'app/validators/addressable_url_validator.rb' - 'app/workers/concerns/cluster_cleanup_methods.rb' + - 'ee/app/components/namespaces/free_user_cap/alert_component.rb' + - 'ee/app/components/namespaces/free_user_cap/personal_alert_component.rb' + - 'ee/app/components/namespaces/free_user_cap/personal_preview_alert_component.rb' + - 'ee/app/components/namespaces/free_user_cap/preview_alert_component.rb' - 'ee/app/controllers/groups/analytics/tasks_by_type_controller.rb' - 'ee/app/graphql/mutations/boards/epic_lists/destroy.rb' - 'ee/app/graphql/mutations/boards/epics/create.rb' @@ -81,9 +93,12 @@ Layout/FirstHashElementIndentation: - 'ee/app/graphql/mutations/iterations/update.rb' - 'ee/app/graphql/mutations/projects/set_compliance_framework.rb' - 'ee/app/graphql/mutations/security_policy/commit_scan_execution_policy.rb' + - 'ee/app/helpers/ee/application_settings_helper.rb' - 'ee/app/helpers/ee/ci/jobs_helper.rb' - 'ee/app/helpers/ee/geo_helper.rb' - 'ee/app/helpers/ee/groups/group_members_helper.rb' + - 'ee/app/helpers/ee/members_helper.rb' + - 'ee/app/helpers/ee/namespaces_helper.rb' - 'ee/app/helpers/ee/projects_helper.rb' - 'ee/app/helpers/ee/sidebars_helper.rb' - 'ee/app/helpers/ee/tree_helper.rb' @@ -96,19 +111,22 @@ Layout/FirstHashElementIndentation: - 'ee/app/serializers/ee/environment_serializer.rb' - 'ee/app/services/app_sec/dast/profiles/update_service.rb' - 'ee/app/services/app_sec/dast/site_profiles/update_service.rb' + - 'ee/app/services/audit_events/build_service.rb' - 'ee/app/services/ee/auth/container_registry_authentication_service.rb' - 'ee/app/services/ee/ci/register_job_service.rb' - 'ee/app/services/ee/issues/export_csv_service.rb' - 'ee/app/services/elastic/cluster_reindexing_service.rb' - 'ee/app/services/gitlab_subscriptions/plan_upgrade_service.rb' + - 'ee/app/services/incident_management/issuable_resource_links/base_service.rb' - 'ee/app/services/jira/requests/issues/list_service.rb' - - 'ee/app/services/projects/slack_application_install_service.rb' - 'ee/app/services/security/token_revocation_service.rb' - 'ee/app/services/timebox_report_service.rb' - 'ee/app/workers/elastic_delete_project_worker.rb' - 'ee/app/workers/groups/create_event_worker.rb' - 'ee/lib/api/epic_links.rb' + - 'ee/lib/ee/api/geo.rb' - 'ee/lib/ee/container_registry/client.rb' + - 'ee/lib/ee/gitlab/application_rate_limiter.rb' - 'ee/lib/ee/gitlab/ci/parsers.rb' - 'ee/lib/ee/gitlab/usage_data.rb' - 'ee/lib/elastic/latest/application_class_proxy.rb' @@ -122,20 +140,23 @@ Layout/FirstHashElementIndentation: - 'ee/spec/controllers/boards/users_controller_spec.rb' - 'ee/spec/controllers/ee/projects/jobs_controller_spec.rb' - 'ee/spec/controllers/ee/projects/variables_controller_spec.rb' + - 'ee/spec/controllers/groups/analytics/cycle_analytics/summary_controller_spec.rb' - 'ee/spec/controllers/groups/epic_boards_controller_spec.rb' - 'ee/spec/controllers/groups/issues_controller_spec.rb' - 'ee/spec/controllers/projects/boards_controller_spec.rb' - 'ee/spec/controllers/projects/feature_flag_issues_controller_spec.rb' - 'ee/spec/controllers/projects/imports_controller_spec.rb' + - 'ee/spec/controllers/projects/integrations/jira/issues_controller_spec.rb' - 'ee/spec/controllers/projects/licenses_controller_spec.rb' - 'ee/spec/controllers/projects/vulnerability_feedback_controller_spec.rb' - 'ee/spec/controllers/projects_controller_spec.rb' - 'ee/spec/controllers/security/projects_controller_spec.rb' - - 'ee/spec/elastic/migrate/20210421140400_add_new_data_to_merge_requests_documents_spec.rb' - - 'ee/spec/elastic/migrate/20210623081800_add_upvotes_to_issues_spec.rb' + - 'ee/spec/elastic/migrate/20220119120500_populate_commit_permissions_in_main_index_spec.rb' - 'ee/spec/factories/dependencies.rb' - 'ee/spec/factories/licenses.rb' + - 'ee/spec/features/registrations/saas_user_registration_spec.rb' - 'ee/spec/finders/epics_finder_spec.rb' + - 'ee/spec/finders/security/scan_execution_policies_finder_spec.rb' - 'ee/spec/frontend/fixtures/dast_profiles.rb' - 'ee/spec/frontend/fixtures/on_demand_dast_scans.rb' - 'ee/spec/frontend/fixtures/search.rb' @@ -143,9 +164,14 @@ Layout/FirstHashElementIndentation: - 'ee/spec/graphql/types/vulnerability_request_response_header_type_spec.rb' - 'ee/spec/helpers/billing_plans_helper_spec.rb' - 'ee/spec/helpers/ee/access_tokens_helper_spec.rb' + - 'ee/spec/helpers/ee/groups_helper_spec.rb' + - 'ee/spec/helpers/ee/invite_members_helper_spec.rb' - 'ee/spec/helpers/ee/labels_helper_spec.rb' + - 'ee/spec/helpers/ee/namespaces_helper_spec.rb' + - 'ee/spec/helpers/ee/projects/pipeline_helper_spec.rb' - 'ee/spec/helpers/ee/projects/security/dast_configuration_helper_spec.rb' - 'ee/spec/helpers/ee/projects/security/sast_configuration_helper_spec.rb' + - 'ee/spec/helpers/ee/security_orchestration_helper_spec.rb' - 'ee/spec/helpers/groups/sso_helper_spec.rb' - 'ee/spec/helpers/nav/new_dropdown_helper_spec.rb' - 'ee/spec/helpers/projects_helper_spec.rb' @@ -154,17 +180,19 @@ Layout/FirstHashElementIndentation: - 'ee/spec/helpers/security_helper_spec.rb' - 'ee/spec/helpers/trial_registrations/reassurances_helper_spec.rb' - 'ee/spec/lib/container_registry/client_spec.rb' - - 'ee/spec/lib/ee/audit/project_changes_auditor_spec.rb' + - 'ee/spec/lib/ee/backup/repositories_spec.rb' - 'ee/spec/lib/ee/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb' - 'ee/spec/lib/ee/gitlab/auth/ldap/access_levels_spec.rb' - 'ee/spec/lib/ee/gitlab/ci/config/entry/bridge_spec.rb' - 'ee/spec/lib/ee/gitlab/ci/parsers/security/common_spec.rb' + - 'ee/spec/lib/ee/gitlab/elastic/helper_spec.rb' - 'ee/spec/lib/ee/gitlab/usage_data_spec.rb' - 'ee/spec/lib/gitlab/analytics/cycle_analytics/data_collector_spec.rb' - 'ee/spec/lib/gitlab/analytics/cycle_analytics/request_params_spec.rb' - 'ee/spec/lib/gitlab/analytics/cycle_analytics/summary/group/stage_summary_spec.rb' - 'ee/spec/lib/gitlab/analytics/type_of_work/tasks_by_type_spec.rb' - 'ee/spec/lib/gitlab/auth/group_saml/membership_updater_spec.rb' + - 'ee/spec/lib/gitlab/auth/saml/membership_updater_spec.rb' - 'ee/spec/lib/gitlab/auth/smartcard/san_extension_spec.rb' - 'ee/spec/lib/gitlab/ci/config/entry/job_spec.rb' - 'ee/spec/lib/gitlab/ci/parsers/security/dast_spec.rb' @@ -173,9 +201,11 @@ Layout/FirstHashElementIndentation: - 'ee/spec/lib/gitlab/ci/yaml_processor_spec.rb' - 'ee/spec/lib/gitlab/contribution_analytics/data_collector_spec.rb' - 'ee/spec/lib/gitlab/elastic/indexer_spec.rb' + - 'ee/spec/lib/gitlab/geo/log_cursor/lease_spec.rb' - 'ee/spec/lib/gitlab/graphql/aggregations/epics/lazy_epic_aggregate_spec.rb' - 'ee/spec/lib/gitlab/subscription_portal/clients/graphql_spec.rb' - 'ee/spec/lib/gitlab/web_ide/config/entry/schemas_spec.rb' + - 'ee/spec/lib/system_check/app/search_check_spec.rb' - 'ee/spec/mailers/credentials_inventory_mailer_spec.rb' - 'ee/spec/mailers/emails/requirements_spec.rb' - 'ee/spec/models/analytics/cycle_analytics/project_stage_spec.rb' @@ -186,25 +216,28 @@ Layout/FirstHashElementIndentation: - 'ee/spec/models/security/finding_spec.rb' - 'ee/spec/requests/api/analytics/project_deployment_frequency_spec.rb' - 'ee/spec/requests/api/experiments_spec.rb' + - 'ee/spec/requests/api/geo_spec.rb' - 'ee/spec/requests/api/graphql/app_sec/fuzzing/api/ci_configuration_type_spec.rb' - 'ee/spec/requests/api/graphql/app_sec/fuzzing/coverage/corpus_type_spec.rb' - 'ee/spec/requests/api/graphql/ci/minutes/usage_spec.rb' - - 'ee/spec/requests/api/graphql/merge_requests/approval_state_spec.rb' - 'ee/spec/requests/api/graphql/milestone_spec.rb' - 'ee/spec/requests/api/graphql/mutations/app_sec/fuzzing/api/ci_configuration/create_spec.rb' - 'ee/spec/requests/api/graphql/mutations/gitlab_subscriptions/activate_spec.rb' - - 'ee/spec/requests/api/graphql/mutations/issues/update_spec.rb' - 'ee/spec/requests/api/graphql/mutations/iterations/create_spec.rb' + - 'ee/spec/requests/api/graphql/mutations/timelogs/create_spec.rb' - 'ee/spec/requests/api/internal/base_spec.rb' - 'ee/spec/requests/api/internal/upcoming_reconciliations_spec.rb' - 'ee/spec/requests/api/members_spec.rb' - 'ee/spec/requests/api/merge_requests_spec.rb' - 'ee/spec/requests/groups/group_members_controller_spec.rb' + - 'ee/spec/requests/groups/usage_quotas_spec.rb' - 'ee/spec/requests/projects/issue_feature_flags_controller_spec.rb' - 'ee/spec/requests/projects/mirrors_controller_spec.rb' - 'ee/spec/serializers/issues/linked_issue_feature_flag_entity_spec.rb' - 'ee/spec/serializers/license_entity_spec.rb' - 'ee/spec/serializers/linked_feature_flag_issue_entity_spec.rb' + - 'ee/spec/serializers/security/vulnerability_report_data_entity_spec.rb' + - 'ee/spec/services/analytics/cycle_analytics/consistency_check_service_spec.rb' - 'ee/spec/services/analytics/cycle_analytics/data_loader_service_spec.rb' - 'ee/spec/services/app_sec/dast/profile_schedules/audit/update_service_spec.rb' - 'ee/spec/services/app_sec/dast/profiles/audit/update_service_spec.rb' @@ -220,19 +253,29 @@ Layout/FirstHashElementIndentation: - 'ee/spec/services/app_sec/fuzzing/coverage/corpuses/create_service_spec.rb' - 'ee/spec/services/approval_rules/create_service_spec.rb' - 'ee/spec/services/approval_rules/update_service_spec.rb' + - 'ee/spec/services/arkose/user_verification_service_spec.rb' - 'ee/spec/services/audit_event_service_spec.rb' - 'ee/spec/services/ci/create_pipeline_service_spec.rb' + - 'ee/spec/services/ci/runners/stale_group_runners_prune_service_spec.rb' - 'ee/spec/services/ee/alert_management/http_integrations/create_service_spec.rb' - 'ee/spec/services/ee/alert_management/http_integrations/update_service_spec.rb' - 'ee/spec/services/ee/merge_requests/create_pipeline_service_spec.rb' + - 'ee/spec/services/ee/merge_requests/update_service_spec.rb' - 'ee/spec/services/ee/post_receive_service_spec.rb' + - 'ee/spec/services/external_status_checks/create_service_spec.rb' - 'ee/spec/services/geo/node_status_request_service_spec.rb' - 'ee/spec/services/geo/registry_consistency_service_spec.rb' - 'ee/spec/services/gitlab_subscriptions/check_future_renewal_service_spec.rb' + - 'ee/spec/services/gitlab_subscriptions/create_trial_or_lead_service_spec.rb' - 'ee/spec/services/gitlab_subscriptions/plan_upgrade_service_spec.rb' + - 'ee/spec/services/gitlab_subscriptions/preview_billable_user_change_service_spec.rb' + - 'ee/spec/services/gitlab_subscriptions/reconciliations/calculate_seat_count_data_service_spec.rb' + - 'ee/spec/services/gitlab_subscriptions/reconciliations/check_seat_usage_alerts_eligibility_service_spec.rb' - 'ee/spec/services/groups/create_service_spec.rb' - 'ee/spec/services/groups/destroy_service_spec.rb' - 'ee/spec/services/iterations/create_service_spec.rb' + - 'ee/spec/services/namespaces/free_user_cap/deactivate_members_over_limit_service_spec.rb' + - 'ee/spec/services/namespaces/free_user_cap/remove_group_group_links_outside_hierarchy_service_spec.rb' - 'ee/spec/services/projects/create_service_spec.rb' - 'ee/spec/services/projects/group_links/create_service_spec.rb' - 'ee/spec/services/projects/group_links/destroy_service_spec.rb' @@ -242,9 +285,16 @@ Layout/FirstHashElementIndentation: - 'ee/spec/services/security/token_revocation_service_spec.rb' - 'ee/spec/services/security/track_scan_service_spec.rb' - 'ee/spec/services/timebox_report_service_spec.rb' + - 'ee/spec/services/users/abuse/excessive_projects_download_ban_service_spec.rb' + - 'ee/spec/services/users/abuse/git_abuse/namespace_throttle_service_spec.rb' - 'ee/spec/support/helpers/ee/login_helpers.rb' - 'ee/spec/support/shared_contexts/fixtures/analytics_shared_context.rb' - 'ee/spec/support/shared_examples/controllers/analytics/cycle_analytics/shared_stage_shared_examples.rb' + - 'ee/spec/support/shared_examples/controllers/namespace_storage_limit_alert_shared_examples.rb' + - 'ee/spec/tasks/gitlab/elastic_rake_spec.rb' + - 'ee/spec/workers/analytics/cycle_analytics/consistency_worker_spec.rb' + - 'ee/spec/workers/ci/runners/stale_group_runners_prune_cron_worker_spec.rb' + - 'ee/spec/workers/gitlab_subscriptions/notify_seats_exceeded_worker_spec.rb' - 'lib/api/admin/instance_clusters.rb' - 'lib/api/group_clusters.rb' - 'lib/api/project_clusters.rb' @@ -264,6 +314,7 @@ Layout/FirstHashElementIndentation: - 'lib/gitlab/github_import/importer/diff_note_importer.rb' - 'lib/gitlab/github_import/importer/pull_request_merged_by_importer.rb' - 'lib/gitlab/gitlab_import/client.rb' + - 'lib/gitlab/graphql/query_analyzers/ast/logger_analyzer.rb' - 'lib/gitlab/hook_data/issue_builder.rb' - 'lib/gitlab/hook_data/release_builder.rb' - 'lib/gitlab/kubernetes.rb' @@ -279,10 +330,9 @@ Layout/FirstHashElementIndentation: - 'qa/qa/ee/resource/board/board_list/project/assignee_board_list.rb' - 'qa/qa/ee/resource/board/board_list/project/milestone_board_list.rb' - 'qa/qa/resource/snippet.rb' + - 'qa/qa/specs/features/api/3_create/repository/commit_to_templated_project_spec.rb' - 'qa/qa/specs/features/api/5_package/container_registry_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb' - - 'qa/qa/specs/features/browser_ui/3_create/snippet/copy_snippet_file_contents_spec.rb' - - 'qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_spec.rb' @@ -294,8 +344,11 @@ Layout/FirstHashElementIndentation: - 'qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb' + - 'qa/qa/specs/features/ee/browser_ui/13_secure/security_reports_spec.rb' - 'qa/qa/specs/features/ee/browser_ui/4_verify/new_discussion_not_dropping_merge_trains_mr_spec.rb' - 'qa/qa/specs/features/ee/browser_ui/9_enablement/elasticsearch/elasticsearch_reindexing_spec.rb' + - 'spec/components/diffs/stats_component_spec.rb' + - 'spec/components/pajamas/component_spec.rb' - 'spec/config/object_store_settings_spec.rb' - 'spec/config/smime_signature_settings_spec.rb' - 'spec/controllers/admin/groups_controller_spec.rb' @@ -319,7 +372,6 @@ Layout/FirstHashElementIndentation: - 'spec/controllers/projects/environments_controller_spec.rb' - 'spec/controllers/projects/feature_flags_controller_spec.rb' - 'spec/controllers/projects/grafana_api_controller_spec.rb' - - 'spec/controllers/projects/group_links_controller_spec.rb' - 'spec/controllers/projects/issues_controller_spec.rb' - 'spec/controllers/projects/jobs_controller_spec.rb' - 'spec/controllers/projects/merge_requests/creations_controller_spec.rb' @@ -336,26 +388,31 @@ Layout/FirstHashElementIndentation: - 'spec/controllers/projects/web_ide_terminals_controller_spec.rb' - 'spec/controllers/projects_controller_spec.rb' - 'spec/factories/ci/builds.rb' - - 'spec/factories/container_repositories.rb' - 'spec/factories/packages/debian/file_metadatum.rb' - 'spec/features/gitlab_experiments_spec.rb' - 'spec/frontend/fixtures/autocomplete_sources.rb' - 'spec/frontend/fixtures/blob.rb' + - 'spec/frontend/fixtures/jobs.rb' + - 'spec/frontend/fixtures/runner.rb' - 'spec/graphql/mutations/release_asset_links/create_spec.rb' - 'spec/graphql/resolvers/concerns/caching_array_resolver_spec.rb' + - 'spec/graphql/resolvers/crm/organizations_resolver_spec.rb' - 'spec/graphql/types/ci/detailed_status_type_spec.rb' + - 'spec/helpers/access_tokens_helper_spec.rb' + - 'spec/helpers/admin/application_settings/settings_helper_spec.rb' - 'spec/helpers/admin/deploy_key_helper_spec.rb' - 'spec/helpers/analytics/cycle_analytics_helper_spec.rb' - 'spec/helpers/ci/builds_helper_spec.rb' - 'spec/helpers/ci/jobs_helper_spec.rb' - 'spec/helpers/ci/pipeline_editor_helper_spec.rb' - - 'spec/helpers/ci/runners_helper_spec.rb' - 'spec/helpers/deploy_tokens_helper_spec.rb' - 'spec/helpers/groups/settings_helper_spec.rb' + - 'spec/helpers/groups_helper_spec.rb' - 'spec/helpers/issuables_helper_spec.rb' - 'spec/helpers/namespaces_helper_spec.rb' - 'spec/helpers/page_layout_helper_spec.rb' - 'spec/helpers/projects/cluster_agents_helper_spec.rb' + - 'spec/helpers/projects/pipeline_helper_spec.rb' - 'spec/helpers/releases_helper_spec.rb' - 'spec/helpers/routing/pseudonymization_helper_spec.rb' - 'spec/helpers/search_helper_spec.rb' @@ -366,14 +423,18 @@ Layout/FirstHashElementIndentation: - 'spec/lib/api/entities/design_management/design_spec.rb' - 'spec/lib/api/entities/merge_request_approvals_spec.rb' - 'spec/lib/api/entities/personal_access_token_spec.rb' + - 'spec/lib/api/entities/personal_access_token_with_details_spec.rb' - 'spec/lib/atlassian/jira_connect/client_spec.rb' - 'spec/lib/backup/database_spec.rb' + - 'spec/lib/backup/repositories_spec.rb' - 'spec/lib/banzai/filter/audio_link_filter_spec.rb' - 'spec/lib/banzai/filter/repository_link_filter_spec.rb' - 'spec/lib/banzai/filter/video_link_filter_spec.rb' - 'spec/lib/bulk_imports/common/pipelines/milestones_pipeline_spec.rb' - 'spec/lib/bulk_imports/groups/pipelines/project_entities_pipeline_spec.rb' - 'spec/lib/bulk_imports/groups/pipelines/subgroup_entities_pipeline_spec.rb' + - 'spec/lib/bulk_imports/groups/stage_spec.rb' + - 'spec/lib/bulk_imports/groups/transformers/group_attributes_transformer_spec.rb' - 'spec/lib/bulk_imports/projects/pipelines/container_expiration_policy_pipeline_spec.rb' - 'spec/lib/bulk_imports/projects/pipelines/project_feature_pipeline_spec.rb' - 'spec/lib/container_registry/client_spec.rb' @@ -401,9 +462,11 @@ Layout/FirstHashElementIndentation: - 'spec/lib/gitlab/ci/config/yaml/tags/resolver_spec.rb' - 'spec/lib/gitlab/ci/config_spec.rb' - 'spec/lib/gitlab/ci/parsers/codequality/code_climate_spec.rb' + - 'spec/lib/gitlab/ci/parsers/sbom/source/dependency_scanning_spec.rb' - 'spec/lib/gitlab/ci/parsers/security/common_spec.rb' - 'spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb' - 'spec/lib/gitlab/ci/pipeline/seed/build/cache_spec.rb' + - 'spec/lib/gitlab/ci/reports/coverage_report_spec.rb' - 'spec/lib/gitlab/ci/reports/security/identifier_spec.rb' - 'spec/lib/gitlab/ci/reports/security/scanner_spec.rb' - 'spec/lib/gitlab/ci/reports/terraform_reports_spec.rb' @@ -411,11 +474,15 @@ Layout/FirstHashElementIndentation: - 'spec/lib/gitlab/config_checker/external_database_checker_spec.rb' - 'spec/lib/gitlab/config_checker/puma_rugged_checker_spec.rb' - 'spec/lib/gitlab/data_builder/build_spec.rb' + - 'spec/lib/gitlab/data_builder/issuable_spec.rb' - 'spec/lib/gitlab/data_builder/pipeline_spec.rb' - 'spec/lib/gitlab/database/load_balancing/setup_spec.rb' + - 'spec/lib/gitlab/database/migration_helpers_spec.rb' - 'spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb' - 'spec/lib/gitlab/database_spec.rb' - 'spec/lib/gitlab/diff/position_spec.rb' + - 'spec/lib/gitlab/error_tracking/error_repository/open_api_strategy_spec.rb' + - 'spec/lib/gitlab/error_tracking_spec.rb' - 'spec/lib/gitlab/experimentation/controller_concern_spec.rb' - 'spec/lib/gitlab/experimentation_spec.rb' - 'spec/lib/gitlab/git/conflict/file_spec.rb' @@ -427,6 +494,7 @@ Layout/FirstHashElementIndentation: - 'spec/lib/gitlab/github_import/logger_spec.rb' - 'spec/lib/gitlab/github_import/object_counter_spec.rb' - 'spec/lib/gitlab/gpg_spec.rb' + - 'spec/lib/gitlab/graphql/query_analyzers/ast/logger_analyzer_spec.rb' - 'spec/lib/gitlab/graphql/tracers/logger_tracer_spec.rb' - 'spec/lib/gitlab/graphql/tracers/timer_tracer_spec.rb' - 'spec/lib/gitlab/http_spec.rb' @@ -438,6 +506,7 @@ Layout/FirstHashElementIndentation: - 'spec/lib/gitlab/kubernetes/kubeconfig/template_spec.rb' - 'spec/lib/gitlab/kubernetes/rollout_instances_spec.rb' - 'spec/lib/gitlab/legacy_github_import/label_formatter_spec.rb' + - 'spec/lib/gitlab/memory/watchdog_spec.rb' - 'spec/lib/gitlab/metrics/dashboard/importers/prometheus_metrics_spec.rb' - 'spec/lib/gitlab/metrics/subscribers/action_cable_spec.rb' - 'spec/lib/gitlab/middleware/multipart/handler_spec.rb' @@ -447,7 +516,6 @@ Layout/FirstHashElementIndentation: - 'spec/lib/gitlab/push_options_spec.rb' - 'spec/lib/gitlab/submodule_links_spec.rb' - 'spec/lib/gitlab/usage_data/topology_spec.rb' - - 'spec/lib/gitlab/usage_data_spec.rb' - 'spec/lib/gitlab/utils_spec.rb' - 'spec/lib/gitlab/web_ide/config/entry/global_spec.rb' - 'spec/lib/mattermost/team_spec.rb' @@ -455,11 +523,13 @@ Layout/FirstHashElementIndentation: - 'spec/lib/peek/views/memory_spec.rb' - 'spec/mailers/emails/merge_requests_spec.rb' - 'spec/models/active_session_spec.rb' + - 'spec/models/analytics/cycle_analytics/aggregation_spec.rb' - 'spec/models/ci/pipeline_spec.rb' - 'spec/models/ci_platform_metric_spec.rb' - 'spec/models/clusters/applications/prometheus_spec.rb' - 'spec/models/event_spec.rb' - 'spec/models/gpg_key_spec.rb' + - 'spec/models/instance_configuration_spec.rb' - 'spec/models/integrations/base_chat_notification_spec.rb' - 'spec/models/integrations/chat_message/deployment_message_spec.rb' - 'spec/models/integrations/chat_message/issue_message_spec.rb' @@ -479,12 +549,14 @@ Layout/FirstHashElementIndentation: - 'spec/requests/api/feature_flags_spec.rb' - 'spec/requests/api/feature_flags_user_lists_spec.rb' - 'spec/requests/api/graphql/ci/config_spec.rb' + - 'spec/requests/api/graphql/ci/group_variables_spec.rb' + - 'spec/requests/api/graphql/ci/instance_variables_spec.rb' + - 'spec/requests/api/graphql/ci/project_variables_spec.rb' - 'spec/requests/api/graphql/group/milestones_spec.rb' - 'spec/requests/api/graphql/metrics/dashboard/annotations_spec.rb' + - 'spec/requests/api/graphql/mutations/timelogs/create_spec.rb' - 'spec/requests/api/graphql/project/cluster_agents_spec.rb' - 'spec/requests/api/graphql/project/release_spec.rb' - - 'spec/requests/api/graphql/project/terraform/state_spec.rb' - - 'spec/requests/api/graphql/project/terraform/states_spec.rb' - 'spec/requests/api/graphql/project_query_spec.rb' - 'spec/requests/api/internal/base_spec.rb' - 'spec/requests/api/merge_requests_spec.rb' @@ -502,19 +574,29 @@ Layout/FirstHashElementIndentation: - 'spec/requests/jira_connect/installations_controller_spec.rb' - 'spec/requests/lfs_http_spec.rb' - 'spec/serializers/blob_entity_spec.rb' + - 'spec/serializers/integrations/harbor_serializers/artifact_entity_spec.rb' + - 'spec/serializers/integrations/harbor_serializers/repository_entity_spec.rb' + - 'spec/serializers/integrations/harbor_serializers/tag_entity_spec.rb' + - 'spec/services/bulk_imports/create_pipeline_trackers_service_spec.rb' - 'spec/services/ci/create_pipeline_service/custom_yaml_tags_spec.rb' - 'spec/services/ci/create_pipeline_service/parent_child_pipeline_spec.rb' - 'spec/services/ci/create_pipeline_service_spec.rb' - 'spec/services/ci/find_exposed_artifacts_service_spec.rb' - 'spec/services/ci/play_manual_stage_service_spec.rb' + - 'spec/services/ci/runners/reconcile_existing_runner_versions_service_spec.rb' - 'spec/services/clusters/agents/create_service_spec.rb' - 'spec/services/clusters/applications/check_ingress_ip_address_service_spec.rb' - 'spec/services/clusters/aws/authorize_role_service_spec.rb' - 'spec/services/clusters/update_service_spec.rb' - 'spec/services/commits/tag_service_spec.rb' + - 'spec/services/database/consistency_check_service_spec.rb' - 'spec/services/git/branch_push_service_spec.rb' + - 'spec/services/google_cloud/create_cloudsql_instance_service_spec.rb' + - 'spec/services/import/fogbugz_service_spec.rb' - 'spec/services/import/github_service_spec.rb' - 'spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_spec.rb' + - 'spec/services/markdown_content_rewriter_service_spec.rb' + - 'spec/services/merge_requests/build_service_spec.rb' - 'spec/services/merge_requests/create_service_spec.rb' - 'spec/services/merge_requests/get_urls_service_spec.rb' - 'spec/services/merge_requests/refresh_service_spec.rb' @@ -527,6 +609,7 @@ Layout/FirstHashElementIndentation: - 'spec/services/projects/lfs_pointers/lfs_download_service_spec.rb' - 'spec/services/projects/operations/update_service_spec.rb' - 'spec/services/projects/update_service_spec.rb' + - 'spec/services/service_ping/submit_service_ping_service_spec.rb' - 'spec/services/snippets/count_service_spec.rb' - 'spec/sidekiq_cluster/sidekiq_cluster_spec.rb' - 'spec/support/atlassian/jira_connect/schemata.rb' @@ -540,6 +623,9 @@ Layout/FirstHashElementIndentation: - 'spec/support/shared_contexts/fixtures/analytics_shared_context.rb' - 'spec/support/shared_contexts/lib/container_registry/client_shared_context.rb' - 'spec/support/shared_examples/graphql/spam_protection_shared_examples.rb' + - 'spec/support/shared_examples/harbor/artifacts_controller_shared_examples.rb' + - 'spec/support/shared_examples/harbor/repositories_controller_shared_examples.rb' + - 'spec/support/shared_examples/harbor/tags_controller_shared_examples.rb' - 'spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb' - 'spec/support/shared_examples/models/clusters/prometheus_client_shared.rb' - 'spec/support/shared_examples/models/cycle_analytics_stage_shared_examples.rb' @@ -550,4 +636,6 @@ Layout/FirstHashElementIndentation: - 'spec/tasks/gitlab/backup_rake_spec.rb' - 'spec/tooling/danger/datateam_spec.rb' - 'spec/tooling/lib/tooling/kubernetes_client_spec.rb' + - 'spec/views/projects/issues/_issue.html.haml_spec.rb' + - 'spec/workers/ci/runners/reconcile_existing_runner_versions_cron_worker_spec.rb' - 'spec/workers/concerns/gitlab/github_import/object_importer_spec.rb' diff --git a/.rubocop_todo/layout/multiline_operation_indentation.yml b/.rubocop_todo/layout/multiline_operation_indentation.yml index 51ecf97d318..c67120a7951 100644 --- a/.rubocop_todo/layout/multiline_operation_indentation.yml +++ b/.rubocop_todo/layout/multiline_operation_indentation.yml @@ -1,77 +1,91 @@ --- # Cop supports --auto-correct. Layout/MultilineOperationIndentation: - # Offense count: 252 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: + - 'app/components/pajamas/concerns/checkbox_radio_label_with_help_text.rb' - 'app/controllers/projects/application_controller.rb' - 'app/controllers/repositories/git_http_client_controller.rb' - 'app/controllers/sent_notifications_controller.rb' - 'app/graphql/types/ci/stage_type.rb' - - 'app/helpers/application_settings_helper.rb' - 'app/helpers/auth_helper.rb' - 'app/helpers/issuables_helper.rb' - 'app/helpers/mirror_helper.rb' - 'app/helpers/packages_helper.rb' - 'app/helpers/projects_helper.rb' - - 'app/helpers/storage_helper.rb' - 'app/helpers/visibility_level_helper.rb' - 'app/helpers/whats_new_helper.rb' - 'app/models/concerns/admin_changed_password_notifier.rb' - 'app/models/integrations/prometheus.rb' + - 'app/models/merge_request_diff_file.rb' - 'app/models/namespaces/traversal/linear_scopes.rb' - 'app/models/packages/conan/metadatum.rb' - 'app/models/packages/sem_ver.rb' - 'app/models/project.rb' - 'app/models/project_statistics.rb' - 'app/models/user.rb' + - 'app/models/work_items/parent_link.rb' + - 'app/policies/project_policy.rb' + - 'app/serializers/deploy_keys/deploy_key_entity.rb' - 'app/services/ci/create_downstream_pipeline_service.rb' - 'app/services/ci/create_pipeline_service.rb' - 'app/services/git/branch_hooks_service.rb' - - 'app/services/groups/group_links/create_service.rb' - 'app/services/groups/transfer_service.rb' - 'app/services/issues/update_service.rb' - 'app/services/labels/promote_service.rb' - 'app/services/labels/transfer_service.rb' + - 'app/services/members/approve_access_request_service.rb' - 'app/services/projects/container_repository/cleanup_tags_service.rb' - 'app/services/webauthn/authenticate_service.rb' - 'app/validators/feature_flag_strategies_validator.rb' - 'app/workers/container_expiration_policies/cleanup_container_repository_worker.rb' + - 'app/workers/container_registry/migration/guard_worker.rb' - 'config/initializers/devise_dynamic_password_length_validation.rb' - 'danger/utility_css/Dangerfile' + - 'ee/app/controllers/ee/admin/application_settings_controller.rb' + - 'ee/app/controllers/projects/integrations/jira/issues_controller.rb' - 'ee/app/controllers/smartcard_controller.rb' - 'ee/app/graphql/resolvers/boards/epic_lists_resolver.rb' - 'ee/app/helpers/ee/application_settings_helper.rb' - 'ee/app/helpers/ee/boards_helper.rb' + - 'ee/app/helpers/ee/groups/group_members_helper.rb' + - 'ee/app/helpers/ee/groups/reporting_helper.rb' + - 'ee/app/helpers/ee/projects/project_members_helper.rb' - 'ee/app/helpers/groups/security_features_helper.rb' - 'ee/app/helpers/groups/sso_helper.rb' + - 'ee/app/models/approval_project_rule.rb' + - 'ee/app/models/concerns/ee/issuable.rb' - 'ee/app/models/ee/namespace.rb' - 'ee/app/models/ee/namespace/root_storage_size.rb' - 'ee/app/models/ee/project.rb' - 'ee/app/models/ee/user.rb' - 'ee/app/models/vulnerabilities/finding_signature.rb' - 'ee/app/policies/ee/base_policy.rb' + - 'ee/app/policies/ee/merge_request_policy.rb' - 'ee/app/services/analytics/cycle_analytics/value_streams/update_service.rb' - 'ee/app/services/ee/merge_requests/build_service.rb' - 'ee/app/services/ee/projects/operations/update_service.rb' + - 'ee/app/workers/elastic/project_transfer_worker.rb' - 'ee/lib/ee/api/entities/group.rb' + - 'ee/lib/ee/api/geo.rb' - 'ee/lib/ee/api/helpers.rb' + - 'ee/lib/ee/api/settings.rb' + - 'ee/lib/ee/gitlab/git_access_project.rb' - 'ee/lib/ee/gitlab/middleware/read_only/controller.rb' - 'ee/lib/ee/gitlab/quick_actions/issue_actions.rb' - 'ee/lib/ee/sidebars/projects/menus/ci_cd_menu.rb' - 'ee/lib/ee/sidebars/projects/menus/issues_menu.rb' - - 'ee/lib/elastic/latest/issue_class_proxy.rb' + - 'ee/lib/gitlab/incident_management.rb' - 'ee/lib/sidebars/groups/menus/analytics_menu.rb' - 'ee/lib/sidebars/groups/menus/security_compliance_menu.rb' - 'ee/spec/services/ci/create_pipeline_service/dast_configuration_spec.rb' - 'lib/api/maven_packages.rb' - 'lib/api/users.rb' - 'lib/api/validations/validators/array_none_any.rb' + - 'lib/gitlab/auth/o_auth/user.rb' - 'lib/gitlab/ci/reports/security/finding_key.rb' - 'lib/gitlab/database/load_balancing/connection_proxy.rb' - 'lib/gitlab/database/query_analyzers/prevent_cross_database_modification.rb' - - 'lib/gitlab/form_builders/gitlab_ui_form_builder.rb' + - 'lib/gitlab/error_tracking/error_repository/open_api_strategy.rb' - 'lib/gitlab/git_access.rb' - 'lib/gitlab/gl_repository/repo_type.rb' - 'lib/gitlab/jwt_token.rb' @@ -82,6 +96,8 @@ Layout/MultilineOperationIndentation: - 'lib/gitlab/pagination/cursor_based_keyset.rb' - 'lib/gitlab/quick_actions/issue_and_merge_request_actions.rb' - 'lib/gitlab/rack_attack/request.rb' + - 'lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb' + - 'lib/gitlab/sidekiq_status.rb' - 'lib/gitlab/x509/signature.rb' - 'lib/gitlab_edition.rb' - 'lib/kramdown/converter/commonmark.rb' @@ -90,12 +106,12 @@ Layout/MultilineOperationIndentation: - 'lib/sidebars/projects/menus/deployments_menu.rb' - 'lib/sidebars/projects/menus/hidden_menu.rb' - 'lib/sidebars/projects/menus/monitor_menu.rb' - - 'lib/sidebars/projects/menus/settings_menu.rb' - 'qa/qa/ee/page/group/roadmap.rb' - 'qa/qa/page/component/snippet.rb' - 'qa/qa/runtime/api/repository_storage_moves.rb' - 'rubocop/cop/gitlab/keys_first_and_values_first.rb' - 'rubocop/migration_helpers.rb' + - 'spec/controllers/graphql_controller_spec.rb' - 'spec/frontend/fixtures/tabs.rb' - 'spec/lib/gitlab/ci/pipeline/seed/build_spec.rb' - 'spec/services/ci/create_pipeline_service_spec.rb' diff --git a/.rubocop_todo/layout/space_inside_block_braces.yml b/.rubocop_todo/layout/space_inside_block_braces.yml index 38ee4c862ca..d8454708d82 100644 --- a/.rubocop_todo/layout/space_inside_block_braces.yml +++ b/.rubocop_todo/layout/space_inside_block_braces.yml @@ -1,10 +1,6 @@ --- # Cop supports --auto-correct. Layout/SpaceInsideBlockBraces: - # Offense count: 1508 - # Temporarily disabled due to too many offenses - Enabled: false - EnforcedStyle: space Exclude: - 'app/controllers/groups/boards_controller.rb' - 'app/controllers/profiles/two_factor_auths_controller.rb' @@ -16,8 +12,6 @@ Layout/SpaceInsideBlockBraces: - 'app/helpers/todos_helper.rb' - 'app/models/authentication_event.rb' - 'app/models/bulk_imports/entity.rb' - - 'app/models/ci/pipeline.rb' - - 'app/models/concerns/cache_markdown_field.rb' - 'app/models/concerns/featurable.rb' - 'app/models/integrations/bamboo.rb' - 'app/models/integrations/buildkite.rb' @@ -41,7 +35,9 @@ Layout/SpaceInsideBlockBraces: - 'ee/app/models/compliance_management/framework.rb' - 'ee/app/models/dora/daily_metrics.rb' - 'ee/app/models/ee/application_setting.rb' + - 'ee/app/models/ee/deployment.rb' - 'ee/app/models/ee/member.rb' + - 'ee/app/models/vulnerabilities/feedback.rb' - 'ee/app/models/vulnerabilities/identifier.rb' - 'ee/app/serializers/vulnerabilities/finding_entity.rb' - 'ee/app/services/elastic/cluster_reindexing_service.rb' @@ -51,6 +47,7 @@ Layout/SpaceInsideBlockBraces: - 'ee/lib/elastic/latest/git_class_proxy.rb' - 'ee/lib/gitlab/auth/smartcard/san_extension.rb' - 'ee/lib/world.rb' + - 'ee/spec/features/admin/admin_runners_spec.rb' - 'lib/api/commits.rb' - 'lib/api/helpers/merge_requests_helpers.rb' - 'lib/backup/manager.rb' @@ -60,8 +57,10 @@ Layout/SpaceInsideBlockBraces: - 'lib/bitbucket_server/representation/base.rb' - 'lib/gitlab/background_migration/fix_projects_without_prometheus_service.rb' - 'lib/gitlab/contributions_calendar.rb' - - 'lib/gitlab/database/migrations/test_background_runner.rb' + - 'lib/gitlab/database/migrations/base_background_runner.rb' - 'lib/gitlab/database/postgres_hll/buckets.rb' + - 'lib/gitlab/diff/rendered/notebook/diff_file.rb' + - 'lib/gitlab/diff/rendered/notebook/diff_file_helper.rb' - 'lib/gitlab/email/message/in_product_marketing/helper.rb' - 'lib/gitlab/issues/rebalancing/state.rb' - 'lib/gitlab/profiler.rb' @@ -74,12 +73,14 @@ Layout/SpaceInsideBlockBraces: - 'lib/tasks/gitlab/shell.rake' - 'lib/tasks/gitlab/tw/codeowners.rake' - 'rubocop/cop/migration/add_limit_to_text_columns.rb' + - 'scripts/qa/testcases-check' + - 'spec/channels/awareness_channel_spec.rb' + - 'spec/components/pajamas/banner_component_spec.rb' - 'spec/config/settings_spec.rb' - 'spec/controllers/admin/application_settings_controller_spec.rb' - 'spec/controllers/application_controller_spec.rb' - 'spec/controllers/groups/labels_controller_spec.rb' - 'spec/controllers/groups/releases_controller_spec.rb' - - 'spec/controllers/groups/settings/ci_cd_controller_spec.rb' - 'spec/controllers/import/manifest_controller_spec.rb' - 'spec/controllers/projects/blame_controller_spec.rb' - 'spec/controllers/projects/deploy_keys_controller_spec.rb' @@ -122,6 +123,7 @@ Layout/SpaceInsideBlockBraces: - 'spec/frontend/fixtures/clusters.rb' - 'spec/frontend/fixtures/deploy_keys.rb' - 'spec/frontend/fixtures/groups.rb' + - 'spec/frontend/fixtures/integrations.rb' - 'spec/frontend/fixtures/issues.rb' - 'spec/frontend/fixtures/jobs.rb' - 'spec/frontend/fixtures/labels.rb' @@ -131,6 +133,7 @@ Layout/SpaceInsideBlockBraces: - 'spec/frontend/fixtures/pipeline_schedules.rb' - 'spec/frontend/fixtures/pipelines.rb' - 'spec/frontend/fixtures/projects.rb' + - 'spec/frontend/fixtures/prometheus_integration.rb' - 'spec/frontend/fixtures/raw.rb' - 'spec/frontend/fixtures/snippet.rb' - 'spec/frontend/fixtures/todos.rb' @@ -144,30 +147,41 @@ Layout/SpaceInsideBlockBraces: - 'spec/helpers/wiki_page_version_helper_spec.rb' - 'spec/initializers/carrierwave_patch_spec.rb' - 'spec/initializers/trusted_proxies_spec.rb' + - 'spec/lib/gitlab/ci/parsers/security/validators/schema_validator_spec.rb' + - 'spec/lib/gitlab/memory/reports/jemalloc_stats_spec.rb' - 'spec/mailers/emails/service_desk_spec.rb' - 'spec/migrations/20210812013042_remove_duplicate_project_authorizations_spec.rb' - 'spec/migrations/20210910194952_update_report_type_for_existing_approval_project_rules_spec.rb' + - 'spec/migrations/20220505174658_update_index_on_alerts_to_exclude_null_fingerprints_spec.rb' - 'spec/migrations/confirm_support_bot_user_spec.rb' - 'spec/migrations/reset_job_token_scope_enabled_again_spec.rb' - 'spec/migrations/reset_job_token_scope_enabled_spec.rb' - 'spec/migrations/reset_severity_levels_to_new_default_spec.rb' - - 'spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb' + - 'spec/models/merge_request/approval_removal_settings_spec.rb' - 'spec/policies/clusters/agent_policy_spec.rb' - 'spec/policies/group_member_policy_spec.rb' - 'spec/policies/issue_policy_spec.rb' - 'spec/policies/project_policy_spec.rb' - 'spec/policies/terraform/state_policy_spec.rb' - 'spec/policies/terraform/state_version_policy_spec.rb' + - 'spec/policies/timelog_policy_spec.rb' - 'spec/presenters/packages/composer/packages_presenter_spec.rb' - 'spec/presenters/packages/conan/package_presenter_spec.rb' - 'spec/presenters/packages/nuget/packages_metadata_presenter_spec.rb' + - 'spec/presenters/packages/pypi/simple_package_versions_presenter_spec.rb' - 'spec/presenters/project_presenter_spec.rb' - 'spec/rubocop/cop/migration/create_table_with_foreign_keys_spec.rb' + - 'spec/scripts/changed-feature-flags_spec.rb' - 'spec/serializers/cluster_entity_spec.rb' + - 'spec/serializers/deploy_keys/basic_deploy_key_entity_spec.rb' + - 'spec/serializers/deploy_keys/deploy_key_entity_spec.rb' - 'spec/serializers/import/provider_repo_serializer_spec.rb' + - 'spec/services/ci/runners/bulk_delete_runners_service_spec.rb' + - 'spec/services/work_items/widgets/assignees_service/update_service_spec.rb' + - 'spec/services/work_items/widgets/start_and_due_date_service/update_service_spec.rb' - 'spec/support/helpers/cycle_analytics_helpers.rb' + - 'spec/support/helpers/graphql_helpers.rb' - 'spec/support/redis/redis_shared_examples.rb' - - 'spec/support/shared_contexts/features/integrations/integrations_shared_context.rb' - 'spec/support/shared_contexts/graphql/requests/packages_shared_context.rb' - 'spec/support/shared_contexts/markdown_golden_master_shared_examples.rb' - 'spec/support/shared_contexts/requests/api/conan_packages_shared_context.rb' @@ -176,6 +190,7 @@ Layout/SpaceInsideBlockBraces: - 'spec/support/shared_examples/features/board_sidebar_labels_examples.rb' - 'spec/support/shared_examples/features/snippets_shared_examples.rb' - 'spec/support/shared_examples/features/wiki/user_views_asciidoc_page_with_includes_shared_examples.rb' + - 'spec/support/shared_examples/helpers/wiki_helpers_shared_examples.rb' - 'spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb' - 'spec/support/shared_examples/lib/gitlab/sql/set_operator_shared_examples.rb' - 'spec/support/shared_examples/models/cluster_application_core_shared_examples.rb' @@ -185,7 +200,6 @@ Layout/SpaceInsideBlockBraces: - 'spec/support/shared_examples/models/label_note_shared_examples.rb' - 'spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb' - 'spec/support/shared_examples/models/project_latest_successful_build_for_shared_examples.rb' - - 'spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb' - 'spec/support/shared_examples/requests/api/issues/merge_requests_count_shared_examples.rb' - 'spec/support/shared_examples/requests/api/labels_api_shared_examples.rb' - 'spec/support/shared_examples/requests/api/repository_storage_moves_shared_examples.rb' @@ -198,12 +212,14 @@ Layout/SpaceInsideBlockBraces: - 'spec/tasks/gitlab/snippets_rake_spec.rb' - 'spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb' - 'spec/validators/addressable_url_validator_spec.rb' + - 'spec/views/devise/sessions/new.html.haml_spec.rb' - 'spec/views/help/instance_configuration.html.haml_spec.rb' - 'spec/views/layouts/_header_search.html.haml_spec.rb' - 'spec/views/layouts/_published_experiments.html.haml_spec.rb' - 'spec/views/shared/runners/_runner_details.html.haml_spec.rb' - 'spec/workers/bulk_imports/export_request_worker_spec.rb' - 'spec/workers/clusters/cleanup/project_namespace_worker_spec.rb' + - 'spec/workers/packages/cleanup/execute_policy_worker_spec.rb' - 'spec/workers/packages/helm/extraction_worker_spec.rb' - 'spec/workers/pages_worker_spec.rb' - 'spec/workers/purge_dependency_proxy_cache_worker_spec.rb' diff --git a/.rubocop_todo/rails/rake_environment.yml b/.rubocop_todo/rails/rake_environment.yml deleted file mode 100644 index d248db022ce..00000000000 --- a/.rubocop_todo/rails/rake_environment.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# Cop supports --auto-correct. -Rails/RakeEnvironment: - # Offense count: 31 - # Temporarily disabled due to too many offenses - Enabled: false - Exclude: - - 'ee/lib/tasks/gitlab/elastic/test.rake' - - 'lib/tasks/config_lint.rake' - - 'lib/tasks/dev.rake' - - 'lib/tasks/gettext.rake' - - 'lib/tasks/gitlab/assets.rake' - - 'lib/tasks/gitlab/db.rake' - - 'lib/tasks/gitlab/docs/compile_deprecations.rake' - - 'lib/tasks/gitlab/docs/redirect.rake' - - 'lib/tasks/gitlab/helpers.rake' - - 'lib/tasks/gitlab/sidekiq.rake' - - 'lib/tasks/gitlab/tw/codeowners.rake' - - 'lib/tasks/gitlab/update_templates.rake' - - 'lib/tasks/lint.rake' - - 'lib/tasks/migrate/setup_postgresql.rake' - - 'lib/tasks/setup.rake' - - 'lib/tasks/test.rake' - - 'lib/tasks/yarn.rake' - - 'qa/qa/fixtures/auto_devops_rack/Rakefile' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 27f762dda4b..d0d19211dea 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -5ac494300c839eea0980d118d12ffb51f447c0ac +3d769a33712796de113fe07647597a63d762c305 diff --git a/app/assets/javascripts/work_items/components/work_item_links/index.js b/app/assets/javascripts/work_items/components/work_item_links/index.js index 176f84f6c1a..6c8af8dc74c 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/index.js +++ b/app/assets/javascripts/work_items/components/work_item_links/index.js @@ -22,6 +22,8 @@ export default function initWorkItemLinks() { return; } + const { projectPath, wiHasIssueWeightsFeature } = workItemLinksRoot.dataset; + // eslint-disable-next-line no-new new Vue({ el: workItemLinksRoot, @@ -31,7 +33,9 @@ export default function initWorkItemLinks() { workItemLinks: WorkItemLinks, }, provide: { - projectPath: workItemLinksRoot.dataset.projectPath, + projectPath, + fullPath: projectPath, + hasIssueWeightsFeature: wiHasIssueWeightsFeature, }, render: (createElement) => createElement('work-item-links', { diff --git a/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue b/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue index 8aa1c862055..fd568c1dfce 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue +++ b/app/assets/javascripts/work_items/components/work_item_links/work_item_links.vue @@ -1,8 +1,11 @@ @@ -95,7 +16,7 @@ export default { - + {{ s__('WorkItem|Remove') }} diff --git a/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql b/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql index 827976551e0..c30c907baeb 100644 --- a/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item_links.query.graphql @@ -6,6 +6,7 @@ query workItemQuery($id: WorkItemID!) { } title userPermissions { + deleteWorkItem updateWorkItem } confidential diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index a63e02fca1d..f8737a4e54a 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -99,7 +99,7 @@ s_("Preferences|Show one file at a time on merge request's Changes tab"), help_text: s_("Preferences|Instead of all the files changed, show only one file at a time. To switch between files, use the file browser.") .form-group - - supported_characters = %w(" ' ` ( [ { < * _).map {|char| "#{char}" }.join(', ') + - supported_characters = %w(" ' ` ( [ { < * _).map { |char| "#{char}" }.join(', ') = f.gitlab_ui_checkbox_component :markdown_surround_selection, s_('Preferences|Surround text selection when typing quotes or brackets'), help_text: sprintf(s_( "Preferences|When you type in a description or comment box, selected text is surrounded by the corresponding character after typing one of the following characters: %{supported_characters}."), { supported_characters: supported_characters }).html_safe diff --git a/app/views/projects/issues/_work_item_links.html.haml b/app/views/projects/issues/_work_item_links.html.haml index 5d478784350..df2ffdd30ee 100644 --- a/app/views/projects/issues/_work_item_links.html.haml +++ b/app/views/projects/issues/_work_item_links.html.haml @@ -1,2 +1,2 @@ - if Feature.enabled?(:work_items_hierarchy, @project) - .js-work-item-links-root{ data: { issuable_id: @issue.id, project_path: @project.full_path } } + .js-work-item-links-root{ data: { issuable_id: @issue.id, project_path: @project.full_path, wi: work_items_index_data(@project) } } diff --git a/config/feature_flags/development/audit_event_streaming_git_operations_deploy_key_event.yml b/config/feature_flags/development/audit_event_streaming_git_operations_deploy_key_event.yml deleted file mode 100644 index 026efae1253..00000000000 --- a/config/feature_flags/development/audit_event_streaming_git_operations_deploy_key_event.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: audit_event_streaming_git_operations_deploy_key_event -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93160 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/368765 -milestone: '15.3' -type: development -group: group::release -default_enabled: false diff --git a/doc/administration/audit_event_streaming.md b/doc/administration/audit_event_streaming.md index e2f19b2d45d..e3928e31962 100644 --- a/doc/administration/audit_event_streaming.md +++ b/doc/administration/audit_event_streaming.md @@ -434,7 +434,7 @@ Push: #### Example payloads for SSH events with Deploy Key -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/363876) in GitLab 15.3 [with a flag](../administration/feature_flags.md) named `audit_event_streaming_git_operations_deploy_key_event`. Disabled by default. +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/363876) in GitLab 15.3. Fetch: diff --git a/doc/administration/operations/ssh_certificates.md b/doc/administration/operations/ssh_certificates.md index a777f5484fd..413c14aba94 100644 --- a/doc/administration/operations/ssh_certificates.md +++ b/doc/administration/operations/ssh_certificates.md @@ -143,8 +143,7 @@ This is because if the `AuthorizedPrincipalsCommand` can't authenticate the user, OpenSSH falls back on `~/.ssh/authorized_keys` (or the `AuthorizedKeysCommand`). -Therefore there may still be a reason to use the ["Fast lookup of -authorized SSH keys in the database"](fast_ssh_key_lookup.html) method +Therefore there may still be a reason to use the [Fast lookup of authorized SSH keys in the database](fast_ssh_key_lookup.md) method in conjunction with this. Since you are using SSH certificates for all your normal users, and relying on the `~/.ssh/authorized_keys` fallback for deploy keys, if you make use of those. diff --git a/doc/administration/reference_architectures/index.md b/doc/administration/reference_architectures/index.md index 401f606f27d..7be12e12386 100644 --- a/doc/administration/reference_architectures/index.md +++ b/doc/administration/reference_architectures/index.md @@ -240,7 +240,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculated cost + Calculated cost 2k @@ -248,7 +248,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculated cost + Calculated cost 3k @@ -256,7 +256,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculated cost + Calculated cost 5k @@ -264,7 +264,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculated cost + Calculated cost 10k @@ -272,7 +272,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculated cost + Calculated cost 25k @@ -280,7 +280,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculate cost + Calculate cost 50k @@ -288,7 +288,7 @@ The following table details the cost to run the different reference architecture Calculated cost - Calculated cost + Calculated cost diff --git a/doc/ci/docker/using_kaniko.md b/doc/ci/docker/using_kaniko.md index c2b18dc6467..1451e5d2b60 100644 --- a/doc/ci/docker/using_kaniko.md +++ b/doc/ci/docker/using_kaniko.md @@ -119,6 +119,13 @@ build: - if: $CI_COMMIT_TAG ``` +## Build a multi-arch image + +You can build [multi-arch images](https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/) +inside a container by using [`manifest-tool`](https://github.com/estesp/manifest-tool). + +For a detailed guide on how to build a multi-arch image, read [Building a multi-arch container image in unprivileged containers](https://ingenuity.siemens.com/2022/07/building-a-multi-arch-container-image-in-unprivileged-containers/). + ## Using a registry with a custom certificate When trying to push to a Docker registry that uses a certificate that is signed diff --git a/doc/development/database/batched_background_migrations.md b/doc/development/database/batched_background_migrations.md index f3ea82b5c61..b273d9c9529 100644 --- a/doc/development/database/batched_background_migrations.md +++ b/doc/development/database/batched_background_migrations.md @@ -186,6 +186,40 @@ Bump to the [import/export version](../../user/project/settings/import_export.md be required, if importing a project from a prior version of GitLab requires the data to be in the new format. +## Job arguments + +`BatchedMigrationJob` provides the `job_arguments` helper method for job classes to define the job arguments they need. + +Batched migrations scheduled with `queue_batched_background_migration` **must** use the helper to define the job arguments: + +```ruby +queue_batched_background_migration( + 'CopyColumnUsingBackgroundMigrationJob', + TABLE_NAME, + 'name', 'name_convert_to_text', + job_interval: DELAY_INTERVAL +) +``` + +In this example, `copy_from` returns `name`, and `copy_to` returns `name_convert_to_text`: + +```ruby +class CopyColumnUsingBackgroundMigrationJob < BatchedMigrationJob + job_arguments :copy_from, :copy_to + + def perform + from_column = connection.quote_column_name(copy_from) + to_column = connection.quote_column_name(copy_to) + + assignment_clause = "#{to_column} = #{from_column}" + + each_sub_batch(operation_name: :update_all) do |relation| + relation.update_all(assignment_clause) + end + end +end +``` + ## Example The `routes` table has a `source_type` field that's used for a polymorphic relationship. @@ -221,8 +255,6 @@ background migration. correctly handled by the batched migration framework. Any subclass of `BatchedMigrationJob` is initialized with necessary arguments to execute the batch, as well as a connection to the tracking database. - Additional `job_arguments` set on the migration are passed to the - job's `perform` method. 1. Add a new trigger to the database to update newly created and updated routes, similar to this example: diff --git a/doc/development/documentation/site_architecture/index.md b/doc/development/documentation/site_architecture/index.md index 1dadbaa7051..1e1ba45bd2a 100644 --- a/doc/development/documentation/site_architecture/index.md +++ b/doc/development/documentation/site_architecture/index.md @@ -257,7 +257,7 @@ If you don't specify `editor:`, the simple one is used by default. ## Algolia search engine -The docs site uses [Algolia DocSearch](https://community.algolia.com/docsearch/) +The docs site uses [Algolia DocSearch](https://docsearch.algolia.com/) for its search function. Learn more in . diff --git a/doc/development/fe_guide/style/vue.md b/doc/development/fe_guide/style/vue.md index 5c79d47e7b0..ae9330c3e3e 100644 --- a/doc/development/fe_guide/style/vue.md +++ b/doc/development/fe_guide/style/vue.md @@ -448,9 +448,9 @@ Typically, when testing a Vue component, the component should be "re-mounted" in To achieve this: 1. Create a mutable `wrapper` variable inside the top-level `describe` block. -1. Mount the component using [`mount`](https://vue-test-utils.vuejs.org/api/#mount)/ -[`shallowMount`](https://vue-test-utils.vuejs.org/api/#shallowMount). -1. Reassign the resulting [`Wrapper`](https://vue-test-utils.vuejs.org/api/wrapper/#wrapper) +1. Mount the component using [`mount`](https://v1.test-utils.vuejs.org/api/#mount)/ +[`shallowMount`](https://v1.test-utils.vuejs.org/api/#shallowMount). +1. Reassign the resulting [`Wrapper`](https://v1.test-utils.vuejs.org/api/wrapper/#wrapper) instance to our `wrapper` variable. Creating a global, mutable wrapper provides a number of advantages, including the ability to: @@ -476,8 +476,8 @@ Creating a global, mutable wrapper provides a number of advantages, including th To avoid duplicating our mounting logic, it's useful to define a `createComponent` factory function that we can reuse in each test block. This is a closure which should reassign our `wrapper` variable -to the result of [`mount`](https://vue-test-utils.vuejs.org/api/#mount) and -[`shallowMount`](https://vue-test-utils.vuejs.org/api/#shallowMount): +to the result of [`mount`](https://v1.test-utils.vuejs.org/api/#mount) and +[`shallowMount`](https://v1.test-utils.vuejs.org/api/#shallowMount): ```javascript import MyComponent from '~/path/to/my_component.vue'; @@ -579,9 +579,9 @@ the mounting function (`mount` or `shallowMount`) to be used to mount the compon ### Setting component state -1. Avoid using [`setProps`](https://vue-test-utils.vuejs.org/api/wrapper/#setprops) to set +1. Avoid using [`setProps`](https://v1.test-utils.vuejs.org/api/wrapper/#setprops) to set component state wherever possible. Instead, set the component's -[`propsData`](https://vue-test-utils.vuejs.org/api/options.html#propsdata) when mounting the component: +[`propsData`](https://v1.test-utils.vuejs.org/api/options.html#propsdata) when mounting the component: ```javascript // bad @@ -659,7 +659,7 @@ The goal of this accord is to make sure we are all on the same page. 1. If an outside jQuery Event needs to be listen to inside the Vue application, you may use jQuery event listeners. 1. We avoid adding new jQuery events when they are not required. Instead of adding new jQuery - events take a look at [different methods to do the same task](https://vuejs.org/v2/api/#vm-emit). + events take a look at [different methods to do the same task](https://v2.vuejs.org/v2/api/#vm-emit). 1. You may query the `window` object one time, while bootstrapping your application for application specific data (for example, `scrollTo` is ok to access anytime). Do this access during the bootstrapping of your application. diff --git a/doc/development/fe_guide/vue.md b/doc/development/fe_guide/vue.md index 7943ae119be..27660c0f5f7 100644 --- a/doc/development/fe_guide/vue.md +++ b/doc/development/fe_guide/vue.md @@ -71,7 +71,7 @@ component, is that you avoid creating a fixture or an HTML element in the unit t ##### `provide` and `inject` -Vue supports dependency injection through [`provide` and `inject`](https://vuejs.org/v2/api/#provide-inject). +Vue supports dependency injection through [`provide` and `inject`](https://v2.vuejs.org/v2/api/#provide-inject). In the component the `inject` configuration accesses the values `provide` passes down. This example of a Vue app initialization shows how the `provide` configuration passes a value from HAML to the component: @@ -266,7 +266,7 @@ return new Vue({ #### Accessing feature flags -Use the [`provide` and `inject`](https://vuejs.org/v2/api/#provide-inject) mechanisms +Use the [`provide` and `inject`](https://v2.vuejs.org/v2/api/#provide-inject) mechanisms in Vue to make feature flags available to any descendant components in a Vue application. The `glFeatures` object is already provided in `commons/vue.js`, so only the mixin is required to use the flags: @@ -339,7 +339,7 @@ Check this [page](vuex.md) for more details. ### Mixing Vue and JavaScript classes (in the data function) -In the [Vue documentation](https://vuejs.org/v2/api/#Options-Data) the Data function/object is defined as follows: +In the [Vue documentation](https://v2.vuejs.org/v2/api/#Options-Data) the Data function/object is defined as follows: > The data object for the Vue instance. Vue recursively converts its properties into getter/setters to make it "reactive". The object must be plain: native objects such as browser API objects and @@ -348,7 +348,7 @@ recommended to observe objects with their own stateful behavior. Based on the Vue guidance: -- **Do not** use or create a JavaScript class in your [data function](https://vuejs.org/v2/api/#data), +- **Do not** use or create a JavaScript class in your [data function](https://v2.vuejs.org/v2/api/#data), such as `user: new User()`. - **Do not** add new JavaScript class implementations. - **Do** use [GraphQL](../api_graphql_styleguide.md), [Vuex](vuex.md) or a set of components if @@ -531,7 +531,7 @@ Each Vue component has a unique output. This output is always present in the ren Although each method of a Vue component can be tested individually, our goal is to test the output of the render function, which represents the state at all times. -Visit the [Vue testing guide](https://vuejs.org/v2/guide/testing.html#Unit-Testing) for help +Visit the [Vue testing guide](https://v2.vuejs.org/v2/guide/testing.html#Unit-Testing) for help testing the rendered output. Here's an example of a well structured unit test for [this Vue component](#appendix---vue-component-subject-under-test): diff --git a/doc/development/github_importer.md b/doc/development/github_importer.md index 57cb74a6159..963350def80 100644 --- a/doc/development/github_importer.md +++ b/doc/development/github_importer.md @@ -72,7 +72,7 @@ This worker imports all pull requests. For every pull request a job for the ### 5. Stage::ImportPullRequestsMergedByWorker This worker imports the pull requests' _merged-by_ user information. The [_List pull -requests_](https://docs.github.com/en/rest/reference/pulls#list-pull-requests) +requests_](https://docs.github.com/en/rest/pulls#list-pull-requests) API doesn't provide this information. Therefore, this stage must fetch each merged pull request individually to import this information. A `Gitlab::GithubImport::ImportPullRequestMergedByWorker` job is scheduled for each fetched pull diff --git a/doc/development/gitlab_flavored_markdown/specification_guide/index.md b/doc/development/gitlab_flavored_markdown/specification_guide/index.md index c1f7dbf756b..756b87cd407 100644 --- a/doc/development/gitlab_flavored_markdown/specification_guide/index.md +++ b/doc/development/gitlab_flavored_markdown/specification_guide/index.md @@ -111,7 +111,7 @@ GFM and GLFM each have an official specification, which includes both: 1. Generic extensions to the CommonMark standard. For example, GFM adds the -[`strikethrough` extension](https://github.github.com/gfm/https://github.github.com/gfm/#strikethrough-extension-), +[`strikethrough` extension](https://github.github.com/gfm/#strikethrough-extension-), and GLFM adds the [`color chips` extension](../../../user/markdown.md#colors). These extensions in the official specifications are not dependent upon any specific diff --git a/doc/development/integrations/index.md b/doc/development/integrations/index.md index 5d1bd5ad61c..0387ba2e4dd 100644 --- a/doc/development/integrations/index.md +++ b/doc/development/integrations/index.md @@ -273,7 +273,7 @@ When developing a new integration, we also recommend you gate the availability b You can provide help text in the integration form, including links to off-site documentation, as described above in [Customize the frontend form](#customize-the-frontend-form). Refer to -our [usability guidelines](https://design.gitlab.com/usability/helping-users) for help text. +our [usability guidelines](https://design.gitlab.com/usability/helping-users/) for help text. For more detailed documentation, provide a page in `doc/user/project/integrations`, and link it from the [Integrations overview](../../user/project/integrations/index.md). diff --git a/doc/development/integrations/secure.md b/doc/development/integrations/secure.md index 974ed9d6aeb..37ab71e2b34 100644 --- a/doc/development/integrations/secure.md +++ b/doc/development/integrations/secure.md @@ -500,7 +500,7 @@ We recommend that you use the identifiers the GitLab scanners already define: | [ELSA](https://linux.oracle.com/security/) | `elsa` | ELSA-2020-0085 | | [OSVD](https://cve.mitre.org/data/refs/refmap/source-OSVDB.html) | `osvdb` | OSVDB-113928 | | [OWASP](https://owasp.org/Top10/) | `owasp` | A01:2021–Broken Access Control Design | -| [RHSA](https://access.redhat.com/errata/#/) | `rhsa` | RHSA-2020:0111 | +| [RHSA](https://access.redhat.com/errata-search/#/) | `rhsa` | RHSA-2020:0111 | | [USN](https://ubuntu.com/security/notices) | `usn` | USN-4234-1 | | [WASC](http://projects.webappsec.org/Threat-Classification-Reference-Grid) | `wasc` | WASC-19 | diff --git a/doc/development/merge_request_concepts/index.md b/doc/development/merge_request_concepts/index.md index 1320cd6f9f3..f8a367ac328 100644 --- a/doc/development/merge_request_concepts/index.md +++ b/doc/development/merge_request_concepts/index.md @@ -34,7 +34,7 @@ This area of the merge request is where all of the options and commit messages a Reports are widgets within the merge request that report information about changes within the merge request. These widgets provide information to better help the author understand the changes and further improvements to the proposed changes. -[Design Documentation](https://design.gitlab.com/regions/merge-request-reports) +[Design Documentation](https://design.gitlab.com/regions/merge-request-reports/) ![merge request reports](../img/merge_request_reports_v14_7.png) diff --git a/doc/development/secure_coding_guidelines.md b/doc/development/secure_coding_guidelines.md index 9048da77071..8053b4285e6 100644 --- a/doc/development/secure_coding_guidelines.md +++ b/doc/development/secure_coding_guidelines.md @@ -196,7 +196,7 @@ Go's [`regexp`](https://pkg.go.dev/regexp) package uses `re2` and isn't vulnerab - [Rubular](https://rubular.com/) is a nice online tool to fiddle with Ruby Regexps. - [Runaway Regular Expressions](https://www.regular-expressions.info/catastrophic.html) -- [The impact of regular expression denial of service (ReDoS) in practice: an empirical study at the ecosystem scale](https://people.cs.vt.edu/~davisjam/downloads/publications/DavisCoghlanServantLee-EcosystemREDOS-ESECFSE18.pdf). This research paper discusses approaches to automatically detect ReDoS vulnerabilities. +- [The impact of regular expression denial of service (ReDoS) in practice: an empirical study at the ecosystem scale](https://davisjam.github.io/files/publications/DavisCoghlanServantLee-EcosystemREDOS-ESECFSE18.pdf). This research paper discusses approaches to automatically detect ReDoS vulnerabilities. - [Freezing the web: A study of ReDoS vulnerabilities in JavaScript-based web servers](https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-staicu.pdf). Another research paper about detecting ReDoS vulnerabilities. ## Server Side Request Forgery (SSRF) diff --git a/doc/development/service_ping/implement.md b/doc/development/service_ping/implement.md index 9a4f4e52241..bca47338c40 100644 --- a/doc/development/service_ping/implement.md +++ b/doc/development/service_ping/implement.md @@ -271,7 +271,7 @@ Arguments: Example of implementation: -Using Redis methods [`INCR`](https://redis.io/commands/incr), [`GET`](https://redis.io/commands/get), and [`Gitlab::UsageDataCounters::WikiPageCounter`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/wiki_page_counter.rb) +Using Redis methods [`INCR`](https://redis.io/commands/incr/), [`GET`](https://redis.io/commands/get/), and [`Gitlab::UsageDataCounters::WikiPageCounter`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/wiki_page_counter.rb) ##### `UsageData` API @@ -316,7 +316,7 @@ Enabled by default in GitLab 13.7 and later. #### Redis HLL counters WARNING: -HyperLogLog (HLL) is a probabilistic algorithm and its **results always includes some small error**. According to [Redis documentation](https://redis.io/commands/pfcount), data from +HyperLogLog (HLL) is a probabilistic algorithm and its **results always includes some small error**. According to [Redis documentation](https://redis.io/commands/pfcount/), data from used HLL implementation is "approximated with a standard error of 0.81%". NOTE: @@ -324,7 +324,7 @@ NOTE: With `Gitlab::UsageDataCounters::HLLRedisCounter` we have available data structures used to count unique values. -Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd) and [PFCOUNT](https://redis.io/commands/pfcount). +Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd/) and [PFCOUNT](https://redis.io/commands/pfcount/). ##### Add new events diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md index fcb8c20bdd3..d8a3f86685e 100644 --- a/doc/development/shell_commands.md +++ b/doc/development/shell_commands.md @@ -17,7 +17,7 @@ These guidelines are meant to make your code more reliable _and_ secure. ## Use File and FileUtils instead of shell commands -Sometimes we invoke basic Unix commands via the shell when there is also a Ruby API for doing it. Use the Ruby API if it exists. +Sometimes we invoke basic Unix commands via the shell when there is also a Ruby API for doing it. Use [the Ruby API](https://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html#module-FileUtils-label-Module+Functions) if it exists. ```ruby # Wrong diff --git a/doc/development/snowplow/implementation.md b/doc/development/snowplow/implementation.md index f8e37aee1e0..9a923b115a2 100644 --- a/doc/development/snowplow/implementation.md +++ b/doc/development/snowplow/implementation.md @@ -431,7 +431,7 @@ To test backend Snowplow events, use the `expect_snowplow_event` helper. For mor ### Performance -We use the [AsyncEmitter](https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/ruby-tracker/emitters/#the-asyncemitter-class) when tracking events, which allows for instrumentation calls to be run in a background thread. This is still an active area of development. +We use the [AsyncEmitter](https://snowplow.github.io/snowplow-ruby-tracker/SnowplowTracker/AsyncEmitter.html) when tracking events, which allows for instrumentation calls to be run in a background thread. This is still an active area of development. ## Develop and test Snowplow diff --git a/doc/development/stage_group_observability/dashboards/stage_group_dashboard.md b/doc/development/stage_group_observability/dashboards/stage_group_dashboard.md index c1831cfce69..c8c18b93a8f 100644 --- a/doc/development/stage_group_observability/dashboards/stage_group_dashboard.md +++ b/doc/development/stage_group_observability/dashboards/stage_group_dashboard.md @@ -56,7 +56,7 @@ description, note the following: To inspect the raw data of the panel for further calculation, select **Inspect** from the dropdown list of a panel. Queries, raw data, and panel JSON structure are available. -Read more at [Grafana panel inspection](https://grafana.com/docs/grafana/latest/panels/inspect-panel/). +Read more at [Grafana panel inspection](http://grafana.com/docs/grafana/next/panels/query-a-data-source/). All the dashboards are powered by [Grafana](https://grafana.com/), a frontend for displaying metrics. Grafana consumes the data returned from queries to backend Prometheus data source, then presents it diff --git a/doc/development/testing_guide/end_to_end/index.md b/doc/development/testing_guide/end_to_end/index.md index 06359d612ad..b2d9ea85b05 100644 --- a/doc/development/testing_guide/end_to_end/index.md +++ b/doc/development/testing_guide/end_to_end/index.md @@ -235,7 +235,7 @@ Each type of scheduled pipeline generates a static link for the latest test repo - [`staging-sanity`](https://storage.googleapis.com/gitlab-qa-allure-reports/staging-sanity/master/index.html) - [`staging-sanity-no-admin`](https://storage.googleapis.com/gitlab-qa-allure-reports/staging-sanity-no-admin/master/index.html) - [`canary-sanity`](https://storage.googleapis.com/gitlab-qa-allure-reports/canary-sanity/master/index.html) -- [`production`](https://storage.googleapis.com/gitlab-qa-allure-reports/production/master/index.html) +- [`production`](https://storage.googleapis.com/gitlab-qa-allure-reports/production-full/master/index.html) - [`production-sanity`](https://storage.googleapis.com/gitlab-qa-allure-reports/production-sanity/master/index.html) ## How do I run the tests? diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md index d91c53823e2..9410c2f07a5 100644 --- a/doc/development/testing_guide/frontend_testing.md +++ b/doc/development/testing_guide/frontend_testing.md @@ -466,7 +466,7 @@ it('waits for an Ajax call', () => { #### Vue rendering -Use [`nextTick()`](https://vuejs.org/v2/api/#Vue-nextTick) to wait until a Vue component is +Use [`nextTick()`](https://v2.vuejs.org/v2/api/#Vue-nextTick) to wait until a Vue component is re-rendered. **in Jest:** diff --git a/doc/development/testing_guide/review_apps.md b/doc/development/testing_guide/review_apps.md index 532bb9fcdef..b272d23522e 100644 --- a/doc/development/testing_guide/review_apps.md +++ b/doc/development/testing_guide/review_apps.md @@ -25,7 +25,7 @@ For any of the following scenarios, the `start-review-app-pipeline` job would be On every [pipeline](https://gitlab.com/gitlab-org/gitlab/pipelines/125315730) in the `qa` stage (which comes after the `review` stage), the `review-qa-smoke` and `review-qa-reliable` jobs are automatically started. The `review-qa-smoke` runs -the QA smoke suite and the `review-qa-reliable` executes E2E tests identified as [reliable](https://about.gitlab.com/handbook/engineering/quality/quality-engineering/reliable-tests). +the QA smoke suite and the `review-qa-reliable` executes E2E tests identified as [reliable](https://about.gitlab.com/handbook/engineering/quality/quality-engineering/reliable-tests/). `review-qa-*` jobs ensure that end-to-end tests for the changes in the merge request pass in a live environment. This shifts the identification of e2e failures from an environment on the path to production to the merge request, to prevent breaking features on GitLab.com or costly GitLab.com deployment blockers. `review-qa-*` failures should be investigated with counterpart SET involvement if needed to help determine the root cause of the error. diff --git a/doc/development/testing_guide/testing_levels.md b/doc/development/testing_guide/testing_levels.md index 02f32a031dc..c1bf3609b53 100644 --- a/doc/development/testing_guide/testing_levels.md +++ b/doc/development/testing_guide/testing_levels.md @@ -115,7 +115,7 @@ graph RL Testing the value of a constant means copying it, resulting in extra effort without additional confidence that the value is correct. - **Vue components**: Computed properties, methods, and lifecycle hooks can be considered an implementation detail of components, are implicitly covered by component tests, and don't need to be tested. - For more information, see the [official Vue guidelines](https://vue-test-utils.vuejs.org/guides/#getting-started). + For more information, see the [official Vue guidelines](https://v1.test-utils.vuejs.org/guides/#getting-started). #### What to mock in unit tests @@ -208,7 +208,7 @@ graph RL Similar to unit tests, background operations cannot be stopped or waited on. This means they continue running in the following tests and cause side effects. - **Child components**: Every component is tested individually, so child components are mocked. - See also [`shallowMount()`](https://vue-test-utils.vuejs.org/api/#shallowmount) + See also [`shallowMount()`](https://v1.test-utils.vuejs.org/api/#shallowmount) #### What *not* to mock in component tests diff --git a/doc/development/workhorse/configuration.md b/doc/development/workhorse/configuration.md index b86bb824ea1..f71a0b345e0 100644 --- a/doc/development/workhorse/configuration.md +++ b/doc/development/workhorse/configuration.md @@ -211,7 +211,7 @@ Workhorse supports distributed tracing through [LabKit](https://gitlab.com/gitla using [OpenTracing APIs](https://opentracing.io). By default, no tracing implementation is linked into the binary. You can link in -different OpenTracing providers with [build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints) +different OpenTracing providers with [build tags](https://pkg.go.dev/go/build#hdr-Build_Constraints) or build constraints by setting the `BUILD_TAGS` make variable. For more details of the supported providers, refer to LabKit. For an example of @@ -278,9 +278,9 @@ trusted_cidrs_for_x_forwarded_for = ["10.0.0.0/8", "127.0.0.1/32"] ## Continuous profiling Workhorse supports continuous profiling through [LabKit](https://gitlab.com/gitlab-org/labkit/) -using [Stackdriver Profiler](https://cloud.google.com/profiler). By default, the +using [Stackdriver Profiler](https://cloud.google.com/products/operations). By default, the Stackdriver Profiler implementation is linked in the binary using -[build tags](https://golang.org/pkg/go/build/#hdr-Build_Constraints), though it's not +[build tags](https://pkg.go.dev/go/build#hdr-Build_Constraints), though it's not required and can be skipped. For example: ```shell diff --git a/doc/development/workhorse/gitlab_features.md b/doc/development/workhorse/gitlab_features.md index 365cc7991d8..3b240d4cbc6 100644 --- a/doc/development/workhorse/gitlab_features.md +++ b/doc/development/workhorse/gitlab_features.md @@ -70,4 +70,4 @@ memory than it costs to have Workhorse look after it. - Workhorse does not clean up idle client connections. - We assume that all requests to Rails pass through Workhorse. -For more information see ['A brief history of GitLab Workhorse'](https://about.gitlab.com/2016/04/12/a-brief-history-of-gitlab-workhorse/). +For more information see ['A brief history of GitLab Workhorse'](https://about.gitlab.com/blog/2016/04/12/a-brief-history-of-gitlab-workhorse/). diff --git a/doc/development/workhorse/index.md b/doc/development/workhorse/index.md index 3aa7e945f53..de3636fa112 100644 --- a/doc/development/workhorse/index.md +++ b/doc/development/workhorse/index.md @@ -21,7 +21,7 @@ but that repository is no longer used for development. ## Install Workhorse -To install GitLab Workhorse you need [Go 1.15 or newer](https://golang.org/dl) and +To install GitLab Workhorse you need [Go 1.15 or newer](https://go.dev/dl) and [GNU Make](https://www.gnu.org/software/make/). To install into `/usr/local/bin` run `make install`. @@ -44,7 +44,7 @@ On some operating systems, such as FreeBSD, you may have to use ### Run time dependencies -Workhorse uses [ExifTool](https://www.sno.phy.queensu.ca/~phil/exiftool/) for +Workhorse uses [ExifTool](https://exiftool.org/) for removing EXIF data (which may contain sensitive information) from uploaded images. If you installed GitLab: diff --git a/doc/install/installation.md b/doc/install/installation.md index 2f2ae016edd..cb48ef5abc9 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -1064,7 +1064,7 @@ See the [OmniAuth integration documentation](../integration/omniauth.md). ### Build your projects GitLab can build your projects. To enable that feature, you need runners to do that for you. -See the [GitLab Runner section](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/#gitlab-runner) to install it. +See the [GitLab Runner section](https://docs.gitlab.com/runner/) to install it. ### Adding your Trusted Proxies diff --git a/doc/integration/saml.md b/doc/integration/saml.md index 8a900975a3a..5906d330a0e 100644 --- a/doc/integration/saml.md +++ b/doc/integration/saml.md @@ -801,8 +801,6 @@ If you have any questions on configuring the SAML app, please contact your provi ### Okta setup notes -The following guidance is based on this Okta article, on adding a [SAML Application with an Okta Developer account](https://support.okta.com/help/s/article/Why-can-t-I-add-a-SAML-Application-with-an-Okta-Developer-account?language=en_US): - 1. In the Okta administrator section, make sure to select Classic UI view in the top left corner. From there, choose to **Add an App**. 1. When the app screen comes up you see another button to **Create an App** and choose SAML 2.0 on the next screen. diff --git a/doc/integration/security_partners/index.md b/doc/integration/security_partners/index.md index 50a7b3b717b..4d08ddec73d 100644 --- a/doc/integration/security_partners/index.md +++ b/doc/integration/security_partners/index.md @@ -12,7 +12,7 @@ each security partner: -- [Anchore](https://docs.anchore.com/current/docs/using/integration/ci_cd/gitlab/) +- [Anchore](https://docs.anchore.com/current/docs/configuration/integration/ci_cd/gitlab/) - [Bridgecrew](https://docs.bridgecrew.io/docs/integrate-with-gitlab-self-managed) - [Checkmarx](https://checkmarx.atlassian.net/wiki/spaces/SD/pages/1929937052/GitLab+Integration) - [Deepfactor](https://docs.deepfactor.io/hc/en-us/articles/1500008981941) diff --git a/doc/topics/autodevops/index.md b/doc/topics/autodevops/index.md index 6d4f6eb698e..dc58f42f30e 100644 --- a/doc/topics/autodevops/index.md +++ b/doc/topics/autodevops/index.md @@ -267,7 +267,10 @@ The GitLab integration with Helm does not support installing applications when behind a proxy. To do so, inject proxy settings into the installation pods at runtime. -For example, you can use a [`PodPreset`](https://v1-19.docs.kubernetes.io/docs/concepts/workloads/pods/podpreset/): +For example, you can use a `PodPreset`: + +NOTE: +[PodPreset was removed in Kubernetes v1.20](https://github.com/kubernetes/kubernetes/pull/94090). ```yaml apiVersion: settings.k8s.io/v1alpha1 diff --git a/doc/user/application_security/dast/checks/601.1.md b/doc/user/application_security/dast/checks/601.1.md index 60249c2562d..c51b00cdd36 100644 --- a/doc/user/application_security/dast/checks/601.1.md +++ b/doc/user/application_security/dast/checks/601.1.md @@ -30,5 +30,5 @@ then be used to redirect the user, using the 301 response code and `Location` he ## Links -- [OWASP](https://owasp.org/www-project-cheat-sheets/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) +- [OWASP](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) - [CWE](https://cwe.mitre.org/data/definitions/601.html) diff --git a/doc/user/project/quick_actions.md b/doc/user/project/quick_actions.md index 96e51b061ee..216d040734d 100644 --- a/doc/user/project/quick_actions.md +++ b/doc/user/project/quick_actions.md @@ -56,6 +56,7 @@ threads. Some quick actions might not be available to all subscription tiers. | `/assign_reviewer @user1 @user2` or `/reviewer @user1 @user2` or `/request_review @user1 @user2` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign one or more users as reviewers. | | `/assign_reviewer me` or `/reviewer me` or `/request_review me` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign yourself as a reviewer. | | `/award :emoji:` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Toggle emoji award. | +| `/cc @user` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Mention a user. In GitLab 15.0 and later, this command performs no action. You can instead type `CC @user` or only `@user`. [In GitLab 14.9 and earlier](https://gitlab.com/gitlab-org/gitlab/-/issues/31200), mentioning a user at the start of a line created a specific type of to-do item notification. | | `/child_epic ` | **{dotted-circle}** No | **{dotted-circle}** No | **{check-circle}** Yes | Add child epic to ``. The `` value should be in the format of `&epic`, `group&epic`, or a URL to an epic ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7330) in GitLab 12.0). | | `/clear_health_status` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Clear [health status](issues/managing_issues.md#health-status) ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/213814) in GitLab 14.7). | | `/clear_weight` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Clear weight. | diff --git a/lib/gitlab/background_migration/backfill_group_features.rb b/lib/gitlab/background_migration/backfill_group_features.rb index 4c3af7be319..35b5282360f 100644 --- a/lib/gitlab/background_migration/backfill_group_features.rb +++ b/lib/gitlab/background_migration/backfill_group_features.rb @@ -4,19 +4,21 @@ module Gitlab module BackgroundMigration # Backfill group_features for an array of groups class BackfillGroupFeatures < ::Gitlab::BackgroundMigration::BatchedMigrationJob - def perform(batch_size) + job_arguments :batch_size + + def perform each_sub_batch( operation_name: :upsert_group_features, batching_arguments: { order_hint: :type }, batching_scope: ->(relation) { relation.where(type: 'Group') } ) do |sub_batch| - upsert_group_features(sub_batch, batch_size) + upsert_group_features(sub_batch) end end private - def upsert_group_features(relation, batch_size) + def upsert_group_features(relation) connection.execute( <<~SQL INSERT INTO group_features (group_id, created_at, updated_at) diff --git a/lib/gitlab/background_migration/batched_migration_job.rb b/lib/gitlab/background_migration/batched_migration_job.rb index c47b1735ccf..711c6ac35a9 100644 --- a/lib/gitlab/background_migration/batched_migration_job.rb +++ b/lib/gitlab/background_migration/batched_migration_job.rb @@ -3,22 +3,36 @@ module Gitlab module BackgroundMigration # Base class for batched background migrations. Subclasses should implement the `#perform` - # method as the entry point for the job's execution, which will be called with the migration - # arguments (if any). + # method as the entry point for the job's execution. + # + # Job arguments needed must be defined explicitly, + # see https://docs.gitlab.com/ee/development/database/batched_background_migrations.html#job-arguments. class BatchedMigrationJob include Gitlab::Database::DynamicModelHelpers - def initialize(start_id:, end_id:, batch_table:, batch_column:, sub_batch_size:, pause_ms:, connection:) + def initialize( + start_id:, end_id:, batch_table:, batch_column:, sub_batch_size:, pause_ms:, job_arguments: [], connection: + ) + @start_id = start_id @end_id = end_id @batch_table = batch_table @batch_column = batch_column @sub_batch_size = sub_batch_size @pause_ms = pause_ms + @job_arguments = job_arguments @connection = connection end - def perform(*job_arguments) + def self.job_arguments(*args) + args.each.with_index do |arg, index| + define_method(arg) do + @job_arguments[index] + end + end + end + + def perform raise NotImplementedError, "subclasses of #{self.class.name} must implement #{__method__}" end diff --git a/lib/gitlab/background_migration/copy_column_using_background_migration_job.rb b/lib/gitlab/background_migration/copy_column_using_background_migration_job.rb index 826845935b8..15e54431a44 100644 --- a/lib/gitlab/background_migration/copy_column_using_background_migration_job.rb +++ b/lib/gitlab/background_migration/copy_column_using_background_migration_job.rb @@ -14,7 +14,9 @@ module Gitlab # - The table that is migrated does _not_ need `id` as the primary key # We use the provided primary_key column to perform the update. class CopyColumnUsingBackgroundMigrationJob < BatchedMigrationJob - def perform(copy_from, copy_to) + job_arguments :copy_from, :copy_to + + def perform assignment_clauses = build_assignment_clauses(copy_from, copy_to) each_sub_batch(operation_name: :update_all) do |relation| diff --git a/lib/gitlab/database/background_migration/batched_migration_wrapper.rb b/lib/gitlab/database/background_migration/batched_migration_wrapper.rb index 5f4b2be3da8..ad747a8131d 100644 --- a/lib/gitlab/database/background_migration/batched_migration_wrapper.rb +++ b/lib/gitlab/database/background_migration/batched_migration_wrapper.rb @@ -64,9 +64,10 @@ module Gitlab batch_column: tracking_record.migration_column_name, sub_batch_size: tracking_record.sub_batch_size, pause_ms: tracking_record.pause_ms, + job_arguments: tracking_record.migration_job_arguments, connection: connection) - job_instance.perform(*tracking_record.migration_job_arguments) + job_instance.perform job_instance end diff --git a/spec/frontend/work_items/components/work_item_links/work_item_links_menu_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_links_menu_spec.js index 69316b7f0ca..287ec022d3f 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_links_menu_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_links_menu_spec.js @@ -1,75 +1,24 @@ -import Vue from 'vue'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; -import { cloneDeep } from 'lodash'; -import VueApollo from 'vue-apollo'; -import createMockApollo from 'helpers/mock_apollo_helper'; + import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import waitForPromises from 'helpers/wait_for_promises'; import WorkItemLinksMenu from '~/work_items/components/work_item_links/work_item_links_menu.vue'; -import changeWorkItemParentMutation from '~/work_items/graphql/update_work_item.mutation.graphql'; -import getWorkItemLinksQuery from '~/work_items/graphql/work_item_links.query.graphql'; -import { WIDGET_TYPE_HIERARCHY } from '~/work_items/constants'; -import { workItemHierarchyResponse, changeWorkItemParentMutationResponse } from '../../mock_data'; - -Vue.use(VueApollo); - -const PARENT_ID = 'gid://gitlab/WorkItem/1'; -const WORK_ITEM_ID = 'gid://gitlab/WorkItem/3'; describe('WorkItemLinksMenu', () => { let wrapper; - let mockApollo; - const $toast = { - show: jest.fn(), - }; - - const createComponent = async ({ - data = {}, - mutationHandler = jest.fn().mockResolvedValue(changeWorkItemParentMutationResponse), - } = {}) => { - mockApollo = createMockApollo([ - [getWorkItemLinksQuery, jest.fn().mockResolvedValue(workItemHierarchyResponse)], - [changeWorkItemParentMutation, mutationHandler], - ]); - - mockApollo.clients.defaultClient.cache.writeQuery({ - query: getWorkItemLinksQuery, - variables: { - id: PARENT_ID, - }, - data: workItemHierarchyResponse.data, - }); - - wrapper = shallowMountExtended(WorkItemLinksMenu, { - data() { - return { - ...data, - }; - }, - propsData: { - workItemId: WORK_ITEM_ID, - parentWorkItemId: PARENT_ID, - }, - apolloProvider: mockApollo, - mocks: { - $toast, - }, - }); - - await waitForPromises(); + const createComponent = () => { + wrapper = shallowMountExtended(WorkItemLinksMenu); }; const findDropdown = () => wrapper.find(GlDropdown); const findRemoveDropdownItem = () => wrapper.find(GlDropdownItem); beforeEach(async () => { - await createComponent(); + createComponent(); }); afterEach(() => { wrapper.destroy(); - mockApollo = null; }); it('renders dropdown and dropdown items', () => { @@ -77,69 +26,9 @@ describe('WorkItemLinksMenu', () => { expect(findRemoveDropdownItem().exists()).toBe(true); }); - it('calls correct mutation with correct variables', async () => { - const mutationHandler = jest.fn().mockResolvedValue(changeWorkItemParentMutationResponse); - - createComponent({ mutationHandler }); - + it('emits removeChild event on click Remove', () => { findRemoveDropdownItem().vm.$emit('click'); - await waitForPromises(); - - expect(mutationHandler).toHaveBeenCalledWith({ - input: { - id: WORK_ITEM_ID, - hierarchyWidget: { - parentId: null, - }, - }, - }); - }); - - it('shows toast when mutation succeeds', async () => { - const mutationHandler = jest.fn().mockResolvedValue(changeWorkItemParentMutationResponse); - - createComponent({ mutationHandler }); - - findRemoveDropdownItem().vm.$emit('click'); - - await waitForPromises(); - - expect($toast.show).toHaveBeenCalledWith('Child removed', { - action: { onClick: expect.anything(), text: 'Undo' }, - }); - }); - - it('updates the cache when mutation succeeds', async () => { - const mutationHandler = jest.fn().mockResolvedValue(changeWorkItemParentMutationResponse); - - createComponent({ mutationHandler }); - - mockApollo.clients.defaultClient.cache.readQuery = jest.fn( - () => workItemHierarchyResponse.data, - ); - - mockApollo.clients.defaultClient.cache.writeQuery = jest.fn(); - - findRemoveDropdownItem().vm.$emit('click'); - - await waitForPromises(); - - // Remove the work item from parent's children - const resp = cloneDeep(workItemHierarchyResponse); - const index = resp.data.workItem.widgets - .find((widget) => widget.type === WIDGET_TYPE_HIERARCHY) - .children.nodes.findIndex((child) => child.id === WORK_ITEM_ID); - resp.data.workItem.widgets - .find((widget) => widget.type === WIDGET_TYPE_HIERARCHY) - .children.nodes.splice(index, 1); - - expect(mockApollo.clients.defaultClient.cache.writeQuery).toHaveBeenCalledWith( - expect.objectContaining({ - query: expect.anything(), - variables: { id: PARENT_ID }, - data: resp.data, - }), - ); + expect(wrapper.emitted('removeChild')).toHaveLength(1); }); }); diff --git a/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js index 3b780bcc5bc..a89815d05ab 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js @@ -1,28 +1,70 @@ import Vue, { nextTick } from 'vue'; import { GlBadge } from '@gitlab/ui'; +import { cloneDeep } from 'lodash'; import VueApollo from 'vue-apollo'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import WorkItemLinks from '~/work_items/components/work_item_links/work_item_links.vue'; +import changeWorkItemParentMutation from '~/work_items/graphql/update_work_item.mutation.graphql'; +import { WIDGET_TYPE_HIERARCHY } from '~/work_items/constants'; import getWorkItemLinksQuery from '~/work_items/graphql/work_item_links.query.graphql'; import { workItemHierarchyResponse, workItemHierarchyEmptyResponse, workItemHierarchyNoUpdatePermissionResponse, + changeWorkItemParentMutationResponse, } from '../../mock_data'; Vue.use(VueApollo); describe('WorkItemLinks', () => { let wrapper; + let mockApollo; + + const PARENT_ID = 'gid://gitlab/WorkItem/1'; + const WORK_ITEM_ID = 'gid://gitlab/WorkItem/2'; + + const $toast = { + show: jest.fn(), + }; + + const mutationChangeParentHandler = jest + .fn() + .mockResolvedValue(changeWorkItemParentMutationResponse); + + const createComponent = async ({ + data = {}, + response = workItemHierarchyResponse, + mutationHandler = mutationChangeParentHandler, + } = {}) => { + mockApollo = createMockApollo([ + [getWorkItemLinksQuery, jest.fn().mockResolvedValue(response)], + [changeWorkItemParentMutation, mutationHandler], + ]); + + mockApollo.clients.defaultClient.cache.writeQuery({ + query: getWorkItemLinksQuery, + variables: { + id: PARENT_ID, + }, + data: response.data, + }); - const createComponent = async ({ response = workItemHierarchyResponse } = {}) => { wrapper = shallowMountExtended(WorkItemLinks, { - apolloProvider: createMockApollo([ - [getWorkItemLinksQuery, jest.fn().mockResolvedValue(response)], - ]), + data() { + return { + ...data, + }; + }, + provide: { + projectPath: 'project/path', + }, propsData: { issuableId: 1 }, + apolloProvider: mockApollo, + mocks: { + $toast, + }, }); await waitForPromises(); @@ -41,6 +83,7 @@ describe('WorkItemLinks', () => { afterEach(() => { wrapper.destroy(); + mockApollo = null; }); it('is expanded by default', () => { @@ -103,4 +146,63 @@ describe('WorkItemLinks', () => { expect(findFirstLinksMenu().exists()).toBe(false); }); }); + + describe('remove child', () => { + beforeEach(async () => { + await createComponent({ mutationHandler: mutationChangeParentHandler }); + mockApollo.clients.defaultClient.cache.readQuery = jest.fn( + () => workItemHierarchyResponse.data, + ); + + mockApollo.clients.defaultClient.cache.writeQuery = jest.fn(); + }); + + it('calls correct mutation with correct variables', async () => { + findFirstLinksMenu().vm.$emit('removeChild'); + + await waitForPromises(); + + expect(mutationChangeParentHandler).toHaveBeenCalledWith({ + input: { + id: WORK_ITEM_ID, + hierarchyWidget: { + parentId: null, + }, + }, + }); + }); + + it('shows toast when mutation succeeds', async () => { + findFirstLinksMenu().vm.$emit('removeChild'); + + await waitForPromises(); + + expect($toast.show).toHaveBeenCalledWith('Child removed', { + action: { onClick: expect.anything(), text: 'Undo' }, + }); + }); + + it('updates the cache when mutation succeeds', async () => { + findFirstLinksMenu().vm.$emit('removeChild'); + + await waitForPromises(); + + // Remove the work item from parent's children + const resp = cloneDeep(workItemHierarchyResponse); + const index = resp.data.workItem.widgets + .find((widget) => widget.type === WIDGET_TYPE_HIERARCHY) + .children.nodes.findIndex((child) => child.id === WORK_ITEM_ID); + resp.data.workItem.widgets + .find((widget) => widget.type === WIDGET_TYPE_HIERARCHY) + .children.nodes.splice(index, 1); + + expect(mockApollo.clients.defaultClient.cache.writeQuery).toHaveBeenCalledWith( + expect.objectContaining({ + query: expect.anything(), + variables: { id: PARENT_ID }, + data: resp.data, + }), + ); + }); + }); }); diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js index 050d3c56727..c7105533ea7 100644 --- a/spec/frontend/work_items/mock_data.js +++ b/spec/frontend/work_items/mock_data.js @@ -335,6 +335,7 @@ export const workItemHierarchyEmptyResponse = { }, title: 'New title', userPermissions: { + deleteWorkItem: false, updateWorkItem: false, }, confidential: false, @@ -368,6 +369,7 @@ export const workItemHierarchyNoUpdatePermissionResponse = { }, title: 'New title', userPermissions: { + deleteWorkItem: false, updateWorkItem: false, }, confidential: false, @@ -412,6 +414,7 @@ export const workItemHierarchyResponse = { }, title: 'New title', userPermissions: { + deleteWorkItem: true, updateWorkItem: true, }, confidential: false, diff --git a/spec/lib/gitlab/background_migration/backfill_group_features_spec.rb b/spec/lib/gitlab/background_migration/backfill_group_features_spec.rb index d84bc479554..e0be5a785b8 100644 --- a/spec/lib/gitlab/background_migration/backfill_group_features_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_group_features_spec.rb @@ -13,6 +13,7 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillGroupFeatures, :migration, s batch_column: :id, sub_batch_size: 10, pause_ms: 0, + job_arguments: [4], connection: ActiveRecord::Base.connection) end @@ -27,7 +28,7 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillGroupFeatures, :migration, s group_features.create!(id: 1, group_id: 4) expect(group_features.count).to eq 1 - expect { subject.perform(4) }.to change { group_features.count }.by(2) + expect { subject.perform }.to change { group_features.count }.by(2) expect(group_features.count).to eq 3 expect(group_features.all.pluck(:group_id)).to contain_exactly(1, 3, 4) diff --git a/spec/lib/gitlab/background_migration/batched_migration_job_spec.rb b/spec/lib/gitlab/background_migration/batched_migration_job_spec.rb index 98866bb765f..859186abc60 100644 --- a/spec/lib/gitlab/background_migration/batched_migration_job_spec.rb +++ b/spec/lib/gitlab/background_migration/batched_migration_job_spec.rb @@ -3,6 +3,31 @@ require 'spec_helper' RSpec.describe Gitlab::BackgroundMigration::BatchedMigrationJob do + let(:connection) { Gitlab::Database.database_base_models[:main].connection } + + describe '.job_arguments' do + let(:job_class) do + Class.new(described_class) do + job_arguments :value_a, :value_b + end + end + + subject(:job_instance) do + job_class.new(start_id: 1, end_id: 10, + batch_table: '_test_table', + batch_column: 'id', + sub_batch_size: 2, + pause_ms: 1000, + job_arguments: %w(a b), + connection: connection) + end + + it 'defines methods' do + expect(job_instance.value_a).to eq('a') + expect(job_instance.value_b).to eq('b') + end + end + describe '#perform' do let(:connection) { Gitlab::Database.database_base_models[:main].connection } @@ -23,6 +48,14 @@ RSpec.describe Gitlab::BackgroundMigration::BatchedMigrationJob do expect { perform_job }.to raise_error(NotImplementedError, /must implement perform/) end + it 'expects descendants to have the same method signature', :eager_load do + expected_arity = described_class.instance_method(:perform).arity + offences = described_class.descendants.select { |klass| klass.instance_method(:perform).arity != expected_arity } + + expect(offences).to be_empty, "expected no descendants of #{described_class} to accept arguments for #perform, " \ + "but some do: #{offences.join(", ")}" + end + context 'when the subclass uses sub-batching' do let(:job_class) do Class.new(described_class) do diff --git a/spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb b/spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb index 78bd1afd8d2..9c33100a0b3 100644 --- a/spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb +++ b/spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb @@ -16,6 +16,7 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo ActiveRecord::Migration.new.extend(Gitlab::Database::MigrationHelpers) end + let(:job_arguments) { %w(name name_convert_to_text) } let(:copy_job) do described_class.new(start_id: 12, end_id: 20, @@ -23,6 +24,7 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo batch_column: 'id', sub_batch_size: sub_batch_size, pause_ms: pause_ms, + job_arguments: job_arguments, connection: connection) end @@ -53,32 +55,42 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo SQL end - it 'copies all primary keys in range' do - temporary_column = helpers.convert_to_bigint_column(:id) + context 'primary keys' do + let(:temporary_column) { helpers.convert_to_bigint_column(:id) } + let(:job_arguments) { ['id', temporary_column] } - copy_job.perform('id', temporary_column) + it 'copies all in range' do + copy_job.perform - expect(test_table.count).to eq(4) - expect(test_table.where("id = #{temporary_column}").pluck(:id)).to contain_exactly(12, 15, 19) - expect(test_table.where(temporary_column => 0).pluck(:id)).to contain_exactly(11) + expect(test_table.count).to eq(4) + expect(test_table.where("id = #{temporary_column}").pluck(:id)).to contain_exactly(12, 15, 19) + expect(test_table.where(temporary_column => 0).pluck(:id)).to contain_exactly(11) + end end - it 'copies all foreign keys in range' do - temporary_column = helpers.convert_to_bigint_column(:fk) + context 'foreign keys' do + let(:temporary_column) { helpers.convert_to_bigint_column(:fk) } + let(:job_arguments) { ['fk', temporary_column] } - copy_job.perform('fk', temporary_column) + it 'copies all in range' do + copy_job.perform - expect(test_table.count).to eq(4) - expect(test_table.where("fk = #{temporary_column}").pluck(:id)).to contain_exactly(12, 15, 19) - expect(test_table.where(temporary_column => 0).pluck(:id)).to contain_exactly(11) + expect(test_table.count).to eq(4) + expect(test_table.where("fk = #{temporary_column}").pluck(:id)).to contain_exactly(12, 15, 19) + expect(test_table.where(temporary_column => 0).pluck(:id)).to contain_exactly(11) + end end - it 'copies columns with NULLs' do - expect { copy_job.perform('name', 'name_convert_to_text') } - .to change { test_table.where("name_convert_to_text = 'no name'").count }.from(4).to(1) + context 'columns with NULLs' do + let(:job_arguments) { %w(name name_convert_to_text) } - expect(test_table.where('name = name_convert_to_text').pluck(:id)).to contain_exactly(12, 19) - expect(test_table.where('name is NULL and name_convert_to_text is NULL').pluck(:id)).to contain_exactly(15) + it 'copies all in range' do + expect { copy_job.perform } + .to change { test_table.where("name_convert_to_text = 'no name'").count }.from(4).to(1) + + expect(test_table.where('name = name_convert_to_text').pluck(:id)).to contain_exactly(12, 19) + expect(test_table.where('name is NULL and name_convert_to_text is NULL').pluck(:id)).to contain_exactly(15) + end end context 'when multiple columns are given' do @@ -87,8 +99,10 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo let(:columns_to_copy_from) { %w[id fk] } let(:columns_to_copy_to) { [id_tmp_column, fk_tmp_column] } + let(:job_arguments) { [columns_to_copy_from, columns_to_copy_to] } + it 'copies all values in the range' do - copy_job.perform(columns_to_copy_from, columns_to_copy_to) + copy_job.perform expect(test_table.count).to eq(4) expect(test_table.where("id = #{id_tmp_column} AND fk = #{fk_tmp_column}").pluck(:id)).to contain_exactly(12, 15, 19) @@ -100,7 +114,7 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo it 'raises an error' do expect do - copy_job.perform(columns_to_copy_from, columns_to_copy_to) + copy_job.perform end.to raise_error(ArgumentError, 'number of source and destination columns must match') end end @@ -109,7 +123,7 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo it 'tracks timings of queries' do expect(copy_job.batch_metrics.timings).to be_empty - copy_job.perform('name', 'name_convert_to_text') + copy_job.perform expect(copy_job.batch_metrics.timings[:update_all]).not_to be_empty end @@ -120,7 +134,7 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo it 'sleeps for the specified time between sub-batches' do expect(copy_job).to receive(:sleep).with(0.005) - copy_job.perform('name', 'name_convert_to_text') + copy_job.perform end context 'when pause_ms value is negative' do @@ -129,7 +143,7 @@ RSpec.describe Gitlab::BackgroundMigration::CopyColumnUsingBackgroundMigrationJo it 'treats it as a 0' do expect(copy_job).to receive(:sleep).with(0) - copy_job.perform('name', 'name_convert_to_text') + copy_job.perform end end end diff --git a/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb b/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb index 83c0275a870..983f482d464 100644 --- a/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb +++ b/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb @@ -38,10 +38,11 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' batch_column: 'id', sub_batch_size: 1, pause_ms: pause_ms, + job_arguments: active_migration.job_arguments, connection: connection) .and_return(job_instance) - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) perform end @@ -49,7 +50,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' it 'updates the tracking record in the database' do test_metrics = { 'my_metrics' => 'some value' } - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) expect(job_instance).to receive(:batch_metrics).and_return(test_metrics) freeze_time do @@ -78,7 +79,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' it 'increments attempts and updates other fields' do updated_metrics = { 'updated_metrics' => 'some_value' } - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) expect(job_instance).to receive(:batch_metrics).and_return(updated_metrics) freeze_time do @@ -97,7 +98,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' context 'when the migration job does not raise an error' do it 'marks the tracking record as succeeded' do - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) freeze_time do perform @@ -110,7 +111,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' end it 'tracks metrics of the execution' do - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) expect(metrics_tracker).to receive(:track).with(job_record) perform @@ -120,7 +121,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' context 'when the migration job raises an error' do shared_examples 'an error is raised' do |error_class| it 'marks the tracking record as failed' do - expect(job_instance).to receive(:perform).with('id', 'other_id').and_raise(error_class) + expect(job_instance).to receive(:perform).with(no_args).and_raise(error_class) freeze_time do expect { perform }.to raise_error(error_class) @@ -133,7 +134,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' end it 'tracks metrics of the execution' do - expect(job_instance).to receive(:perform).with('id', 'other_id').and_raise(error_class) + expect(job_instance).to receive(:perform).with(no_args).and_raise(error_class) expect(metrics_tracker).to receive(:track).with(job_record) expect { perform }.to raise_error(error_class) @@ -147,6 +148,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' context 'when the batched background migration does not inherit from BatchedMigrationJob' do let(:job_class) { Class.new } + let(:job_instance) { job_class.new } it 'runs the job with the correct arguments' do expect(job_class).to receive(:new).with(no_args).and_return(job_instance) diff --git a/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb b/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb index 07af193900a..b1adcb271bb 100644 --- a/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb +++ b/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb @@ -235,7 +235,9 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d let(:migration_class) do Class.new(Gitlab::BackgroundMigration::BatchedMigrationJob) do - def perform(matching_status) + job_arguments :matching_status + + def perform each_sub_batch( operation_name: :update_all, batching_scope: -> (relation) { relation.where(status: matching_status) }