From 0016ea0586afbe89b5823f3fc254045ce7115af2 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 26 Mar 2025 12:11:45 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/build-images.gitlab-ci.yml | 2 +- .../merge_request_templates/Security Fix.md | 2 +- .../gitlab/feature_flag_without_actor.yml | 1 - .../node_matcher_directive.yml | 1 - .../internal_affairs/node_type_predicate.yml | 1 - .../on_send_without_on_c_send.yml | 1 - .../layout/empty_line_after_magic_comment.yml | 1 - .../layout/first_hash_element_indentation.yml | 19 ---- ...e_end_string_concatenation_indentation.yml | 2 - .rubocop_todo/layout/line_length.yml | 2 - .rubocop_todo/rails/time_zone.yml | 1 - .rubocop_todo/rspec/be_eq.yml | 1 - .rubocop_todo/rspec/example_wording.yml | 2 - .rubocop_todo/rspec/expect_in_hook.yml | 1 - .rubocop_todo/rspec/feature_category.yml | 5 -- .../rspec/verified_double_reference.yml | 1 - .rubocop_todo/style/guard_clause.yml | 1 - .rubocop_todo/style/if_unless_modifier.yml | 1 - .../style/inline_disable_annotation.yml | 3 - .../javascripts/rapid_diffs/adapters.js | 12 +-- .../rapid_diffs/diff_file_component.scss | 4 + .../stylesheets/page_bundles/work_items.scss | 1 + app/finders/merge_requests/author_filter.rb | 13 +++ app/finders/merge_requests_finder.rb | 6 ++ .../authored_merge_requests_resolver.rb | 5 ++ .../projects/namespace_project_sort_enum.rb | 25 ++++++ app/models/merge_request.rb | 10 +++ app/models/project.rb | 90 +++++++++++++++---- app/services/users/destroy_session_service.rb | 26 ++++++ app/views/projects/runners/_runner.html.haml | 4 +- .../duo_chat_docs_qa_claude_3_7.yml | 9 -- danger/qa_selector/Dangerfile | 4 +- danger/stable_branch_patch/Dangerfile | 4 +- ...amespaces_redirect_routes_namespace_id.yml | 8 ++ .../backfill_onboarding_status_role.yml | 6 +- ..._projects_redirect_routes_namespace_id.yml | 8 ++ db/docs/redirect_routes.yml | 3 +- ...8_queue_backfill_onboarding_status_role.rb | 14 +-- ...namespaces_redirect_routes_namespace_id.rb | 29 ++++++ ...l_projects_redirect_routes_namespace_id.rb | 29 ++++++ ...package_reference_column_and_temp_index.rb | 25 ++++++ ...requeue_backfill_onboarding_status_role.rb | 29 ++++++ db/schema_migrations/20250310023122 | 1 + db/schema_migrations/20250310023159 | 1 + db/schema_migrations/20250319154002 | 1 + db/schema_migrations/20250320184436 | 1 + db/structure.sql | 3 - doc/api/admin/token.md | 4 +- doc/api/graphql/reference/_index.md | 23 +++++ doc/development/build_test_package.md | 2 +- doc/development/fips_gitlab.md | 2 +- doc/development/geo.md | 2 +- .../service_ping/troubleshooting.md | 2 +- doc/development/pipelines/_index.md | 2 +- doc/development/pipelines/internals.md | 8 ++ .../testing_guide/end_to_end/_index.md | 16 ++-- .../best_practices/feature_flags.md | 4 +- .../end_to_end/test_pipelines.md | 6 +- doc/update/versions/gitlab_17_changes.md | 14 +++ doc/user/gitlab_duo/setup.md | 1 - doc/user/gitlab_duo/turn_on_off.md | 2 +- doc/user/gitlab_duo_chat/turn_on_off.md | 13 ++- .../lib/gitlab/housekeeper/change.rb | 2 +- .../lib/gitlab/housekeeper/runner.rb | 2 +- .../spec/gitlab/housekeeper/change_spec.rb | 6 ++ lib/authn/tokens/gitlab_session.rb | 18 ++-- ...namespaces_redirect_routes_namespace_id.rb | 29 ++++++ ...l_projects_redirect_routes_namespace_id.rb | 29 ++++++ lib/gitlab/metrics.rb | 23 ++++- lib/gitlab/metrics/sli_config.rb | 28 +++--- lib/gitlab/quick_actions/work_item_actions.rb | 24 ++--- locale/gitlab.pot | 47 +++++----- scripts/build_assets_image | 2 +- scripts/lint-doc.sh | 17 ++++ ...maintainer_manages_project_runners_spec.rb | 2 +- spec/finders/merge_requests_finder_spec.rb | 34 +++++++ .../types/namespace_project_sort_enum_spec.rb | 32 +++++++ spec/lib/authn/tokens/gitlab_session_spec.rb | 12 +-- ...paces_redirect_routes_namespace_id_spec.rb | 86 ++++++++++++++++++ ...jects_redirect_routes_namespace_id_spec.rb | 86 ++++++++++++++++++ ...ue_backfill_onboarding_status_role_spec.rb | 10 +-- ...paces_redirect_routes_namespace_id_spec.rb | 28 ++++++ ...jects_redirect_routes_namespace_id_spec.rb | 28 ++++++ ...ue_backfill_onboarding_status_role_spec.rb | 26 ++++++ spec/models/project_spec.rb | 58 +++++++++--- spec/requests/api/admin/token_spec.rb | 38 +++++++- .../quick_actions/interpret_service_spec.rb | 8 +- .../users/destroy_session_service_spec.rb | 40 +++++++++ 88 files changed, 1013 insertions(+), 222 deletions(-) create mode 100644 app/finders/merge_requests/author_filter.rb create mode 100644 app/services/users/destroy_session_service.rb delete mode 100644 config/feature_flags/gitlab_com_derisk/duo_chat_docs_qa_claude_3_7.yml create mode 100644 db/docs/batched_background_migrations/backfill_namespaces_redirect_routes_namespace_id.yml create mode 100644 db/docs/batched_background_migrations/backfill_projects_redirect_routes_namespace_id.yml create mode 100644 db/post_migrate/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id.rb create mode 100644 db/post_migrate/20250310023159_queue_backfill_projects_redirect_routes_namespace_id.rb create mode 100644 db/post_migrate/20250319154002_remove_conan_package_reference_column_and_temp_index.rb create mode 100644 db/post_migrate/20250320184436_requeue_backfill_onboarding_status_role.rb create mode 100644 db/schema_migrations/20250310023122 create mode 100644 db/schema_migrations/20250310023159 create mode 100644 db/schema_migrations/20250319154002 create mode 100644 db/schema_migrations/20250320184436 create mode 100644 lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id.rb create mode 100644 lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id.rb create mode 100644 spec/graphql/types/namespace_project_sort_enum_spec.rb create mode 100644 spec/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id_spec.rb create mode 100644 spec/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id_spec.rb create mode 100644 spec/migrations/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id_spec.rb create mode 100644 spec/migrations/20250310023159_queue_backfill_projects_redirect_routes_namespace_id_spec.rb create mode 100644 spec/migrations/20250320184436_requeue_backfill_onboarding_status_role_spec.rb create mode 100644 spec/services/users/destroy_session_service_spec.rb diff --git a/.gitlab/ci/build-images.gitlab-ci.yml b/.gitlab/ci/build-images.gitlab-ci.yml index 46a08b4a490..c900919c749 100644 --- a/.gitlab/ci/build-images.gitlab-ci.yml +++ b/.gitlab/ci/build-images.gitlab-ci.yml @@ -11,7 +11,7 @@ retry: 2 # This image is used by: -# - The `e2e:test-on-omnibus` child pipeline test stage jobs +# - The `e2e:test-on-omnibus-ee` child pipeline test stage jobs # See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/#testing-code-in-merge-requests for more details. build-qa-image: extends: diff --git a/.gitlab/merge_request_templates/Security Fix.md b/.gitlab/merge_request_templates/Security Fix.md index fe19d036e5e..73ec9a2e0f8 100644 --- a/.gitlab/merge_request_templates/Security Fix.md +++ b/.gitlab/merge_request_templates/Security Fix.md @@ -41,6 +41,6 @@ See [the general developer security guidelines](https://gitlab.com/gitlab-org/re [Code reviews and Approvals]: https://gitlab.com/gitlab-org/release/docs/-/blob/master/general/security/engineer.md#code-reviews-and-approvals [Approval Guidelines]: https://docs.gitlab.com/development/code_review/#approval-guidelines [Canonical repository]: https://gitlab.com/gitlab-org/gitlab -[`e2e:test-on-omnibus` job]: https://docs.gitlab.com/ee/development/testing_guide/end_to_end/#using-the-test-on-omnibus-job +[`e2e:test-on-omnibus-ee` job]: https://docs.gitlab.com/ee/development/testing_guide/end_to_end/#using-the-test-on-omnibus-job [Release Manager]: https://about.gitlab.com/community/release-managers/ [security implementation issue]: https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/engineer.md#security-implementation-issue diff --git a/.rubocop_todo/gitlab/feature_flag_without_actor.yml b/.rubocop_todo/gitlab/feature_flag_without_actor.yml index d052a6d0cb4..33a489b594b 100644 --- a/.rubocop_todo/gitlab/feature_flag_without_actor.yml +++ b/.rubocop_todo/gitlab/feature_flag_without_actor.yml @@ -4,7 +4,6 @@ Gitlab/FeatureFlagWithoutActor: - 'app/controllers/activity_pub/application_controller.rb' - 'app/controllers/concerns/integrations/actions.rb' - 'app/controllers/concerns/preferred_language_switcher.rb' - - 'app/controllers/concerns/request_payload_logger.rb' - 'app/controllers/explore/projects_controller.rb' - 'app/controllers/projects/settings/integrations_controller.rb' - 'app/controllers/repositories/git_http_controller.rb' diff --git a/.rubocop_todo/internal_affairs/node_matcher_directive.yml b/.rubocop_todo/internal_affairs/node_matcher_directive.yml index 01a82596dde..16b7f4fa67c 100644 --- a/.rubocop_todo/internal_affairs/node_matcher_directive.yml +++ b/.rubocop_todo/internal_affairs/node_matcher_directive.yml @@ -74,7 +74,6 @@ InternalAffairs/NodeMatcherDirective: - 'rubocop/cop/migration/ensure_factory_for_table.rb' - 'rubocop/cop/migration/migration_record.rb' - 'rubocop/cop/migration/migration_with_milestone.rb' - - 'rubocop/cop/migration/prevent_adding_attr_encrypted_columns.rb' - 'rubocop/cop/migration/prevent_global_enable_lock_retries_with_disable_ddl_transaction.rb' - 'rubocop/cop/migration/prevent_index_creation.rb' - 'rubocop/cop/migration/prevent_single_statement_with_disable_ddl_transaction.rb' diff --git a/.rubocop_todo/internal_affairs/node_type_predicate.yml b/.rubocop_todo/internal_affairs/node_type_predicate.yml index bc7c57a4b85..df2c4400f44 100644 --- a/.rubocop_todo/internal_affairs/node_type_predicate.yml +++ b/.rubocop_todo/internal_affairs/node_type_predicate.yml @@ -11,7 +11,6 @@ InternalAffairs/NodeTypePredicate: - 'rubocop/cop/migration/add_reference.rb' - 'rubocop/cop/migration/background_migration_missing_active_concern.rb' - 'rubocop/cop/migration/datetime.rb' - - 'rubocop/cop/migration/prevent_adding_attr_encrypted_columns.rb' - 'rubocop/cop/migration/prevent_adding_columns.rb' - 'rubocop/cop/migration/prevent_strings.rb' - 'rubocop/cop/migration/refer_to_index_by_name.rb' diff --git a/.rubocop_todo/internal_affairs/on_send_without_on_c_send.yml b/.rubocop_todo/internal_affairs/on_send_without_on_c_send.yml index 3b3424b93cf..3dcd7b4b9a4 100644 --- a/.rubocop_todo/internal_affairs/on_send_without_on_c_send.yml +++ b/.rubocop_todo/internal_affairs/on_send_without_on_c_send.yml @@ -46,7 +46,6 @@ InternalAffairs/OnSendWithoutOnCSend: - 'rubocop/cop/gitlab/license_available_usage.rb' - 'rubocop/cop/gitlab/mark_used_feature_flags.rb' - 'rubocop/cop/gitlab/no_find_in_workers.rb' - - 'rubocop/cop/gitlab/rails/attr_encrypted.rb' - 'rubocop/cop/gitlab/rails/safe_format.rb' - 'rubocop/cop/gitlab/rails_logger.rb' - 'rubocop/cop/gitlab/rspec/avoid_setup.rb' diff --git a/.rubocop_todo/layout/empty_line_after_magic_comment.yml b/.rubocop_todo/layout/empty_line_after_magic_comment.yml index c6aec79c795..36efa9d089e 100644 --- a/.rubocop_todo/layout/empty_line_after_magic_comment.yml +++ b/.rubocop_todo/layout/empty_line_after_magic_comment.yml @@ -531,7 +531,6 @@ Layout/EmptyLineAfterMagicComment: - 'spec/requests/lfs_http_spec.rb' - 'spec/rubocop/cop/migration/complex_indexes_require_name_spec.rb' - 'spec/rubocop/cop/migration/refer_to_index_by_name_spec.rb' - - 'spec/scripts/trigger-build_spec.rb' - 'spec/serializers/impersonation_access_token_entity_spec.rb' - 'spec/serializers/impersonation_access_token_serializer_spec.rb' - 'spec/services/ci/create_pipeline_service/artifacts_spec.rb' diff --git a/.rubocop_todo/layout/first_hash_element_indentation.yml b/.rubocop_todo/layout/first_hash_element_indentation.yml index 85fd14d4f17..da66c9d8f5e 100644 --- a/.rubocop_todo/layout/first_hash_element_indentation.yml +++ b/.rubocop_todo/layout/first_hash_element_indentation.yml @@ -2,25 +2,6 @@ # Cop supports --autocorrect. Layout/FirstHashElementIndentation: Exclude: - - 'ee/spec/lib/gitlab/ci/reports/coverage_fuzzing/report_spec.rb' - - 'ee/spec/lib/gitlab/geo/log_cursor/lease_spec.rb' - - 'ee/spec/mailers/credentials_inventory_mailer_spec.rb' - - 'ee/spec/mailers/emails/requirements_spec.rb' - - 'ee/spec/models/concerns/elastic/note_spec.rb' - - 'ee/spec/requests/api/analytics/project_deployment_frequency_spec.rb' - - 'ee/spec/requests/api/graphql/mutations/iterations/create_spec.rb' - - 'ee/spec/requests/api/merge_requests_spec.rb' - - 'ee/spec/requests/ee/projects/deploy_tokens_controller_spec.rb' - - 'ee/spec/services/approval_rules/project_rule_destroy_service_spec.rb' - - 'ee/spec/services/deploy_keys/create_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/projects/deploy_tokens/create_service_spec.rb' - - 'ee/spec/services/ee/projects/deploy_tokens/destroy_service_spec.rb' - - 'ee/spec/services/ee/projects/unlink_fork_service_spec.rb' - - 'ee/spec/services/external_status_checks/destroy_service_spec.rb' - - 'ee/spec/services/groups/destroy_service_spec.rb' - - 'ee/spec/services/iterations/create_service_spec.rb' - 'ee/spec/services/projects/disable_deploy_key_service_spec.rb' - 'ee/spec/services/projects/enable_deploy_key_service_spec.rb' - 'ee/spec/services/projects/group_links/create_service_spec.rb' diff --git a/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml b/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml index baceb196313..33454adea36 100644 --- a/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml +++ b/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml @@ -392,7 +392,6 @@ Layout/LineEndStringConcatenationIndentation: - 'qa/qa/service/docker_run/product_analytics/dotnet_sdk_app.rb' - 'qa/qa/specs/features/ee/api/10_govern/compliance_pipeline_spec.rb' - 'qa/qa/specs/features/ee/browser_ui/10_govern/export_vulnerability_report_spec.rb' - - 'qa/qa/specs/features/ee/browser_ui/9_tenant_scale/elasticsearch/elasticsearch_reindexing_spec.rb' - 'qa/qa/support/system_logs/kibana.rb' - 'qa/qa/tools/revoke_user_personal_access_tokens.rb' - 'qa/qa/tools/test_resources_handler.rb' @@ -435,7 +434,6 @@ Layout/LineEndStringConcatenationIndentation: - 'scripts/generate_rspec_pipeline.rb' - 'scripts/lint-docs-redirects.rb' - 'scripts/qa/testcases-check' - - 'scripts/trigger-build.rb' - 'spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb' - 'spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb' - 'spec/controllers/graphql_controller_spec.rb' diff --git a/.rubocop_todo/layout/line_length.yml b/.rubocop_todo/layout/line_length.yml index fb1068984c0..225b181e65b 100644 --- a/.rubocop_todo/layout/line_length.yml +++ b/.rubocop_todo/layout/line_length.yml @@ -5,7 +5,6 @@ Layout/LineLength: - 'app/controllers/application_controller.rb' - 'app/controllers/groups/milestones_controller.rb' - 'app/controllers/projects/issues_controller.rb' - - 'app/controllers/projects/labels_controller.rb' - 'app/controllers/projects/milestones_controller.rb' - 'app/controllers/projects/notes_controller.rb' - 'app/controllers/projects/pipeline_schedules_controller.rb' @@ -1769,7 +1768,6 @@ Layout/LineLength: - 'ee/spec/services/vulnerabilities/statistics/adjustment_service_spec.rb' - 'ee/spec/services/vulnerabilities/update_service_spec.rb' - 'ee/spec/services/vulnerability_exports/create_service_spec.rb' - - 'ee/spec/services/vulnerability_exports/export_service_spec.rb' - 'ee/spec/services/vulnerability_exports/exporters/csv_service_spec.rb' - 'ee/spec/services/vulnerability_external_issue_links/create_service_spec.rb' - 'ee/spec/services/vulnerability_external_issue_links/destroy_service_spec.rb' diff --git a/.rubocop_todo/rails/time_zone.yml b/.rubocop_todo/rails/time_zone.yml index a827a78a4de..c160e47e367 100644 --- a/.rubocop_todo/rails/time_zone.yml +++ b/.rubocop_todo/rails/time_zone.yml @@ -40,7 +40,6 @@ Rails/TimeZone: - 'spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb' - 'spec/lib/gitlab/app_json_logger_spec.rb' - 'spec/lib/gitlab/app_text_logger_spec.rb' - - 'spec/lib/gitlab/auth/current_user_mode_spec.rb' - 'spec/lib/gitlab/checks/timed_logger_spec.rb' - 'spec/lib/gitlab/ci/cron_parser_spec.rb' - 'spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb' diff --git a/.rubocop_todo/rspec/be_eq.yml b/.rubocop_todo/rspec/be_eq.yml index 6e47060613b..e4856c23923 100644 --- a/.rubocop_todo/rspec/be_eq.yml +++ b/.rubocop_todo/rspec/be_eq.yml @@ -306,7 +306,6 @@ RSpec/BeEq: - 'ee/spec/requests/api/ci/runner_spec.rb' - 'ee/spec/requests/api/epic_boards_spec.rb' - 'ee/spec/requests/api/epics_spec.rb' - - 'ee/spec/requests/api/graphql/ai/feature_settings/update_spec.rb' - 'ee/spec/requests/api/graphql/ai/self_hosted_models/delete_spec.rb' - 'ee/spec/requests/api/graphql/ai/self_hosted_models/update_spec.rb' - 'ee/spec/requests/api/graphql/analytics/value_stream_analytics_spec.rb' diff --git a/.rubocop_todo/rspec/example_wording.yml b/.rubocop_todo/rspec/example_wording.yml index f010e04dd31..8e6454e1c77 100644 --- a/.rubocop_todo/rspec/example_wording.yml +++ b/.rubocop_todo/rspec/example_wording.yml @@ -35,7 +35,6 @@ RSpec/ExampleWording: - 'spec/lib/backup/targets/database_spec.rb' - 'spec/lib/banzai/reference_parser/base_parser_spec.rb' - 'spec/lib/gitlab/application_setting_fetcher_spec.rb' - - 'spec/lib/gitlab/auth/current_user_mode_spec.rb' - 'spec/lib/gitlab/database/batch_count_spec.rb' - 'spec/lib/gitlab/database/bump_sequences_spec.rb' - 'spec/lib/gitlab/database/migrations/sidekiq_helpers_spec.rb' @@ -53,7 +52,6 @@ RSpec/ExampleWording: - 'spec/requests/users_controller_spec.rb' - 'spec/rubocop/cop/background_migration/feature_category_spec.rb' - 'spec/serializers/build_details_entity_spec.rb' - - 'spec/services/merge_requests/squash_service_spec.rb' - 'spec/services/notification_service_spec.rb' - 'spec/services/quick_actions/interpret_service_spec.rb' - 'spec/services/users/destroy_service_spec.rb' diff --git a/.rubocop_todo/rspec/expect_in_hook.yml b/.rubocop_todo/rspec/expect_in_hook.yml index fc1b3772c27..fed369261cc 100644 --- a/.rubocop_todo/rspec/expect_in_hook.yml +++ b/.rubocop_todo/rspec/expect_in_hook.yml @@ -333,7 +333,6 @@ RSpec/ExpectInHook: - 'spec/services/merge_requests/mergeability/check_open_status_service_spec.rb' - 'spec/services/merge_requests/mergeability/run_checks_service_spec.rb' - 'spec/services/merge_requests/mergeability_check_service_spec.rb' - - 'spec/services/merge_requests/squash_service_spec.rb' - 'spec/services/merge_requests/update_service_spec.rb' - 'spec/services/notes/quick_actions_service_spec.rb' - 'spec/services/notification_recipients/builder/default_spec.rb' diff --git a/.rubocop_todo/rspec/feature_category.yml b/.rubocop_todo/rspec/feature_category.yml index be7e73a23b6..482d1cf6bb4 100644 --- a/.rubocop_todo/rspec/feature_category.yml +++ b/.rubocop_todo/rspec/feature_category.yml @@ -748,7 +748,6 @@ RSpec/FeatureCategory: - 'ee/spec/models/ee/members_preloader_spec.rb' - 'ee/spec/models/ee/merge_request/metrics_spec.rb' - 'ee/spec/models/ee/namespace_ci_cd_setting_spec.rb' - - 'ee/spec/models/ee/namespace_statistics_spec.rb' - 'ee/spec/models/ee/namespaces/namespace_ban_spec.rb' - 'ee/spec/models/ee/notification_setting_spec.rb' - 'ee/spec/models/ee/project_authorization_spec.rb' @@ -2298,7 +2297,6 @@ RSpec/FeatureCategory: - 'spec/lib/gitlab/database/load_balancing/setup_spec.rb' - 'spec/lib/gitlab/database/load_balancing/srv_resolver_spec.rb' - 'spec/lib/gitlab/database/load_balancing/sticking_spec.rb' - - 'spec/lib/gitlab/database/loose_foreign_keys_spec.rb' - 'spec/lib/gitlab/database/migration_helpers/announce_database_spec.rb' - 'spec/lib/gitlab/database/migration_helpers/cascading_namespace_settings_spec.rb' - 'spec/lib/gitlab/database/migration_helpers/loose_foreign_key_helpers_spec.rb' @@ -2445,7 +2443,6 @@ RSpec/FeatureCategory: - 'spec/lib/gitlab/fogbugz_import/importer_spec.rb' - 'spec/lib/gitlab/form_builders/gitlab_ui_form_builder_spec.rb' - 'spec/lib/gitlab/git/attributes_at_ref_parser_spec.rb' - - 'spec/lib/gitlab/git/attributes_parser_spec.rb' - 'spec/lib/gitlab/git/base_error_spec.rb' - 'spec/lib/gitlab/git/blob_spec.rb' - 'spec/lib/gitlab/git/branch_spec.rb' @@ -2458,7 +2455,6 @@ RSpec/FeatureCategory: - 'spec/lib/gitlab/git/cross_repo_spec.rb' - 'spec/lib/gitlab/git/gitmodules_parser_spec.rb' - 'spec/lib/gitlab/git/hook_env_spec.rb' - - 'spec/lib/gitlab/git/keep_around_spec.rb' - 'spec/lib/gitlab/git/lfs_changes_spec.rb' - 'spec/lib/gitlab/git/lfs_pointer_file_spec.rb' - 'spec/lib/gitlab/git/merge_base_spec.rb' @@ -2830,7 +2826,6 @@ RSpec/FeatureCategory: - 'spec/lib/gitlab/sidekiq_death_handler_spec.rb' - 'spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb' - 'spec/lib/gitlab/sidekiq_logging/json_formatter_spec.rb' - - 'spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/admin_mode/client_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/admin_mode/server_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/client_metrics_spec.rb' diff --git a/.rubocop_todo/rspec/verified_double_reference.yml b/.rubocop_todo/rspec/verified_double_reference.yml index 937da31b45b..68d04368431 100644 --- a/.rubocop_todo/rspec/verified_double_reference.yml +++ b/.rubocop_todo/rspec/verified_double_reference.yml @@ -59,7 +59,6 @@ RSpec/VerifiedDoubleReference: - 'ee/spec/services/sbom/ingestion/ingest_reports_service_spec.rb' - 'ee/spec/services/sbom/ingestion/tasks/base_spec.rb' - 'ee/spec/services/security/findings/dismiss_service_spec.rb' - - 'ee/spec/services/security/scan_result_policies/update_license_approvals_service_spec.rb' - 'ee/spec/services/vulnerabilities/findings/find_or_create_from_security_finding_service_spec.rb' - 'ee/spec/support/shared_contexts/google_cloud_platform/artifact_registry/services_shared_contexts.rb' - 'ee/spec/support/shared_contexts/google_cloud_platform/compute/services_shared_contexts.rb' diff --git a/.rubocop_todo/style/guard_clause.yml b/.rubocop_todo/style/guard_clause.yml index 64f89d28ddb..5721f32d757 100644 --- a/.rubocop_todo/style/guard_clause.yml +++ b/.rubocop_todo/style/guard_clause.yml @@ -479,7 +479,6 @@ Style/GuardClause: - 'rubocop/routes_under_scope.rb' - 'scripts/lint_templates_bash.rb' - 'scripts/setup/find-jh-branch.rb' - - 'scripts/trigger-build.rb' - 'spec/features/issuables/issuable_list_spec.rb' - 'spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb' - 'spec/services/issues/relative_position_rebalancing_service_spec.rb' diff --git a/.rubocop_todo/style/if_unless_modifier.yml b/.rubocop_todo/style/if_unless_modifier.yml index 49e0d01bd93..c7337b8421c 100644 --- a/.rubocop_todo/style/if_unless_modifier.yml +++ b/.rubocop_todo/style/if_unless_modifier.yml @@ -580,7 +580,6 @@ Style/IfUnlessModifier: - 'lib/gitlab/legacy_github_import/client.rb' - 'lib/gitlab/legacy_github_import/issuable_formatter.rb' - 'lib/gitlab/legacy_github_import/project_creator.rb' - - 'lib/gitlab/lograge/custom_options.rb' - 'lib/gitlab/mail_room.rb' - 'lib/gitlab/mail_room/authenticator.rb' - 'lib/gitlab/manifest_import/manifest.rb' diff --git a/.rubocop_todo/style/inline_disable_annotation.yml b/.rubocop_todo/style/inline_disable_annotation.yml index 03e3a36aec9..f14570d6a9b 100644 --- a/.rubocop_todo/style/inline_disable_annotation.yml +++ b/.rubocop_todo/style/inline_disable_annotation.yml @@ -306,7 +306,6 @@ Style/InlineDisableAnnotation: - 'app/helpers/namespaces_helper.rb' - 'app/helpers/routing/projects_helper.rb' - 'app/helpers/routing/pseudonymization_helper.rb' - - 'app/helpers/sidebars_helper.rb' - 'app/helpers/sorting_helper.rb' - 'app/helpers/users_helper.rb' - 'app/mailers/emails/issues.rb' @@ -1268,7 +1267,6 @@ Style/InlineDisableAnnotation: - 'ee/app/services/geo/container_repository_sync_service.rb' - 'ee/app/services/gitlab_subscriptions/add_on_purchases/update_service.rb' - 'ee/app/services/gitlab_subscriptions/notify_seats_exceeded_batch_service.rb' - - 'ee/app/services/gitlab_subscriptions/preview_billable_user_change_service.rb' - 'ee/app/services/incident_management/escalation_rules/destroy_service.rb' - 'ee/app/services/incident_management/pending_escalations/create_service.rb' - 'ee/app/services/incident_management/pending_escalations/process_service.rb' @@ -1586,7 +1584,6 @@ Style/InlineDisableAnnotation: - 'ee/spec/requests/api/graphql/mutations/geo/registries/update_spec.rb' - 'ee/spec/requests/api/graphql/project/merge_request_spec.rb' - 'ee/spec/requests/api/graphql/project/product_analytics/product_analytics_spec.rb' - - 'ee/spec/requests/api/group_service_accounts_spec.rb' - 'ee/spec/requests/api/groups_spec.rb' - 'ee/spec/requests/api/internal/base_spec.rb' - 'ee/spec/requests/groups/issues_controller_spec.rb' diff --git a/app/assets/javascripts/rapid_diffs/adapters.js b/app/assets/javascripts/rapid_diffs/adapters.js index d5c5691c028..a4e3d58b348 100644 --- a/app/assets/javascripts/rapid_diffs/adapters.js +++ b/app/assets/javascripts/rapid_diffs/adapters.js @@ -2,14 +2,10 @@ import { ExpandLinesAdapter } from '~/rapid_diffs/expand_lines/adapter'; import { OptionsMenuAdapter } from '~/rapid_diffs/options_menu/adapter'; import { ToggleFileAdapter } from '~/rapid_diffs/toggle_file/adapter'; -const RAPID_DIFFS_VIEWERS = { - text_inline: 'text_inline', - text_parallel: 'text_parallel', -}; - -const COMMON_ADAPTERS = [ExpandLinesAdapter, OptionsMenuAdapter, ToggleFileAdapter]; +const HEADER_ADAPTERS = [OptionsMenuAdapter, ToggleFileAdapter]; export const VIEWER_ADAPTERS = { - [RAPID_DIFFS_VIEWERS.text_inline]: COMMON_ADAPTERS, - [RAPID_DIFFS_VIEWERS.text_parallel]: COMMON_ADAPTERS, + text_inline: [...HEADER_ADAPTERS, ExpandLinesAdapter], + text_parallel: [...HEADER_ADAPTERS, ExpandLinesAdapter], + no_preview: HEADER_ADAPTERS, }; diff --git a/app/assets/stylesheets/components/rapid_diffs/diff_file_component.scss b/app/assets/stylesheets/components/rapid_diffs/diff_file_component.scss index 8856f889929..2967383b4d7 100644 --- a/app/assets/stylesheets/components/rapid_diffs/diff_file_component.scss +++ b/app/assets/stylesheets/components/rapid_diffs/diff_file_component.scss @@ -33,6 +33,7 @@ .rd-diff-file-title { position: relative; display: flex; + flex-wrap: wrap; align-items: center; // extra spacing to avoid accidental file collapse clicks padding: $gl-spacing-scale-3; @@ -59,6 +60,8 @@ .rd-diff-file-info { position: relative; display: flex; + align-self: flex-start; + align-items: center; // extra spacing to avoid accidental file collapse clicks padding: $gl-spacing-scale-3; margin: -$gl-spacing-scale-3; @@ -71,6 +74,7 @@ display: flex; align-items: center; margin-left: auto; + white-space: nowrap; } .rd-lines-added { diff --git a/app/assets/stylesheets/page_bundles/work_items.scss b/app/assets/stylesheets/page_bundles/work_items.scss index 52ef23feebe..d89aa1b475b 100644 --- a/app/assets/stylesheets/page_bundles/work_items.scss +++ b/app/assets/stylesheets/page_bundles/work_items.scss @@ -1,4 +1,5 @@ @import 'mixins_and_variables_and_functions'; +@import 'issues_show'; $work-item-field-inset-shadow: inset 0 0 0 $gl-border-size-1 var(--gray-200, $gray-200) !important; $work-item-overview-right-sidebar-width: px-to-rem(290px); diff --git a/app/finders/merge_requests/author_filter.rb b/app/finders/merge_requests/author_filter.rb new file mode 100644 index 00000000000..b6b3982e0eb --- /dev/null +++ b/app/finders/merge_requests/author_filter.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module MergeRequests + class AuthorFilter < ::Issuables::AuthorFilter + private + + def by_author(issuables) + return super unless params[:include_assigned] + + issuables.author_or_assignee(params[:author_id], params.review_state) + end + end +end diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 3723034d211..62513465b44 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -109,6 +109,12 @@ class MergeRequestsFinder < IssuableFinder items.group(grouping_columns) # rubocop:disable CodeReuse/ActiveRecord end + def by_author(items) + MergeRequests::AuthorFilter.new( + params: params + ).filter(items) + end + def by_commit(items) return items unless params[:commit_sha].presence diff --git a/app/graphql/resolvers/authored_merge_requests_resolver.rb b/app/graphql/resolvers/authored_merge_requests_resolver.rb index 4de1046ce0d..f300e6b0d8f 100644 --- a/app/graphql/resolvers/authored_merge_requests_resolver.rb +++ b/app/graphql/resolvers/authored_merge_requests_resolver.rb @@ -6,6 +6,11 @@ module Resolvers accept_assignee accept_reviewer + argument :include_assigned, GraphQL::Types::Boolean, + required: false, + default_value: false, + description: "Include merge requests the user is assigned to." + def user_role :author end diff --git a/app/graphql/types/projects/namespace_project_sort_enum.rb b/app/graphql/types/projects/namespace_project_sort_enum.rb index 29a5c86b084..f66a4af2e4d 100644 --- a/app/graphql/types/projects/namespace_project_sort_enum.rb +++ b/app/graphql/types/projects/namespace_project_sort_enum.rb @@ -10,6 +10,31 @@ module Types value 'ACTIVITY_DESC', 'Sort by latest activity, descending order.', value: :latest_activity_desc value 'STORAGE_SIZE_ASC', 'Sort by total storage size, ascending order.', value: :storage_size_asc value 'STORAGE_SIZE_DESC', 'Sort by total storage size, descending order.', value: :storage_size_desc + + value 'REPOSITORY_SIZE_ASC', 'Sort by total repository size, ascending order.', value: :repository_size_asc + value 'REPOSITORY_SIZE_DESC', 'Sort by total repository size, descending order.', value: :repository_size_desc + + value 'SNIPPETS_SIZE_ASC', 'Sort by total snippet size, ascending order.', value: :snippets_size_asc + value 'SNIPPETS_SIZE_DESC', 'Sort by total snippet size, descending order.', value: :snippets_size_desc + + value 'BUILD_ARTIFACTS_SIZE_ASC', 'Sort by total build artifact size, ascending order.', + value: :build_artifacts_size_asc + value 'BUILD_ARTIFACTS_SIZE_DESC', 'Sort by total build artifact size, descending order.', + value: :build_artifacts_size_desc + + value 'LFS_OBJECTS_SIZE_ASC', 'Sort by total LFS object size, ascending order.', value: :lfs_objects_size_asc + value 'LFS_OBJECTS_SIZE_DESC', 'Sort by total LFS object size, descending order.', value: :lfs_objects_size_desc + + value 'PACKAGES_SIZE_ASC', 'Sort by total package size, ascending order.', value: :packages_size_asc + value 'PACKAGES_SIZE_DESC', 'Sort by total package size, descending order.', value: :packages_size_desc + + value 'WIKI_SIZE_ASC', 'Sort by total wiki size, ascending order.', value: :wiki_size_asc + value 'WIKI_SIZE_DESC', 'Sort by total wiki size, descending order.', value: :wiki_size_desc + + value 'CONTAINER_REGISTRY_SIZE_ASC', 'Sort by total container registry size, ascending order.', + value: :container_registry_size_asc + value 'CONTAINER_REGISTRY_SIZE_DESC', 'Sort by total container registry size, descending order.', + value: :container_registry_size_desc end end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index b71183509c4..07dc16e8b5e 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -523,6 +523,16 @@ class MergeRequest < ApplicationRecord ) end + scope :author_or_assignee, ->(user, review_states = nil) do + authored = where(author_id: user) + authored = authored.review_states(review_states) if review_states + + assigned = joins(:merge_request_assignees).where(merge_request_assignees: { user_id: user }) + assigned = assigned.review_states(review_states) if review_states + + from("(#{from_union([authored, assigned], remove_duplicates: true).to_sql}) merge_requests") + end + scope :without_hidden, -> { if Feature.enabled?(:hide_merge_requests_from_banned_users) where_not_exists(Users::BannedUser.where('merge_requests.author_id = banned_users.user_id')) diff --git a/app/models/project.rb b/app/models/project.rb index 2f8fdcd0918..5128c2c624e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -676,10 +676,56 @@ class Project < ApplicationRecord scope :sorted_by_storage_size_asc, -> { order_by_storage_size(:asc) } scope :sorted_by_storage_size_desc, -> { order_by_storage_size(:desc) } scope :order_by_storage_size, ->(direction) do + order_by_project_statistics('project_statistics_storage_size', :storage_size, direction) + end + + scope :sorted_by_repository_size_asc, -> { order_by_repository_size(:asc) } + scope :sorted_by_repository_size_desc, -> { order_by_repository_size(:desc) } + scope :order_by_repository_size, ->(direction) do + order_by_project_statistics('project_statistics_repository_size', :repository_size, direction) + end + + scope :sorted_by_snippets_size_asc, -> { order_by_snippet_size(:asc) } + scope :sorted_by_snippets_size_desc, -> { order_by_snippet_size(:desc) } + scope :order_by_snippet_size, ->(direction) do + order_by_project_statistics('project_statistics_snippets_size', :snippets_size, direction) + end + + scope :sorted_by_build_artifacts_size_asc, -> { order_by_build_artifacts_size(:asc) } + scope :sorted_by_build_artifacts_size_desc, -> { order_by_build_artifacts_size(:desc) } + scope :order_by_build_artifacts_size, ->(direction) do + order_by_project_statistics('project_statistics_build_artifacts_size', :build_artifacts_size, direction) + end + + scope :sorted_by_lfs_objects_size_asc, -> { order_by_lfs_objects_size(:asc) } + scope :sorted_by_lfs_objects_size_desc, -> { order_by_lfs_objects_size(:desc) } + scope :order_by_lfs_objects_size, ->(direction) do + order_by_project_statistics('project_statistics_lfs_objects_size', :lfs_objects_size, direction) + end + + scope :sorted_by_packages_size_asc, -> { order_by_packages_size(:asc) } + scope :sorted_by_packages_size_desc, -> { order_by_packages_size(:desc) } + scope :order_by_packages_size, ->(direction) do + order_by_project_statistics('project_statistics_packages_size', :packages_size, direction) + end + + scope :sorted_by_wiki_size_asc, -> { order_by_wiki_size(:asc) } + scope :sorted_by_wiki_size_desc, -> { order_by_wiki_size(:desc) } + scope :order_by_wiki_size, ->(direction) do + order_by_project_statistics('project_statistics_wiki_size', :wiki_size, direction) + end + + scope :sorted_by_container_registry_size_asc, -> { order_by_container_registry_size(:asc) } + scope :sorted_by_container_registry_size_desc, -> { order_by_container_registry_size(:desc) } + scope :order_by_container_registry_size, ->(direction) do + order_by_project_statistics('project_statistics_container_registry_size', :container_registry_size, direction) + end + + scope :order_by_project_statistics, ->(attribute_name, attribute_column, direction) do build_keyset_order_on_joined_column( scope: joins(:statistics), - attribute_name: 'project_statistics_storage_size', - column: ::ProjectStatistics.arel_table[:storage_size], + attribute_name: attribute_name, + column: ::ProjectStatistics.arel_table[attribute_column], direction: direction, nullable: :nulls_first ) @@ -1063,28 +1109,36 @@ class Project < ApplicationRecord Gitlab::VisibilityLevel.options end + # rubocop:disable Metrics/CyclomaticComplexity -- stick to existing implementation for sort params: def sort_by_attribute(method) case method.to_s - when 'storage_size_asc' - sorted_by_storage_size_asc - when 'storage_size_desc' - sorted_by_storage_size_desc - when 'latest_activity_desc' - sorted_by_updated_desc - when 'latest_activity_asc' - sorted_by_updated_asc - when 'path_asc' - sorted_by_path_asc - when 'path_desc' - sorted_by_path_desc - when 'stars_desc' - sorted_by_stars_desc - when 'stars_asc' - sorted_by_stars_asc + when 'storage_size_desc' then sorted_by_storage_size_desc + when 'storage_size_asc' then sorted_by_storage_size_asc + when 'repository_size_desc' then sorted_by_repository_size_desc + when 'repository_size_asc' then sorted_by_repository_size_asc + when 'snippets_size_desc'then sorted_by_snippets_size_desc + when 'snippets_size_asc'then sorted_by_snippets_size_asc + when 'build_artifacts_size_desc' then sorted_by_build_artifacts_size_desc + when 'build_artifacts_size_asc'then sorted_by_build_artifacts_size_asc + when 'lfs_objects_size_desc'then sorted_by_lfs_objects_size_desc + when 'lfs_objects_size_asc' then sorted_by_lfs_objects_size_asc + when 'packages_size_desc' then sorted_by_packages_size_desc + when 'packages_size_asc' then sorted_by_packages_size_asc + when 'wiki_size_desc' then sorted_by_wiki_size_desc + when 'wiki_size_asc'then sorted_by_wiki_size_asc + when 'container_registry_size_desc' then sorted_by_container_registry_size_desc + when 'container_registry_size_asc' then sorted_by_container_registry_size_asc + when 'latest_activity_desc' then sorted_by_updated_desc + when 'latest_activity_asc' then sorted_by_updated_asc + when 'path_desc'then sorted_by_path_desc + when 'path_asc' then sorted_by_path_asc + when 'stars_desc' then sorted_by_stars_desc + when 'stars_asc' then sorted_by_stars_asc else order_by(method) end end + # rubocop:enable Metrics/CyclomaticComplexity def reference_pattern %r{ diff --git a/app/services/users/destroy_session_service.rb b/app/services/users/destroy_session_service.rb new file mode 100644 index 00000000000..939a18a15d0 --- /dev/null +++ b/app/services/users/destroy_session_service.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Users + class DestroySessionService + attr_reader :current_user, :user, :private_session_id + + def initialize(current_user:, user:, private_session_id:) + @current_user = current_user + @user = user + @private_session_id = private_session_id + end + + def execute + unless current_user.can_admin_all_resources? + return ServiceResponse.error( + message: 'The current user is not authorized to destroy the session', + reason: :forbidden + ) + end + + ActiveSession.destroy_session(user, private_session_id) + + ServiceResponse.success + end + end +end diff --git a/app/views/projects/runners/_runner.html.haml b/app/views/projects/runners/_runner.html.haml index 9696a6196b8..3ebd7ace568 100644 --- a/app/views/projects/runners/_runner.html.haml +++ b/app/views/projects/runners/_runner.html.haml @@ -19,10 +19,10 @@ - else = link_button_to nil, resume_project_runner_path(@project, runner), method: :post, title: s_('Runners|Resume accepting jobs'), aria: { label: _('Resume') }, data: { toggle: 'tooltip', container: 'body' }, icon: 'play' - if runner.belongs_to_one_project? - = link_button_to _('Remove runner'), project_runner_path(@project, runner), aria: { label: _('Remove') }, data: { confirm: _("Are you sure?"), 'confirm-btn-variant': 'danger' }, method: :delete, variant: :danger + = link_button_to s_('Runners|Delete runner'), project_runner_path(@project, runner), aria: { label: s_('Runners|Delete runner') }, data: { confirm: _("Are you sure?"), 'confirm-btn-variant': 'danger' }, method: :delete, variant: :danger, category: :secondary - else - runner_project = @project.runner_projects.find_by_runner_id(runner) - = link_button_to _('Disable for this project'), project_runner_project_path(@project, runner_project), aria: { label: _('Disable') }, data: { confirm: _("Are you sure?"), 'confirm-btn-variant': 'danger' }, method: :delete, variant: :danger + = link_button_to _('Disable for this project'), project_runner_project_path(@project, runner_project), aria: { label: _('Disable for this project') }, data: { confirm: _("Are you sure?"), 'confirm-btn-variant': 'danger' }, method: :delete, variant: :danger, category: :secondary - elsif runner.project_type? = form_for [@project, @project.runner_projects.new] do |f| = f.hidden_field :runner_id, value: runner.id diff --git a/config/feature_flags/gitlab_com_derisk/duo_chat_docs_qa_claude_3_7.yml b/config/feature_flags/gitlab_com_derisk/duo_chat_docs_qa_claude_3_7.yml deleted file mode 100644 index 7071d4f42f3..00000000000 --- a/config/feature_flags/gitlab_com_derisk/duo_chat_docs_qa_claude_3_7.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: duo_chat_docs_qa_claude_3_7 -feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/521058 -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182991 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/521833 -milestone: '17.10' -group: group::duo chat -type: gitlab_com_derisk -default_enabled: false diff --git a/danger/qa_selector/Dangerfile b/danger/qa_selector/Dangerfile index 6a177a33166..252790854e6 100644 --- a/danger/qa_selector/Dangerfile +++ b/danger/qa_selector/Dangerfile @@ -49,7 +49,7 @@ if lines_with_testids.any? end markdown(<<~MARKDOWN) - If the `e2e:test-on-omnibus` job in the `qa` stage has run automatically, please ensure the tests are passing. + If the `e2e:test-on-omnibus-ee` job in the `qa` stage has run automatically, please ensure the tests are passing. If the job has not run, please start the `manual:e2e-test-pipeline-generate` job in the `prepare` stage and ensure the tests in `follow-up:e2e:test-on-omnibus-ee` pipeline are passing. For the list of known failures please refer to [the latest pipeline triage issue](https://gitlab.com/gitlab-org/quality/pipeline-triage/-/issues). @@ -58,7 +58,7 @@ if lines_with_testids.any? MARKDOWN - warn "This merge request contains lines with testid selectors. Please ensure `e2e:test-on-omnibus` job is run." + warn "This merge request contains lines with testid selectors. Please ensure `e2e:test-on-omnibus-ee` job is run." end if deprecated_qa_class.any? diff --git a/danger/stable_branch_patch/Dangerfile b/danger/stable_branch_patch/Dangerfile index 55373307c55..eed9f23ba90 100644 --- a/danger/stable_branch_patch/Dangerfile +++ b/danger/stable_branch_patch/Dangerfile @@ -4,9 +4,9 @@ if stable_branch.encourage_package_and_qa_execution? markdown(<<~MARKDOWN) ## `e2e:test-on-omnibus-ee` - **@#{helper.mr_author}, the `e2e:test-on-omnibus` job must complete before merging this merge request.*** + **@#{helper.mr_author}, the `e2e:test-on-omnibus-ee` job must complete before merging this merge request.*** - If the `e2e:test-on-omnibus` pipeline fails and you're unable to diagnose the issue, request assistance in the + If the `e2e:test-on-omnibus-ee` pipeline fails and you're unable to diagnose the issue, request assistance in the `#s_developer_experience` Slack channel to confirm that the failures are unrelated to the merge request. MARKDOWN end diff --git a/db/docs/batched_background_migrations/backfill_namespaces_redirect_routes_namespace_id.yml b/db/docs/batched_background_migrations/backfill_namespaces_redirect_routes_namespace_id.yml new file mode 100644 index 00000000000..630449f94a1 --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_namespaces_redirect_routes_namespace_id.yml @@ -0,0 +1,8 @@ +--- +migration_job_name: BackfillNamespacesRedirectRoutesNamespaceId +description: Backfill the namespace_id for redirect routes with namespace source +feature_category: groups_and_projects +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183967 +milestone: '17.11' +queued_migration_version: 20250310023122 +finalized_by: # version of the migration that finalized this BBM diff --git a/db/docs/batched_background_migrations/backfill_onboarding_status_role.yml b/db/docs/batched_background_migrations/backfill_onboarding_status_role.yml index a02ef7e852d..290b0ebed01 100644 --- a/db/docs/batched_background_migrations/backfill_onboarding_status_role.yml +++ b/db/docs/batched_background_migrations/backfill_onboarding_status_role.yml @@ -3,6 +3,6 @@ migration_job_name: BackfillOnboardingStatusRole description: Moves data from users.role to the new role field in user_details.onboarding_status feature_category: onboarding introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175456 -milestone: '17.8' -queued_migration_version: 20241211202308 -finalized_by: '20250113181303' +milestone: '17.11' +queued_migration_version: 20250320184436 +finalized_by: diff --git a/db/docs/batched_background_migrations/backfill_projects_redirect_routes_namespace_id.yml b/db/docs/batched_background_migrations/backfill_projects_redirect_routes_namespace_id.yml new file mode 100644 index 00000000000..f661c696256 --- /dev/null +++ b/db/docs/batched_background_migrations/backfill_projects_redirect_routes_namespace_id.yml @@ -0,0 +1,8 @@ +--- +migration_job_name: BackfillProjectsRedirectRoutesNamespaceId +description: Backfill the namespace_id for redirect routes with projects source +feature_category: groups_and_projects +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183967 +milestone: '17.11' +queued_migration_version: 20250310023159 +finalized_by: # version of the migration that finalized this BBM diff --git a/db/docs/redirect_routes.yml b/db/docs/redirect_routes.yml index 6a3d738d9b7..4af55017e9c 100644 --- a/db/docs/redirect_routes.yml +++ b/db/docs/redirect_routes.yml @@ -7,5 +7,6 @@ feature_categories: description: Stores routes for redirect after changing the path to group or project introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/11136 milestone: '9.2' -gitlab_schema: gitlab_main_clusterwide +gitlab_schema: gitlab_main_cell +sharding_key_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/514146 table_size: small diff --git a/db/post_migrate/20241211202308_queue_backfill_onboarding_status_role.rb b/db/post_migrate/20241211202308_queue_backfill_onboarding_status_role.rb index 4497270f80d..29ae66d5c4e 100644 --- a/db/post_migrate/20241211202308_queue_backfill_onboarding_status_role.rb +++ b/db/post_migrate/20241211202308_queue_backfill_onboarding_status_role.rb @@ -6,22 +6,12 @@ class QueueBackfillOnboardingStatusRole < Gitlab::Database::Migration[2.2] restrict_gitlab_migration gitlab_schema: :gitlab_main MIGRATION = "BackfillOnboardingStatusRole" - DELAY_INTERVAL = 2.minutes - BATCH_SIZE = 10000 - SUB_BATCH_SIZE = 250 def up - queue_batched_background_migration( - MIGRATION, - :users, - :id, - job_interval: DELAY_INTERVAL, - batch_size: BATCH_SIZE, - sub_batch_size: SUB_BATCH_SIZE - ) + # no-op because we are missing some records due to a bypass in application logic end def down - delete_batched_background_migration(MIGRATION, :users, :id, []) + # no-op end end diff --git a/db/post_migrate/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id.rb b/db/post_migrate/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id.rb new file mode 100644 index 00000000000..85e1167a409 --- /dev/null +++ b/db/post_migrate/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class QueueBackfillNamespacesRedirectRoutesNamespaceId < Gitlab::Database::Migration[2.2] + milestone '17.11' + + restrict_gitlab_migration gitlab_schema: :gitlab_main_cell + + MIGRATION = "BackfillNamespacesRedirectRoutesNamespaceId" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1_000 + MAX_BATCH_SIZE = 10_000 + SUB_BATCH_SIZE = 250 + + def up + queue_batched_background_migration( + MIGRATION, + :redirect_routes, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :redirect_routes, :id, []) + end +end diff --git a/db/post_migrate/20250310023159_queue_backfill_projects_redirect_routes_namespace_id.rb b/db/post_migrate/20250310023159_queue_backfill_projects_redirect_routes_namespace_id.rb new file mode 100644 index 00000000000..0ef663b458e --- /dev/null +++ b/db/post_migrate/20250310023159_queue_backfill_projects_redirect_routes_namespace_id.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class QueueBackfillProjectsRedirectRoutesNamespaceId < Gitlab::Database::Migration[2.2] + milestone '17.11' + + restrict_gitlab_migration gitlab_schema: :gitlab_main_cell + + MIGRATION = "BackfillProjectsRedirectRoutesNamespaceId" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1_000 + MAX_BATCH_SIZE = 10_000 + SUB_BATCH_SIZE = 250 + + def up + queue_batched_background_migration( + MIGRATION, + :redirect_routes, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :redirect_routes, :id, []) + end +end diff --git a/db/post_migrate/20250319154002_remove_conan_package_reference_column_and_temp_index.rb b/db/post_migrate/20250319154002_remove_conan_package_reference_column_and_temp_index.rb new file mode 100644 index 00000000000..1d95a2ba4ba --- /dev/null +++ b/db/post_migrate/20250319154002_remove_conan_package_reference_column_and_temp_index.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class RemoveConanPackageReferenceColumnAndTempIndex < Gitlab::Database::Migration[2.2] + milestone '17.11' + + disable_ddl_transaction! + + TEMP_INDEX_NAME = 'tmp_index_packages_conan_file_metadata_on_id_for_migration' + + def up + remove_concurrent_index_by_name :packages_conan_file_metadata, TEMP_INDEX_NAME + remove_column :packages_conan_file_metadata, :conan_package_reference + end + + def down + add_column :packages_conan_file_metadata, :conan_package_reference, :string, limit: 255, if_not_exists: true + + add_concurrent_index( + :packages_conan_file_metadata, + :id, + where: "package_reference_id IS NULL AND conan_package_reference IS NOT NULL", + name: TEMP_INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20250320184436_requeue_backfill_onboarding_status_role.rb b/db/post_migrate/20250320184436_requeue_backfill_onboarding_status_role.rb new file mode 100644 index 00000000000..d6e35733385 --- /dev/null +++ b/db/post_migrate/20250320184436_requeue_backfill_onboarding_status_role.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class RequeueBackfillOnboardingStatusRole < Gitlab::Database::Migration[2.2] + milestone '17.11' + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = "BackfillOnboardingStatusRole" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10000 + SUB_BATCH_SIZE = 250 + + def up + delete_batched_background_migration(MIGRATION, :users, :id, []) + + queue_batched_background_migration( + MIGRATION, + :users, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :users, :id, []) + end +end diff --git a/db/schema_migrations/20250310023122 b/db/schema_migrations/20250310023122 new file mode 100644 index 00000000000..b9537f73d14 --- /dev/null +++ b/db/schema_migrations/20250310023122 @@ -0,0 +1 @@ +f334e81504256d6e071acda09e0305c980845b96bd0e428411b0ef404a108f66 \ No newline at end of file diff --git a/db/schema_migrations/20250310023159 b/db/schema_migrations/20250310023159 new file mode 100644 index 00000000000..a1526dead00 --- /dev/null +++ b/db/schema_migrations/20250310023159 @@ -0,0 +1 @@ +322be6d8b8249f5b57e0103d730baddfefdc7c346ffef07d4adc3f129d85493e \ No newline at end of file diff --git a/db/schema_migrations/20250319154002 b/db/schema_migrations/20250319154002 new file mode 100644 index 00000000000..624a73b46cc --- /dev/null +++ b/db/schema_migrations/20250319154002 @@ -0,0 +1 @@ +2d2825bf2afae8fe48e0dadd55f95dedb540d1a8b2eb13eaa568b6966411541b \ No newline at end of file diff --git a/db/schema_migrations/20250320184436 b/db/schema_migrations/20250320184436 new file mode 100644 index 00000000000..2206eabbae2 --- /dev/null +++ b/db/schema_migrations/20250320184436 @@ -0,0 +1 @@ +c2db6e6d9092315551c2392c525d73384cb68a9a5a5a8bf84cd23891f15f81c5 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 44714fea5fd..05c4d5cb573 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -18713,7 +18713,6 @@ CREATE TABLE packages_conan_file_metadata ( package_file_id bigint NOT NULL, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, - conan_package_reference character varying(255), conan_file_type smallint NOT NULL, recipe_revision_id bigint, package_revision_id bigint, @@ -38104,8 +38103,6 @@ CREATE INDEX tmp_index_for_null_member_namespace_id ON members USING btree (memb CREATE INDEX tmp_index_for_project_namespace_id_migration_on_routes ON routes USING btree (id) WHERE ((namespace_id IS NULL) AND ((source_type)::text = 'Project'::text)); -CREATE INDEX tmp_index_packages_conan_file_metadata_on_id_for_migration ON packages_conan_file_metadata USING btree (id) WHERE ((package_reference_id IS NULL) AND (conan_package_reference IS NOT NULL)); - CREATE INDEX tmp_index_pats_on_notification_columns_and_expires_at ON personal_access_tokens USING btree (id) WHERE ((expire_notification_delivered IS TRUE) AND (seven_days_notification_sent_at IS NULL) AND (expires_at IS NOT NULL)); CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0); diff --git a/doc/api/admin/token.md b/doc/api/admin/token.md index 958f00d59d3..d6a17107d97 100644 --- a/doc/api/admin/token.md +++ b/doc/api/admin/token.md @@ -123,6 +123,7 @@ Example response: - [Incoming email tokens added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180763) in GitLab 17.9. - [Feature flags client tokens added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181096) in GitLab 17.9. - [Pipeline trigger tokens added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181598) in GitLab 17.10 [with a flag](../../administration/feature_flags.md) named `token_api_expire_pipeline_triggers`. Disabled by default. +- [GitLab sessions added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/184047) in GitLab 17.11. {{< /history >}} @@ -134,7 +135,7 @@ This feature is available for testing, but not ready for production use. {{< /alert >}} -Revokes or resets a given token based on the token type. This endpoint supports the following token types: +Revokes, resets or deletes a given token based on the token type. This endpoint supports the following token types: | Token type | Supported action | |----------------------------------------------------------------------------------------------|--------------------| @@ -150,6 +151,7 @@ Revokes or resets a given token based on the token type. This endpoint supports | [OAuth application secrets](../../integration/oauth_provider.md) | Reset | | [Incoming email tokens](../../security/tokens/_index.md#incoming-email-token) | Reset | | [Feature flags client tokens](../../operations/feature_flags.md#get-access-credentials) | Reset | +| [GitLab session cookies](../../user/profile/active_sessions.md) | Delete | ```plaintext DELETE /api/v4/admin/token diff --git a/doc/api/graphql/reference/_index.md b/doc/api/graphql/reference/_index.md index cf43b3b86b8..9aac635580c 100644 --- a/doc/api/graphql/reference/_index.md +++ b/doc/api/graphql/reference/_index.md @@ -20196,6 +20196,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -21221,6 +21222,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -24036,6 +24038,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -30352,6 +30355,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -30769,6 +30773,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -31237,6 +31242,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -31673,6 +31679,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -38983,6 +38990,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | @@ -43556,11 +43564,25 @@ Values for sorting projects. | Value | Description | | ----- | ----------- | | `ACTIVITY_DESC` | Sort by latest activity, descending order. | +| `BUILD_ARTIFACTS_SIZE_ASC` | Sort by total build artifact size, ascending order. | +| `BUILD_ARTIFACTS_SIZE_DESC` | Sort by total build artifact size, descending order. | +| `CONTAINER_REGISTRY_SIZE_ASC` | Sort by total container registry size, ascending order. | +| `CONTAINER_REGISTRY_SIZE_DESC` | Sort by total container registry size, descending order. | | `EXCESS_REPO_STORAGE_SIZE_DESC` | Sort by excess repository storage size, descending order. | +| `LFS_OBJECTS_SIZE_ASC` | Sort by total LFS object size, ascending order. | +| `LFS_OBJECTS_SIZE_DESC` | Sort by total LFS object size, descending order. | +| `PACKAGES_SIZE_ASC` | Sort by total package size, ascending order. | +| `PACKAGES_SIZE_DESC` | Sort by total package size, descending order. | +| `REPOSITORY_SIZE_ASC` | Sort by total repository size, ascending order. | +| `REPOSITORY_SIZE_DESC` | Sort by total repository size, descending order. | | `SIMILARITY` | Most similar to the search query. | +| `SNIPPETS_SIZE_ASC` | Sort by total snippet size, ascending order. | +| `SNIPPETS_SIZE_DESC` | Sort by total snippet size, descending order. | | `STORAGE` {{< icon name="warning-solid" >}} | **Deprecated** in GitLab 16.9. Please use EXCESS_REPO_STORAGE_SIZE_DESC. | | `STORAGE_SIZE_ASC` | Sort by total storage size, ascending order. | | `STORAGE_SIZE_DESC` | Sort by total storage size, descending order. | +| `WIKI_SIZE_ASC` | Sort by total wiki size, ascending order. | +| `WIKI_SIZE_DESC` | Sort by total wiki size, descending order. | ### `NegatedIterationWildcardId` @@ -47179,6 +47201,7 @@ four standard [pagination arguments](#pagination-arguments): | `iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. | | `in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. | | `includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. | +| `includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. | | `labelName` | [`[String]`](#string) | Labels applied to the merge request. | | `labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. | | `mergedAfter` | [`Time`](#time) | Merge requests merged after the date. | diff --git a/doc/development/build_test_package.md b/doc/development/build_test_package.md index 99ee91ccc74..2a1e8dd9516 100644 --- a/doc/development/build_test_package.md +++ b/doc/development/build_test_package.md @@ -17,7 +17,7 @@ that will create: - The image tag is the commit that triggered the pipeline. When you push a commit to either the GitLab CE or GitLab EE project, the -pipeline for that commit will have a `trigger-omnibus` job inside `e2e:test-on-omnibus` child pipeline in the `.pre` stage. +pipeline for that commit will have a `trigger-omnibus` job inside `e2e:test-on-omnibus-ee` child pipeline in the `.pre` stage. ![Trigger omnibus job](img/trigger_omnibus_v16_3.png) diff --git a/doc/development/fips_gitlab.md b/doc/development/fips_gitlab.md index 491c15efca6..88631628cec 100644 --- a/doc/development/fips_gitlab.md +++ b/doc/development/fips_gitlab.md @@ -568,6 +568,6 @@ Merge requests that can trigger Package and QA, can trigger a FIPS package and a Reference Architecture test pipeline. The base image used for the trigger is Ubuntu 20.04 FIPS: -1. Trigger `e2e:test-on-omnibus` job, if not already triggered. +1. Trigger `e2e:test-on-omnibus-ee` job, if not already triggered. 1. On the `gitlab-omnibus-mirror` child pipeline, manually trigger `Trigger:package:fips`. 1. When the package job is complete, manually trigger the `RAT:FIPS` job. diff --git a/doc/development/geo.md b/doc/development/geo.md index f9261eabc2b..88dd43c8982 100644 --- a/doc/development/geo.md +++ b/doc/development/geo.md @@ -661,7 +661,7 @@ After triggering a successful [e2e:test-on-omnibus-ee](testing_guide/end_to_end/ 1. In the [GitLab project](https://gitlab.com/gitlab-org/gitlab), select the **Pipelines** tab of a merge request. 1. Select the `Stage: qa` stage on the latest pipeline to expand and list all the related jobs. -1. Select trigger job `e2e:test-on-omnibus` to navigate inside child pipeline. +1. Select trigger job `e2e:test-on-omnibus-ee` to navigate inside child pipeline. 1. Select `trigger-omnibus` to view the [Omnibus GitLab Mirror](https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror) pipeline corresponding to the merge request. 1. The `GET:Geo` job can be found and triggered under the `trigger-qa` stage. diff --git a/doc/development/internal_analytics/service_ping/troubleshooting.md b/doc/development/internal_analytics/service_ping/troubleshooting.md index 685ff470c33..6683e33d1ab 100644 --- a/doc/development/internal_analytics/service_ping/troubleshooting.md +++ b/doc/development/internal_analytics/service_ping/troubleshooting.md @@ -63,7 +63,7 @@ This is the recommended approach to test Prometheus-based Service Ping. To verify your change, build a new Omnibus image from your code branch using CI/CD, download the image, and run a local container instance: -1. From your merge request, select the `qa` stage, then trigger the `e2e:test-on-omnibus` job. This job triggers an Omnibus +1. From your merge request, select the `qa` stage, then trigger the `e2e:test-on-omnibus-ee` job. This job triggers an Omnibus build in a [downstream pipeline of the `omnibus-gitlab-mirror` project](https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/pipelines). 1. In the downstream pipeline, wait for the `gitlab-docker` job to finish. 1. Open the job logs and locate the full container name including the version. It takes the following form: `registry.gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:`. diff --git a/doc/development/pipelines/_index.md b/doc/development/pipelines/_index.md index a9418bd47da..30b926d8c34 100644 --- a/doc/development/pipelines/_index.md +++ b/doc/development/pipelines/_index.md @@ -281,7 +281,7 @@ To make your Revert MRs faster, use the [revert MR template](https://gitlab.com/ When this label is assigned, the following steps of the CI/CD pipeline are skipped: -- The `e2e:test-on-omnibus` job. +- The `e2e:test-on-omnibus-ee` job. - The `rspec:undercoverage` job. - The entire [review apps process](../testing_guide/review_apps.md). diff --git a/doc/development/pipelines/internals.md b/doc/development/pipelines/internals.md index 2627575c88f..4e1e899f7de 100644 --- a/doc/development/pipelines/internals.md +++ b/doc/development/pipelines/internals.md @@ -159,6 +159,14 @@ variables have higher precedence over `.gitlab-ci.yml` variables. {{< /alert >}} +## External CI/CD secrets + +As part of , in February 2024, we +started to dogfood [the usage of GCP Secret Manager](../../ci/secrets/gcp_secret_manager.md) to +[store the `ADD_JH_FILES_TOKEN` CI variable](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144228). + +As part of this, [the `qual-ci-secret-mgmt-e78c9b95` GCP project was created](https://gitlab.com/gitlab-org/quality/engineering-productivity-infrastructure/-/issues/99#note_1605141484). + ## Common job definitions Most of the jobs [extend from a few CI definitions](../../ci/yaml/_index.md#extends) diff --git a/doc/development/testing_guide/end_to_end/_index.md b/doc/development/testing_guide/end_to_end/_index.md index 18514b26d07..34336e48106 100644 --- a/doc/development/testing_guide/end_to_end/_index.md +++ b/doc/development/testing_guide/end_to_end/_index.md @@ -33,7 +33,7 @@ We run scheduled pipelines each night to test staging. You can find these pipeli #### Using the test-on-omnibus job -It is possible to run end-to-end tests for a merge request by triggering the `e2e:test-on-omnibus` manual action in the `qa` stage (not available for forks). +It is possible to run end-to-end tests for a merge request by triggering the `e2e:test-on-omnibus-ee` manual action in the `qa` stage (not available for forks). **This runs end-to-end tests against a custom EE (with an Ultimate license) Docker image built from your merge request's changes.** @@ -185,13 +185,13 @@ Provisioning of all components is performed by the [`engineering-productivity-in Use these environment variables to configure metrics export: -| Variable | Required | Information | -| ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `QA_INFLUXDB_URL` | `true` | Should be set to `https://influxdb.quality.gitlab.net`. No default value. | -| `QA_INFLUXDB_TOKEN` | `true` | InfluxDB write token that can be found under `Influxdb auth tokens` document in `Gitlab-QA` `1Password` vault. No default value. | -| `QA_RUN_TYPE` | `false` | Arbitrary name for test execution, like `e2e:test-on-omnibus`. Automatically inferred from the project name for live environment test executions. No default value. | -| `QA_EXPORT_TEST_METRICS` | `false` | Flag to enable or disable metrics export to InfluxDB. Defaults to `false`. | -| `QA_SAVE_TEST_METRICS` | `false` | Flag to enable or disable saving metrics as JSON file. Defaults to `false`. | +| Variable | Required | Information | +| ------------------------ | -------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `QA_INFLUXDB_URL` | `true` | Should be set to `https://influxdb.quality.gitlab.net`. No default value. | +| `QA_INFLUXDB_TOKEN` | `true` | InfluxDB write token that can be found under `Influxdb auth tokens` document in `Gitlab-QA` `1Password` vault. No default value. | +| `QA_RUN_TYPE` | `false` | Arbitrary name for test execution, like `e2e:test-on-omnibus-ee`. Automatically inferred from the project name for live environment test executions. No default value. | +| `QA_EXPORT_TEST_METRICS` | `false` | Flag to enable or disable metrics export to InfluxDB. Defaults to `false`. | +| `QA_SAVE_TEST_METRICS` | `false` | Flag to enable or disable saving metrics as JSON file. Defaults to `false`. | ## How do you run the tests? diff --git a/doc/development/testing_guide/end_to_end/best_practices/feature_flags.md b/doc/development/testing_guide/end_to_end/best_practices/feature_flags.md index ee6a2c7082e..134e8f345b0 100644 --- a/doc/development/testing_guide/end_to_end/best_practices/feature_flags.md +++ b/doc/development/testing_guide/end_to_end/best_practices/feature_flags.md @@ -198,7 +198,7 @@ End-to-end tests should pass with a feature flag enabled before it is enabled on There are two ways to confirm that end-to-end tests pass: - If a merge request adds or edits a [feature flag definition file](../../../feature_flags/_index.md#feature-flag-definition-and-validation), - two `e2e:test-on-omnibus` jobs (`ee:instance-parallel` and `ee:instance-parallel-ff-inverse`) are included automatically in the merge request pipeline. + two `e2e:test-on-omnibus-ee` jobs (`ee:instance-parallel` and `ee:instance-parallel-ff-inverse`) are included automatically in the merge request pipeline. One job runs the application with default feature flag state and another sets it to inverse value. The jobs execute the same suite of tests to confirm that they pass with the feature flag either enabled or disabled. - In some cases, if end-to-end test jobs didn't trigger automatically, or if it has run the tests with the default feature flag values (which might not be desired), you can create a Draft MR that enables the feature flag to ensure that all E2E tests pass with the feature flag enabled and disabled. @@ -217,7 +217,7 @@ If enabling the feature flag results in E2E test failures, you can browse the ar ### Test execution during feature development If an end-to-end test enables a feature flag, the end-to-end test suite can be used to test changes in a merge request -by running the `e2e:test-on-omnibus` job in the merge request pipeline. If the feature flag and relevant changes have already been merged, you can confirm that the tests +by running the `e2e:test-on-omnibus-ee` job in the merge request pipeline. If the feature flag and relevant changes have already been merged, you can confirm that the tests pass on the default branch. The end-to-end tests run on the default branch every two hours, and the results are posted to a [Test Session Report, which is available in the testcase-sessions project](https://gitlab.com/gitlab-org/quality/testcase-sessions/-/issues?label_name%5B%5D=found%3Amain). diff --git a/doc/development/testing_guide/end_to_end/test_pipelines.md b/doc/development/testing_guide/end_to_end/test_pipelines.md index 156505a6830..369b4f16882 100644 --- a/doc/development/testing_guide/end_to_end/test_pipelines.md +++ b/doc/development/testing_guide/end_to_end/test_pipelines.md @@ -71,9 +71,9 @@ To help with debugging: - Cluster events log and all pod logs are saved in E2E test job artifacts. - `orchestrator` automatically outputs all cluster events with errors in the case of failed deployment. -## `e2e:test-on-omnibus` +## `e2e:test-on-omnibus-ee` -The `e2e:test-on-omnibus` child pipeline runs tests against an [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab) installation. This pipeline type is not executed +The `e2e:test-on-omnibus-ee` child pipeline runs tests against an [Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab) installation. This pipeline type is not executed in merge request pipelines by default and can be triggered manually by triggering the `e2e:test-on-omnibus-ee` job. This pipeline type is allowed to fail and even in the case of a manual trigger inside of a merge request pipeline, failing tests will not block the ability to merge. @@ -110,7 +110,7 @@ This stage is responsible for [allure test report](_index.md#allure-report) gene ## `e2e:test-on-gdk` The `e2e:test-on-gdk` child pipeline supports development of the GitLab platform by providing feedback to engineers on -end-to-end test execution faster than via `e2e:test-on-omnibus`. +end-to-end test execution faster than via `e2e:test-on-omnibus-ee`. This is achieved by running tests against the [GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit) (GDK), which can be built and installed in less time than when testing against [Omnibus GitLab](https://gitlab.com/gitlab-org/omnibus-gitlab). diff --git a/doc/update/versions/gitlab_17_changes.md b/doc/update/versions/gitlab_17_changes.md index 590cec8ec59..9e522eba11c 100644 --- a/doc/update/versions/gitlab_17_changes.md +++ b/doc/update/versions/gitlab_17_changes.md @@ -194,6 +194,20 @@ For more information, see [issue 480328](https://gitlab.com/gitlab-org/gitlab/-/ agent_configs_to_remove.delete_all ``` +## Issues to be aware of when upgrading from 17.4 + +- Background job migration failure when upgrading from 17.4 to 17.5 + + When upgrading from 17.4 to 17.5, you can see an error in Sidekiq jobs related to a removed background data migration. The error message looks like this; `uninitialized constant Gitlab::BackgroundMigration::SetProjectVulnerabilityCount`. + + This error will disappear on its own eventually but you can also execute the following script on Rails console to stop seeing the error; + + ```ruby + Gitlab::Database::BackgroundMigration::BatchedMigration.for_configuration( + :gitlab_main, 'SetProjectVulnerabilityCount', :project_settings, :project_id, [] + ).delete_all + ``` + ## Issues to be aware of when upgrading from 17.5 - Migration failures when upgrading from GitLab 17.5. diff --git a/doc/user/gitlab_duo/setup.md b/doc/user/gitlab_duo/setup.md index da1a3b05d2f..863f99b53eb 100644 --- a/doc/user/gitlab_duo/setup.md +++ b/doc/user/gitlab_duo/setup.md @@ -8,7 +8,6 @@ title: Configure GitLab Duo on a GitLab Self-Managed instance {{< details >}} - Offering: GitLab Self-Managed, GitLab Dedicated -- Tier: Premium, Ultimate {{< /details >}} diff --git a/doc/user/gitlab_duo/turn_on_off.md b/doc/user/gitlab_duo/turn_on_off.md index 93fa48c8dfc..78e55afb123 100644 --- a/doc/user/gitlab_duo/turn_on_off.md +++ b/doc/user/gitlab_duo/turn_on_off.md @@ -326,7 +326,7 @@ To turn on GitLab Duo experiment and beta features for an instance: To enable GitLab Duo beta and experimental features for GitLab versions where GitLab Duo Chat is not yet generally available, see the -[GitLab Duo Chat documentation](../gitlab_duo_chat/turn_on_off.md#for-self-managed). +[GitLab Duo Chat documentation](../gitlab_duo_chat/turn_on_off.md#for-gitlab-self-managed). {{< /tab >}} diff --git a/doc/user/gitlab_duo_chat/turn_on_off.md b/doc/user/gitlab_duo_chat/turn_on_off.md index d4e0a06d79a..7e23679c1e4 100644 --- a/doc/user/gitlab_duo_chat/turn_on_off.md +++ b/doc/user/gitlab_duo_chat/turn_on_off.md @@ -16,16 +16,21 @@ In GitLab 16.11 and later, GitLab Duo Chat is: If you [turn on or turn off GitLab Duo](../gitlab_duo/turn_on_off.md), you turn on or turn off Duo Chat as well. -## For self-managed +## For GitLab Self-Managed -To enable GitLab Duo Chat on a GitLab Self-Managed instance, -you must have the following prerequisites. +To use GitLab Duo Chat on a GitLab Self-Managed instance, do one of the following: + +- Use the GitLab AI vendor models and the cloud-based AI gateway that’s hosted by GitLab (default option). +- [Use GitLab Duo Self-Hosted to self-host the AI gateway, with a supported self-hosted LLM](../../administration/gitlab_duo_self_hosted/_index.md#set-up-a-gitlab-duo-self-hosted-infrastructure). Prerequisites: - GitLab Duo requires GitLab 17.2 and later for the best user experience and results. Earlier versions may continue to work, however the experience may be degraded. -- You must have a Premium or Ultimate subscription that is [synchronized with GitLab](https://about.gitlab.com/pricing/licensing-faq/cloud-licensing/). To make sure GitLab Duo Chat works immediately, administrators can +- For subscriptions: + - If you are using GitLab AI vendor models and the cloud-based AI gateway, you + must have a Premium or Ultimate subscription that is [synchronized with GitLab](https://about.gitlab.com/pricing/licensing-faq/cloud-licensing/). To make sure GitLab Duo Chat works immediately, administrators can [manually synchronize your subscription](#manually-synchronize-your-subscription). + - If you are using GitLab Duo Self-Hosted, you must have an Ultimate subscription with the GitLab Duo Enterprise add-on. - You must have [enabled network connectivity](../gitlab_duo/setup.md). - [Silent Mode](../../administration/silent_mode/_index.md) must not be turned on. - All of the users in your instance must have the latest version of their IDE extension. diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb index 586f64cd76c..1427b8eb513 100644 --- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb +++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/change.rb @@ -77,7 +77,7 @@ module Gitlab end def valid? - @identifiers && @title && @description && @changed_files + @identifiers && @title && @description && @changed_files.present? end end end diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb index 624f52974e3..8a91bcee7fc 100644 --- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb +++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb @@ -49,7 +49,7 @@ module Gitlab keep = keep_class.new(logger: @logger, filter_identifiers: @filter_identifiers) keep.each_change do |change| unless change.valid? - @logger.warn "Ignoring invalid change from: #{keep_class}" + @logger.warn "Ignoring invalid change from #{keep_class} with identifier #{change.identifiers}" next end diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb index dbe515e0890..b561a2b8011 100644 --- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb +++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/change_spec.rb @@ -167,5 +167,11 @@ RSpec.describe ::Gitlab::Housekeeper::Change do expect(change).not_to be_valid end end + + it 'is not valid if changed_files is empty' do + change = create_change + change.changed_files = [] + expect(change).not_to be_valid + end end end diff --git a/lib/authn/tokens/gitlab_session.rb b/lib/authn/tokens/gitlab_session.rb index 026ed75d35b..f7bdb5ccead 100644 --- a/lib/authn/tokens/gitlab_session.rb +++ b/lib/authn/tokens/gitlab_session.rb @@ -11,12 +11,14 @@ module Authn "#{Gitlab::Application.config.session_options[:key]}=" end - attr_reader :revocable, :source + attr_reader :revocable, :source, :session_id def initialize(plaintext, source) - session = find_session(plaintext) + @session_id = find_session_id(plaintext) + session = find_session @revocable = Warden::SessionSerializer.new('rack.session' => session).fetch(:user) if session + @source = source end @@ -24,17 +26,21 @@ module Authn ::API::Entities::User end - def revoke!(_current_user) + def revoke!(current_user) raise ::Authn::AgnosticTokenIdentifier::NotFoundError, 'Not Found' if revocable.blank? - raise ::Authn::AgnosticTokenIdentifier::UnsupportedTokenError, 'Revocation not supported for this token type' + Users::DestroySessionService.new(current_user: current_user, user: revocable, + private_session_id: session_id.private_id).execute end private - def find_session(plaintext) + def find_session_id(plaintext) public_session_id = extract_session(plaintext) - session_id = Rack::Session::SessionId.new(public_session_id) + Rack::Session::SessionId.new(public_session_id) + end + + def find_session ActiveSession.sessions_from_ids([session_id.private_id]).first end diff --git a/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id.rb b/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id.rb new file mode 100644 index 00000000000..bf71c761c40 --- /dev/null +++ b/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + class BackfillNamespacesRedirectRoutesNamespaceId < BatchedMigrationJob + operation_name :backfill_namespaces_redirect_routes_namespace_id + feature_category :groups_and_projects + + scope_to ->(relation) do + relation + .joins('inner join namespaces on redirect_routes.source_id = namespaces.id') + .where(source_type: 'Namespace', namespace_id: nil) + .select(:id, 'namespaces.id as namespace_id') + end + + def perform + each_sub_batch do |sub_batch| + connection.execute(<<~SQL) + WITH batched_relation AS (#{sub_batch.to_sql}) + UPDATE redirect_routes + SET namespace_id = batched_relation.namespace_id + FROM batched_relation + WHERE redirect_routes.id = batched_relation.id + SQL + end + end + end + end +end diff --git a/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id.rb b/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id.rb new file mode 100644 index 00000000000..40beaf48362 --- /dev/null +++ b/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + class BackfillProjectsRedirectRoutesNamespaceId < BatchedMigrationJob + operation_name :backfill_projects_redirect_routes_namespace_id + feature_category :groups_and_projects + + scope_to ->(relation) do + relation + .joins('inner join projects on redirect_routes.source_id = projects.id') + .where(source_type: 'Project', namespace_id: nil) + .select(:id, 'projects.project_namespace_id') + end + + def perform + each_sub_batch do |sub_batch| + connection.execute(<<~SQL) + WITH batched_relation AS (#{sub_batch.to_sql}) + UPDATE redirect_routes + SET namespace_id = batched_relation.project_namespace_id + FROM batched_relation + WHERE redirect_routes.id = batched_relation.id + SQL + end + end + end + end +end diff --git a/lib/gitlab/metrics.rb b/lib/gitlab/metrics.rb index e167a67609e..e8ca9a77b28 100644 --- a/lib/gitlab/metrics.rb +++ b/lib/gitlab/metrics.rb @@ -103,7 +103,28 @@ module Gitlab end def self.initialize_slis! - Gitlab::Metrics::SliConfig.enabled_slis.each(&:initialize_slis!) + preload_sli_modules! + + Gitlab::Metrics::SliConfig.enabled_slis.each do |sli| + Gitlab::AppLogger.info "#{self}: enabling #{sli}, runtime=#{Gitlab::Runtime.safe_identify}" + + sli.initialize_slis! + end + end + + def self.preload_sli_modules! + sli_paths = [ + Rails.root.join('lib/gitlab/metrics/*_slis.rb'), + Rails.root.join('ee/lib/gitlab/metrics/*_slis.rb') + ] + Gitlab::AppLogger.info "#{self}: preloading path(s) #{sli_paths.join(', ')}" + + sli_paths.flat_map { |path| Dir.glob(path) }.each do |file| + require_dependency file # rubocop:disable Rails/RequireDependency -- This is required to + # load the SLI implementation modules, as they are not referred directly in code. + # The alternative would be a more convoluted implementation where we camelize and + # constantize based on filenames. + end end end end diff --git a/lib/gitlab/metrics/sli_config.rb b/lib/gitlab/metrics/sli_config.rb index 86b8f26d3af..07b371b3f48 100644 --- a/lib/gitlab/metrics/sli_config.rb +++ b/lib/gitlab/metrics/sli_config.rb @@ -3,32 +3,34 @@ module Gitlab module Metrics module SliConfig + RegisterClass = Data.define(:klass, :is_runtime_enabled_block) do + def enabled_class + klass if is_runtime_enabled_block.call + end + end + def self.registered_classes - @registered_classes ||= {} + @registered_classes ||= Set.new end def self.enabled_slis - SliConfig.registered_classes.filter_map { |_, fn| fn.call } + SliConfig.registered_classes.filter_map(&:enabled_class) end - def self.register(klass, is_runtime_enabled_block) - SliConfig.registered_classes[klass.to_s] = -> do - return unless is_runtime_enabled_block.call - - Gitlab::AppLogger.info "Gitlab::Metrics::SliConfig: enabling #{klass}" - klass - end + def self.register(register_class) + Gitlab::AppLogger.info "#{self} registering #{register_class.klass}, runtime=#{Gitlab::Runtime.safe_identify}" + SliConfig.registered_classes << register_class end module ConfigMethods def puma_enabled!(enable = true) - is_runtime_enabled = -> { enable && Gitlab::Runtime.puma? } - SliConfig.register(self, is_runtime_enabled) + register_class = RegisterClass.new(self, -> { enable && Gitlab::Runtime.puma? }) + SliConfig.register(register_class) end def sidekiq_enabled!(enable = true) - is_runtime_enabled = -> { enable && Gitlab::Runtime.sidekiq? } - SliConfig.register(self, is_runtime_enabled) + register_class = RegisterClass.new(self, -> { enable && Gitlab::Runtime.sidekiq? }) + SliConfig.register(register_class) end end diff --git a/lib/gitlab/quick_actions/work_item_actions.rb b/lib/gitlab/quick_actions/work_item_actions.rb index 8ab158a8d64..841e07ed58a 100644 --- a/lib/gitlab/quick_actions/work_item_actions.rb +++ b/lib/gitlab/quick_actions/work_item_actions.rb @@ -31,12 +31,12 @@ module Gitlab @execution_message[:promote_to] = update_type(type_name, :promote_to) end - desc { _('Change parent') } + desc { _('Set parent item') } explanation do |parent_param| - format(_("Change item's parent to %{parent_ref}."), parent_ref: parent_param) + format(_("Set %{parent_ref} as this item's parent item."), parent_ref: parent_param) end types WorkItem, Issue - params 'Parent #iid, reference or URL' + params 'Parent item\'s #IID, reference, or URL' condition do quick_action_target.supports_parent? && can_admin_set_relation? end @@ -51,10 +51,10 @@ module Gitlab end end - desc { _('Remove parent') } + desc { _('Remove parent item') } explanation do format( - _("Remove %{parent_ref} as this item's parent."), + _("Remove %{parent_ref} as this item's parent item."), parent_ref: work_item_parent.to_reference(quick_action_target) ) end @@ -70,19 +70,19 @@ module Gitlab format(_("Add %{child_ref} as a child item."), child_ref: child_param) end types WorkItem - params 'Children #iids, references or URLs' + params 'Child items\' #IIDs, references, or URLs' condition { supports_children? && can_admin_link? } command :add_child do |child_param| @updates[:add_child] = extract_work_items(child_param) @execution_message[:add_child] = success_msg[:add_child] end - desc { _('Remove child') } + desc { _('Remove child item') } explanation do |child_param| format(_("Remove %{child_ref} as a child item."), child_ref: child_param) end types WorkItem - params 'Child #iid, reference or URL' + params 'Child item\'s #IID, reference, or URL' condition { has_children? && can_admin_link? } command :remove_child do |child_param| @updates[:remove_child] = extract_work_items(child_param).first @@ -163,10 +163,10 @@ module Gitlab { type: _('Type changed successfully.'), promote_to: _("Promoted successfully."), - set_parent: _('Parent set successfully'), - remove_parent: _('Parent removed successfully'), - add_child: _('Child items added successfully'), - remove_child: _('Child item removed successfully') + set_parent: _('Parent item set successfully.'), + remove_parent: _('Parent item removed successfully.'), + add_child: _('Child items added successfully.'), + remove_child: _('Child item removed successfully.') } end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6fcf8dcfeb1..ae63a3aef0a 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11985,9 +11985,6 @@ msgstr "" msgid "Change item type" msgstr "" -msgid "Change item's parent to %{parent_ref}." -msgstr "" - msgid "Change label" msgstr "" @@ -11997,9 +11994,6 @@ msgstr "" msgid "Change milestone" msgstr "" -msgid "Change parent" -msgstr "" - msgid "Change path" msgstr "" @@ -12279,10 +12273,10 @@ msgstr "" msgid "Child issues and epics" msgstr "" -msgid "Child item removed successfully" +msgid "Child item removed successfully." msgstr "" -msgid "Child items added successfully" +msgid "Child items added successfully." msgstr "" msgid "Chinese language support using" @@ -14428,6 +14422,9 @@ msgid_plural "CodeownersValidation|Contains %d syntax errors." msgstr[0] "" msgstr[1] "" +msgid "CodeownersValidation|Contains owners which are not accessible within the project" +msgstr "" + msgid "CodeownersValidation|Contains owners without permission to approve merge requests" msgstr "" @@ -42517,15 +42514,15 @@ msgstr "" msgid "Parent" msgstr "" +msgid "Parent item removed successfully." +msgstr "" + +msgid "Parent item set successfully." +msgstr "" + msgid "Parent pipeline" msgstr "" -msgid "Parent removed successfully" -msgstr "" - -msgid "Parent set successfully" -msgstr "" - msgid "Parse error: Expected `%{expected}`, but got `%{got}`." msgstr "" @@ -48909,7 +48906,7 @@ msgstr "" msgid "Remove %{namespace}" msgstr "" -msgid "Remove %{parent_ref} as this item's parent." +msgid "Remove %{parent_ref} as this item's parent item." msgstr "" msgid "Remove Zoom meeting" @@ -48960,10 +48957,10 @@ msgstr "" msgid "Remove change request" msgstr "" -msgid "Remove child" +msgid "Remove child epic from an epic" msgstr "" -msgid "Remove child epic from an epic" +msgid "Remove child item" msgstr "" msgid "Remove customer relation contacts" @@ -49047,10 +49044,10 @@ msgstr "" msgid "Remove number" msgstr "" -msgid "Remove parent" +msgid "Remove parent epic from an epic" msgstr "" -msgid "Remove parent epic from an epic" +msgid "Remove parent item" msgstr "" msgid "Remove priority" @@ -49062,9 +49059,6 @@ msgstr "" msgid "Remove reviewer" msgstr "" -msgid "Remove runner" -msgstr "" - msgid "Remove search filter" msgstr "" @@ -55459,6 +55453,9 @@ msgstr "" msgid "Set %{epic_ref} as the parent epic." msgstr "" +msgid "Set %{parent_ref} as this item's parent item." +msgstr "" + msgid "Set a default description template to be used for new issues. %{link_start}What are description templates?%{link_end}" msgstr "" @@ -55495,6 +55492,9 @@ msgstr "" msgid "Set parent epic to an epic" msgstr "" +msgid "Set parent item" +msgstr "" + msgid "Set per-user rate limits for imports and exports of projects and groups." msgstr "" @@ -65094,6 +65094,9 @@ msgstr "" msgid "Violation" msgstr "" +msgid "VirtualRegistry|Virtual registries" +msgstr "" + msgid "Visibility" msgstr "" diff --git a/scripts/build_assets_image b/scripts/build_assets_image index 8b61ffd3547..3cfd8d61c22 100755 --- a/scripts/build_assets_image +++ b/scripts/build_assets_image @@ -5,7 +5,7 @@ set -e # This script builds an image that contains assets, that's then used by: # - The `CNG` downstream pipelines (triggered from `gitlab-org/gitlab` via the `review-build-cng` job): # https://gitlab.com/gitlab-org/gitlab/-/blob/c34e0834b01cd45c1f69a01b5e38dd6bc505f903/.gitlab/ci/review-apps/main.gitlab-ci.yml#L69. -# - The `omnibus-gitlab` downstream pipelines (triggered from `gitlab-org/gitlab` via the `e2e:test-on-omnibus` job): +# - The `omnibus-gitlab` downstream pipelines (triggered from `gitlab-org/gitlab` via the `e2e:test-on-omnibus-ee` job): # https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/dfd1ad475868fc84e91ab7b5706aa03e46dc3a86/.gitlab-ci.yml#L130. # - The `gitlab-org/charts/gitlab` `master` pipelines via `gitlab-org/build/CNG`, # which pull `registry.gitlab.com/gitlab-org/gitlab/gitlab-assets-ee:master` diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 3fa1f89fc33..757af278299 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -119,6 +119,23 @@ then ((ERRORCODE++)) fi +# Images in documentation must contain a milestone number in +# the name. +VERSIONLESS_IMAGES=$(find doc -name "*.png" | grep -Ev '_v[0-9][0-9]?_.+\.png$') + +# shellcheck disable=2059 +printf "${COLOR_GREEN}INFO: Checking for images without a milestone in the name...${COLOR_RESET}\n" +if [ -n "${VERSIONLESS_IMAGES}" ] +then + # shellcheck disable=2059 + printf "${COLOR_RED}ERROR: Image names must include a milestone!\n" >&2 + printf "${COLOR_RESET}Append a milestone to the image filename\n\n" >&2 + printf " in the format '_vXX_Y'. For example, 'sample_image_v18_5.png'.\n" >&2 + printf "${COLOR_RED}${VERSIONLESS_IMAGES}${COLOR_RESET}\n\n" + printf "For help, see https://docs.gitlab.com/development/documentation/styleguide/#image-requirements\n" + ((ERRORCODE++)) +fi + FIND_UPPERCASE_FILES=$(find doc -type f -name "*[[:upper:]]*.md") # shellcheck disable=2059 printf "${COLOR_GREEN}INFO: Checking for file names containing an uppercase letter...${COLOR_RESET}\n" diff --git a/spec/features/projects/runners/maintainer_manages_project_runners_spec.rb b/spec/features/projects/runners/maintainer_manages_project_runners_spec.rb index cebfbf9def7..36f7dcc7700 100644 --- a/spec/features/projects/runners/maintainer_manages_project_runners_spec.rb +++ b/spec/features/projects/runners/maintainer_manages_project_runners_spec.rb @@ -56,7 +56,7 @@ RSpec.describe 'Maintainer manages project runners', feature_category: :fleet_vi visit project_runners_path(project) within_testid 'assigned_project_runners' do - click_on 'Remove runner' + click_on 'Delete runner' end expect(page).not_to have_content(project_runner.display_name) diff --git a/spec/finders/merge_requests_finder_spec.rb b/spec/finders/merge_requests_finder_spec.rb index cff3b2ed71b..a8a19df32f8 100644 --- a/spec/finders/merge_requests_finder_spec.rb +++ b/spec/finders/merge_requests_finder_spec.rb @@ -57,6 +57,40 @@ RSpec.describe MergeRequestsFinder, feature_category: :code_review_workflow do end end + context 'filters by author or assignee' do + let_it_be(:merge_request6) do + create( + :merge_request, :simple, :unique_branches, assignees: [user], reviewers: [create(:user)], + source_project: project1, target_project: project1 + ) + end + + let_it_be(:merge_request7) do + create( + :merge_request, :simple, :unique_branches, assignees: [user], reviewers: [create(:user)], + source_project: project1, target_project: project1 + ) + end + + let(:params) { { author_id: user.id, include_assigned: true } } + + it 'returns merge requests the user is an author or an assignee of' do + expect(merge_requests).to contain_exactly(merge_request1, merge_request2, merge_request3, merge_request4, merge_request5, merge_request6, merge_request7) + end + + context 'with review_state' do + let(:params) { { author_id: user.id, include_assigned: true, review_state: 'requested_changes' } } + + before_all do + merge_request7.merge_request_reviewers.update_all(state: :requested_changes) + end + + it 'returns merge requests the user is an author or an assignee of and reviewers with requested_changes' do + expect(merge_requests).to contain_exactly(merge_request7) + end + end + end + context 'with nonexistent author ID and MR term using CTE for search' do let(:params) { { author_id: 'does-not-exist', search: 'git', attempt_group_search_optimizations: true } } diff --git a/spec/graphql/types/namespace_project_sort_enum_spec.rb b/spec/graphql/types/namespace_project_sort_enum_spec.rb new file mode 100644 index 00000000000..007bf97be0d --- /dev/null +++ b/spec/graphql/types/namespace_project_sort_enum_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GitlabSchema.types['NamespaceProjectSort'], feature_category: :groups_and_projects do + specify { expect(described_class.graphql_name).to eq('NamespaceProjectSort') } + + it 'exposes all the existing sort values' do + expect(described_class.values.keys).to include( + *%w[ + SIMILARITY + ACTIVITY_DESC + STORAGE_SIZE_ASC + STORAGE_SIZE_DESC + REPOSITORY_SIZE_ASC + REPOSITORY_SIZE_DESC + SNIPPETS_SIZE_ASC + SNIPPETS_SIZE_DESC + BUILD_ARTIFACTS_SIZE_ASC + BUILD_ARTIFACTS_SIZE_DESC + LFS_OBJECTS_SIZE_ASC + LFS_OBJECTS_SIZE_DESC + PACKAGES_SIZE_ASC + PACKAGES_SIZE_DESC + WIKI_SIZE_ASC + WIKI_SIZE_DESC + CONTAINER_REGISTRY_SIZE_ASC + CONTAINER_REGISTRY_SIZE_DESC + ] + ) + end +end diff --git a/spec/lib/authn/tokens/gitlab_session_spec.rb b/spec/lib/authn/tokens/gitlab_session_spec.rb index c4df261b626..f4f2787ec7d 100644 --- a/spec/lib/authn/tokens/gitlab_session_spec.rb +++ b/spec/lib/authn/tokens/gitlab_session_spec.rb @@ -20,12 +20,12 @@ RSpec.describe Authn::Tokens::GitlabSession, feature_category: :system_access do it_behaves_like 'finding the valid revocable' - describe '#revoke!' do - it 'does not support revocation yet' do - expect do - token.revoke!(user) - end.to raise_error(::Authn::AgnosticTokenIdentifier::UnsupportedTokenError, - 'Revocation not supported for this token type') + describe '#revoke!', :enable_admin_mode do + let_it_be(:admin) { create(:admin) } + + it 'deletes the session' do + expect(ActiveSession).to receive(:destroy_session).with(valid_revocable, rack_session.private_id) + expect(token.revoke!(admin)).to be_success end end end diff --git a/spec/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id_spec.rb b/spec/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id_spec.rb new file mode 100644 index 00000000000..7af139091c8 --- /dev/null +++ b/spec/lib/gitlab/background_migration/backfill_namespaces_redirect_routes_namespace_id_spec.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::BackgroundMigration::BackfillNamespacesRedirectRoutesNamespaceId, + feature_category: :groups_and_projects do + let(:organizations_table) { table(:organizations) } + let(:namespaces_table) { table(:namespaces) } + let(:projects_table) { table(:projects) } + let(:redirect_routes_table) { table(:redirect_routes) } + + let(:connection) { ActiveRecord::Base.connection } + + let!(:organization) { table(:organizations).create!(name: 'organization', path: 'organization') } + let!(:namespace) { create_namespace('Group') } + let!(:route_namespace) { create_namespace('Group') } + let!(:project) do + projects_table.create!( + name: 'project1', organization_id: organization.id, + namespace_id: namespace.id, project_namespace_id: namespace.id + ) + end + + let(:perform_migration) do + described_class.new( + start_id: redirect_routes_table.minimum(:id), + end_id: redirect_routes_table.maximum(:id), + batch_table: :redirect_routes, + batch_column: :id, + sub_batch_size: redirect_routes_table.count, + pause_ms: 0, + connection: connection + ).perform + end + + before do + # This trigger ensures the correctness of new rows, preventing the creation of mock entries + # that simulate old redirect_routes with non-derived namespace_ids. + connection.execute('ALTER TABLE redirect_routes DISABLE TRIGGER trigger_sync_redirect_routes_namespace_id') + end + + after do + connection.execute('ALTER TABLE redirect_routes ENABLE TRIGGER trigger_sync_redirect_routes_namespace_id') + end + + context 'when namespace_id is already set' do + let!(:redirect_route) { create_redirect_route(namespace, namespace_id: route_namespace.id) } + + it 'does not modify the namespace_id' do + expect { perform_migration }.not_to change { redirect_route.reload.namespace_id } + end + end + + context 'when namespace_id is nil' do + context 'when source is a namespace' do + let!(:redirect_route) { create_redirect_route(namespace) } + + it 'derives the namespace_id from source id' do + expect { perform_migration } + .to change { redirect_route.reload.namespace_id }.from(nil).to(namespace.id) + end + end + + context 'when source is a project' do + let!(:redirect_route) { create_redirect_route(project) } + + it 'keeps the namespace_id as nil' do + expect { perform_migration }.not_to change { redirect_route.reload.namespace_id } + end + end + end + + def create_namespace(type) + name = "namespace_#{namespaces_table.count + 1}" + namespaces_table.create!(name: name, path: name, type: type, organization_id: organization.id) + end + + def create_redirect_route(source, namespace_id: nil) + redirect_routes_table.create!( + path: "path_#{redirect_routes_table.count + 1}", + source_id: source.id, + source_type: source.class.sti_name, + namespace_id: namespace_id + ) + end +end diff --git a/spec/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id_spec.rb b/spec/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id_spec.rb new file mode 100644 index 00000000000..9faadc66f01 --- /dev/null +++ b/spec/lib/gitlab/background_migration/backfill_projects_redirect_routes_namespace_id_spec.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::BackgroundMigration::BackfillProjectsRedirectRoutesNamespaceId, + feature_category: :groups_and_projects do + let(:organizations_table) { table(:organizations) } + let(:namespaces_table) { table(:namespaces) } + let(:projects_table) { table(:projects) } + let(:redirect_routes_table) { table(:redirect_routes) } + + let(:connection) { ActiveRecord::Base.connection } + + let!(:organization) { table(:organizations).create!(name: 'organization', path: 'organization') } + let!(:namespace) { create_namespace('Group') } + let!(:route_namespace) { create_namespace('Group') } + let!(:project) do + projects_table.create!( + name: 'project1', organization_id: organization.id, + namespace_id: namespace.id, project_namespace_id: namespace.id + ) + end + + let(:perform_migration) do + described_class.new( + start_id: redirect_routes_table.minimum(:id), + end_id: redirect_routes_table.maximum(:id), + batch_table: :redirect_routes, + batch_column: :id, + sub_batch_size: redirect_routes_table.count, + pause_ms: 0, + connection: connection + ).perform + end + + before do + # This trigger ensures the correctness of new rows, preventing the creation of mock entries + # that simulate old redirect_routes with non-derived namespace_ids. + connection.execute('ALTER TABLE redirect_routes DISABLE TRIGGER trigger_sync_redirect_routes_namespace_id') + end + + after do + connection.execute('ALTER TABLE redirect_routes ENABLE TRIGGER trigger_sync_redirect_routes_namespace_id') + end + + context 'when namespace_id is already set' do + let!(:redirect_route) { create_redirect_route(namespace, namespace_id: route_namespace.id) } + + it 'does not modify the namespace_id' do + expect { perform_migration }.not_to change { redirect_route.reload.namespace_id } + end + end + + context 'when namespace_id is nil' do + context 'when source is a project' do + let!(:redirect_route) { create_redirect_route(project) } + + it 'derives the namespace_id from source id' do + expect { perform_migration } + .to change { redirect_route.reload.namespace_id }.from(nil).to(project.project_namespace_id) + end + end + + context 'when source is a namespace' do + let!(:redirect_route) { create_redirect_route(namespace) } + + it 'keeps the namespace_id as nil' do + expect { perform_migration }.not_to change { redirect_route.reload.namespace_id } + end + end + end + + def create_namespace(type) + name = "namespace_#{namespaces_table.count + 1}" + namespaces_table.create!(name: name, path: name, type: type, organization_id: organization.id) + end + + def create_redirect_route(source, namespace_id: nil) + redirect_routes_table.create!( + path: "path_#{redirect_routes_table.count + 1}", + source_id: source.id, + source_type: source.class.sti_name, + namespace_id: namespace_id + ) + end +end diff --git a/spec/migrations/20241211202308_queue_backfill_onboarding_status_role_spec.rb b/spec/migrations/20241211202308_queue_backfill_onboarding_status_role_spec.rb index 063af0d72b3..7fc77f8c70c 100644 --- a/spec/migrations/20241211202308_queue_backfill_onboarding_status_role_spec.rb +++ b/spec/migrations/20241211202308_queue_backfill_onboarding_status_role_spec.rb @@ -6,20 +6,14 @@ require_migration! RSpec.describe QueueBackfillOnboardingStatusRole, migration: :gitlab_main, feature_category: :onboarding do let!(:batched_migration) { described_class::MIGRATION } - it 'schedules a new batched migration' do + it 'does not schedules a new batched migration' do reversible_migration do |migration| migration.before -> { expect(batched_migration).not_to have_scheduled_batched_migration } migration.after -> { - expect(batched_migration).to have_scheduled_batched_migration( - table_name: :users, - column_name: :id, - interval: described_class::DELAY_INTERVAL, - batch_size: described_class::BATCH_SIZE, - sub_batch_size: described_class::SUB_BATCH_SIZE - ) + expect(batched_migration).not_to have_scheduled_batched_migration } end end diff --git a/spec/migrations/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id_spec.rb b/spec/migrations/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id_spec.rb new file mode 100644 index 00000000000..0c40642d287 --- /dev/null +++ b/spec/migrations/20250310023122_queue_backfill_namespaces_redirect_routes_namespace_id_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe QueueBackfillNamespacesRedirectRoutesNamespaceId, migration: :gitlab_main_cell, feature_category: :groups_and_projects do + let!(:batched_migration) { described_class::MIGRATION } + + it 'schedules a new batched migration' do + reversible_migration do |migration| + migration.before -> { + expect(batched_migration).not_to have_scheduled_batched_migration + } + + migration.after -> { + expect(batched_migration).to have_scheduled_batched_migration( + gitlab_schema: :gitlab_main_cell, + table_name: :redirect_routes, + column_name: :id, + interval: described_class::DELAY_INTERVAL, + batch_size: described_class::BATCH_SIZE, + sub_batch_size: described_class::SUB_BATCH_SIZE, + max_batch_size: described_class::MAX_BATCH_SIZE + ) + } + end + end +end diff --git a/spec/migrations/20250310023159_queue_backfill_projects_redirect_routes_namespace_id_spec.rb b/spec/migrations/20250310023159_queue_backfill_projects_redirect_routes_namespace_id_spec.rb new file mode 100644 index 00000000000..42002799f39 --- /dev/null +++ b/spec/migrations/20250310023159_queue_backfill_projects_redirect_routes_namespace_id_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe QueueBackfillProjectsRedirectRoutesNamespaceId, migration: :gitlab_main_cell, feature_category: :groups_and_projects do + let!(:batched_migration) { described_class::MIGRATION } + + it 'schedules a new batched migration' do + reversible_migration do |migration| + migration.before -> { + expect(batched_migration).not_to have_scheduled_batched_migration + } + + migration.after -> { + expect(batched_migration).to have_scheduled_batched_migration( + gitlab_schema: :gitlab_main_cell, + table_name: :redirect_routes, + column_name: :id, + interval: described_class::DELAY_INTERVAL, + batch_size: described_class::BATCH_SIZE, + sub_batch_size: described_class::SUB_BATCH_SIZE, + max_batch_size: described_class::MAX_BATCH_SIZE + ) + } + end + end +end diff --git a/spec/migrations/20250320184436_requeue_backfill_onboarding_status_role_spec.rb b/spec/migrations/20250320184436_requeue_backfill_onboarding_status_role_spec.rb new file mode 100644 index 00000000000..4ca0dc00d10 --- /dev/null +++ b/spec/migrations/20250320184436_requeue_backfill_onboarding_status_role_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe RequeueBackfillOnboardingStatusRole, migration: :gitlab_main, feature_category: :onboarding do + let!(:batched_migration) { described_class::MIGRATION } + + it 'schedules a new batched migration' do + reversible_migration do |migration| + migration.before -> { + expect(batched_migration).not_to have_scheduled_batched_migration + } + + migration.after -> { + expect(batched_migration).to have_scheduled_batched_migration( + table_name: :users, + column_name: :id, + interval: described_class::DELAY_INTERVAL, + batch_size: described_class::BATCH_SIZE, + sub_batch_size: described_class::SUB_BATCH_SIZE + ) + } + end + end +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 9d7acc8498d..3722a409ac9 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2311,12 +2311,6 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr let_it_be(:project2) { create(:project, star_count: 1) } let_it_be(:project3) { create(:project, last_activity_at: 2.minutes.ago) } - before_all do - create(:project_statistics, project: project1, repository_size: 1) - create(:project_statistics, project: project2, repository_size: 3) - create(:project_statistics, project: project3, repository_size: 2) - end - it 'reorders the input relation by start count desc' do projects = described_class.sort_by_attribute(:stars_desc) @@ -2347,16 +2341,54 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr expect(projects).to eq([project1, project2, project3].sort_by(&:path).reverse) end - it 'reorders the input relation by storage size asc' do - projects = described_class.sort_by_attribute(:storage_size_asc) + context 'with project_statistics' do + describe '.sort_by_attribute with project_statistics' do + def create_project_statistics_with_size(project, size) + create(:project_statistics, + project: project, + repository_size: size, + snippets_size: size, + build_artifacts_size: size, + lfs_objects_size: size, + packages_size: size, + wiki_size: size, + container_registry_size: size).project + end - expect(projects).to eq([project1, project3, project2]) - end + let_it_be(:project4) { create(:project) } - it 'reorders the input relation by storage size desc' do - projects = described_class.sort_by_attribute(:storage_size_desc) + before_all do + create_project_statistics_with_size(project1, 1) + create_project_statistics_with_size(project2, 3) + create_project_statistics_with_size(project3, 2) + create_project_statistics_with_size(project4, 2) + end - expect(projects).to eq([project2, project3, project1]) + where(:ascending, :descending) do + :storage_size_asc | :storage_size_desc + :repository_size_asc | :repository_size_desc + :snippets_size_asc | :snippets_size_desc + :build_artifacts_size_asc | :build_artifacts_size_desc + :lfs_objects_size_asc | :lfs_objects_size_desc + :packages_size_asc | :packages_size_desc + :wiki_size_asc | :wiki_size_desc + :container_registry_size_asc | :container_registry_size_desc + end + + with_them do + context 'ascending' do + it 'sorts by attribute ascending first and id descending second' do + expect(described_class.sort_by_attribute(ascending)).to eq([project1, project4, project3, project2]) + end + end + + context 'descending' do + it 'sorts by attribute descending first and id descending second' do + expect(described_class.sort_by_attribute(descending)).to eq([project2, project4, project3, project1]) + end + end + end + end end end diff --git a/spec/requests/api/admin/token_spec.rb b/spec/requests/api/admin/token_spec.rb index 25bc08b639d..9e25ea9296a 100644 --- a/spec/requests/api/admin/token_spec.rb +++ b/spec/requests/api/admin/token_spec.rb @@ -149,13 +149,13 @@ RSpec.describe API::Admin::Token, :aggregate_failures, feature_category: :system end context 'with an unknown session' do - let(:session_id) { '_gitlab_session=unknown' } + let(:session_id) { 'unknown' } it_behaves_like 'returning response status', :not_found end context 'with an empty session' do - let(:plaintext) { "_gitlab_session=" } + let(:session_id) { '' } it_behaves_like 'returning response status', :not_found end @@ -260,6 +260,40 @@ RSpec.describe API::Admin::Token, :aggregate_failures, feature_category: :system end end + context 'with _gitlab_session' do + let(:session_id) { 'session_id' } + let(:plaintext) { "_gitlab_session=#{session_id}" } + + context 'with a valid session in ActiveSession' do + before do + rack_session = Rack::Session::SessionId.new(session_id) + allow(ActiveSession).to receive(:sessions_from_ids) + .with([rack_session.private_id]).and_return([{ 'warden.user.user.key' => [[user.id], + user.authenticatable_salt] }]) + end + + it 'deletes the session' do + delete_token + + expect(response).to have_gitlab_http_status(:no_content) + end + + it_behaves_like 'delete_successful_interval_event_tracking' + end + + context 'with an unknown session' do + let(:session_id) { 'unknown' } + + it_behaves_like 'returning response status', :not_found + end + + context 'with an empty session' do + let(:plaintext) { "_gitlab_session=" } + + it_behaves_like 'returning response status', :not_found + end + end + context 'when the revocation feature is disabled' do before do stub_feature_flags(api_admin_token_revoke: false) diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index e69e2b8db36..c4457d040e6 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -3334,7 +3334,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :text_editors d it 'returns success message' do _, _, message = service.execute(content, task_work_item) - expect(message).to eq(_('Parent set successfully')) + expect(message).to eq(_('Parent item set successfully.')) end it 'sets correct update params' do @@ -3466,7 +3466,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :text_editors d it 'returns correct explanation' do _, explanations = service.explain(content, work_item) - translated_string = _("Remove %{parent_to_reference} as this item's parent.") + translated_string = _("Remove %{parent_to_reference} as this item's parent item.") formatted_message = format(translated_string, parent_to_reference: parent.to_reference(work_item).to_s) expect(explanations) @@ -3477,7 +3477,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :text_editors d _, updates, message = service.execute(content, work_item) expect(updates).to eq(remove_parent: true) - expect(message).to eq(_('Parent removed successfully')) + expect(message).to eq(_('Parent item removed successfully.')) end end end @@ -4122,7 +4122,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :text_editors d shared_examples 'command is available' do it 'explanation contains correct message' do _, explanations = service.explain(command, work_item) - translated_string = _("Change item's parent to %{parent_ref}.") + translated_string = _("Set %{parent_ref} as this item's parent item.") formatted_message = format(translated_string, parent_ref: parent_ref.to_s) expect(explanations).to contain_exactly(formatted_message) diff --git a/spec/services/users/destroy_session_service_spec.rb b/spec/services/users/destroy_session_service_spec.rb new file mode 100644 index 00000000000..706678b6485 --- /dev/null +++ b/spec/services/users/destroy_session_service_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Users::DestroySessionService, :aggregate_failures, feature_category: :user_management do + let_it_be(:user_with_session) { create(:user) } + let(:session_id) { 'session_id' } + let(:plaintext) { "_gitlab_session=#{session_id}" } + let(:rack_session) { Rack::Session::SessionId.new(session_id) } + let(:session_hash) { { 'warden.user.user.key' => [[user_with_session.id], user_with_session.authenticatable_salt] } } + + subject(:execute) do + described_class.new(current_user: current_user, user: user_with_session, + private_session_id: rack_session.private_id).execute + end + + context 'when missing permission' do + let_it_be(:current_user) { create(:user) } + + it 'returns forbidden' do + expect(execute).to be_error + expect(execute.reason).to eq(:forbidden) + end + end + + context 'as an admin', :enable_admin_mode do + let_it_be(:current_user) { create(:admin) } + + context 'with a valid gitlab session in ActiveSession' do + before do + allow(ActiveSession).to receive(:sessions_from_ids).with([rack_session.private_id]).and_return([session_hash]) + end + + it 'destroys the session' do + expect(ActiveSession).to receive(:destroy_session).with(user_with_session, rack_session.private_id) + expect(execute).to be_success + end + end + end +end