Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2025-03-26 12:11:45 +00:00
parent 30d09c7737
commit 0016ea0586
88 changed files with 1013 additions and 222 deletions

View File

@ -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:

View File

@ -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

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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,
};

View File

@ -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 {

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'))

View File

@ -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{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
f334e81504256d6e071acda09e0305c980845b96bd0e428411b0ef404a108f66

View File

@ -0,0 +1 @@
322be6d8b8249f5b57e0103d730baddfefdc7c346ffef07d4adc3f129d85493e

View File

@ -0,0 +1 @@
2d2825bf2afae8fe48e0dadd55f95dedb540d1a8b2eb13eaa568b6966411541b

View File

@ -0,0 +1 @@
c2db6e6d9092315551c2392c525d73384cb68a9a5a5a8bf84cd23891f15f81c5

View File

@ -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);

View File

@ -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

View File

@ -20196,6 +20196,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="addonuserauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="addonuserauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="addonuserauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="addonuserauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="addonuserauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="addonuserauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="addonuserauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -21221,6 +21222,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="autocompleteduserauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="autocompleteduserauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="autocompleteduserauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="autocompleteduserauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="autocompleteduserauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="autocompleteduserauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="autocompleteduserauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -24036,6 +24038,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="currentuserauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="currentuserauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="currentuserauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="currentuserauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="currentuserauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="currentuserauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="currentuserauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -30352,6 +30355,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="mergerequestassigneeauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="mergerequestassigneeauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="mergerequestassigneeauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="mergerequestassigneeauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="mergerequestassigneeauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="mergerequestassigneeauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="mergerequestassigneeauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -30769,6 +30773,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="mergerequestauthorauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="mergerequestauthorauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="mergerequestauthorauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="mergerequestauthorauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="mergerequestauthorauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="mergerequestauthorauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="mergerequestauthorauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -31237,6 +31242,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="mergerequestparticipantauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="mergerequestparticipantauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="mergerequestparticipantauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="mergerequestparticipantauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="mergerequestparticipantauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="mergerequestparticipantauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="mergerequestparticipantauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -31673,6 +31679,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="mergerequestreviewerauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="mergerequestreviewerauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="mergerequestreviewerauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="mergerequestreviewerauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="mergerequestreviewerauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="mergerequestreviewerauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="mergerequestreviewerauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -38983,6 +38990,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="usercoreauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="usercoreauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="usercoreauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="usercoreauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="usercoreauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="usercoreauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="usercoreauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |
@ -43556,11 +43564,25 @@ Values for sorting projects.
| Value | Description |
| ----- | ----------- |
| <a id="namespaceprojectsortactivity_desc"></a>`ACTIVITY_DESC` | Sort by latest activity, descending order. |
| <a id="namespaceprojectsortbuild_artifacts_size_asc"></a>`BUILD_ARTIFACTS_SIZE_ASC` | Sort by total build artifact size, ascending order. |
| <a id="namespaceprojectsortbuild_artifacts_size_desc"></a>`BUILD_ARTIFACTS_SIZE_DESC` | Sort by total build artifact size, descending order. |
| <a id="namespaceprojectsortcontainer_registry_size_asc"></a>`CONTAINER_REGISTRY_SIZE_ASC` | Sort by total container registry size, ascending order. |
| <a id="namespaceprojectsortcontainer_registry_size_desc"></a>`CONTAINER_REGISTRY_SIZE_DESC` | Sort by total container registry size, descending order. |
| <a id="namespaceprojectsortexcess_repo_storage_size_desc"></a>`EXCESS_REPO_STORAGE_SIZE_DESC` | Sort by excess repository storage size, descending order. |
| <a id="namespaceprojectsortlfs_objects_size_asc"></a>`LFS_OBJECTS_SIZE_ASC` | Sort by total LFS object size, ascending order. |
| <a id="namespaceprojectsortlfs_objects_size_desc"></a>`LFS_OBJECTS_SIZE_DESC` | Sort by total LFS object size, descending order. |
| <a id="namespaceprojectsortpackages_size_asc"></a>`PACKAGES_SIZE_ASC` | Sort by total package size, ascending order. |
| <a id="namespaceprojectsortpackages_size_desc"></a>`PACKAGES_SIZE_DESC` | Sort by total package size, descending order. |
| <a id="namespaceprojectsortrepository_size_asc"></a>`REPOSITORY_SIZE_ASC` | Sort by total repository size, ascending order. |
| <a id="namespaceprojectsortrepository_size_desc"></a>`REPOSITORY_SIZE_DESC` | Sort by total repository size, descending order. |
| <a id="namespaceprojectsortsimilarity"></a>`SIMILARITY` | Most similar to the search query. |
| <a id="namespaceprojectsortsnippets_size_asc"></a>`SNIPPETS_SIZE_ASC` | Sort by total snippet size, ascending order. |
| <a id="namespaceprojectsortsnippets_size_desc"></a>`SNIPPETS_SIZE_DESC` | Sort by total snippet size, descending order. |
| <a id="namespaceprojectsortstorage"></a>`STORAGE` {{< icon name="warning-solid" >}} | **Deprecated** in GitLab 16.9. Please use EXCESS_REPO_STORAGE_SIZE_DESC. |
| <a id="namespaceprojectsortstorage_size_asc"></a>`STORAGE_SIZE_ASC` | Sort by total storage size, ascending order. |
| <a id="namespaceprojectsortstorage_size_desc"></a>`STORAGE_SIZE_DESC` | Sort by total storage size, descending order. |
| <a id="namespaceprojectsortwiki_size_asc"></a>`WIKI_SIZE_ASC` | Sort by total wiki size, ascending order. |
| <a id="namespaceprojectsortwiki_size_desc"></a>`WIKI_SIZE_DESC` | Sort by total wiki size, descending order. |
### `NegatedIterationWildcardId`
@ -47179,6 +47201,7 @@ four standard [pagination arguments](#pagination-arguments):
| <a id="userauthoredmergerequestsiids"></a>`iids` | [`[String!]`](#string) | Array of IIDs of merge requests, for example `[1, 2]`. |
| <a id="userauthoredmergerequestsin"></a>`in` | [`[IssuableSearchableField!]`](#issuablesearchablefield) | Specify the fields to perform the search in. Defaults to `[TITLE, DESCRIPTION]`. Requires the `search` argument.'. |
| <a id="userauthoredmergerequestsincludearchived"></a>`includeArchived` | [`Boolean`](#boolean) | Merge requests from archived projects. |
| <a id="userauthoredmergerequestsincludeassigned"></a>`includeAssigned` | [`Boolean`](#boolean) | Include merge requests the user is assigned to. |
| <a id="userauthoredmergerequestslabelname"></a>`labelName` | [`[String]`](#string) | Labels applied to the merge request. |
| <a id="userauthoredmergerequestslabels"></a>`labels` {{< icon name="warning-solid" >}} | [`[String!]`](#string) | **Deprecated** in GitLab 17.1. Use `labelName`. |
| <a id="userauthoredmergerequestsmergedafter"></a>`mergedAfter` | [`Time`](#time) | Merge requests merged after the date. |

View File

@ -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)

View File

@ -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.

View File

@ -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.

View File

@ -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:<VERSION>`.

View File

@ -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).

View File

@ -159,6 +159,14 @@ variables have higher precedence over `.gitlab-ci.yml` variables.
{{< /alert >}}
## External CI/CD secrets
As part of <https://gitlab.com/groups/gitlab-org/quality/engineering-productivity/-/epics/46>, 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)

View File

@ -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?

View File

@ -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).

View File

@ -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).

View File

@ -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.

View File

@ -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 >}}

View File

@ -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 >}}

View File

@ -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 thats 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.

View File

@ -77,7 +77,7 @@ module Gitlab
end
def valid?
@identifiers && @title && @description && @changed_files
@identifiers && @title && @description && @changed_files.present?
end
end
end

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 ""

View File

@ -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`

View File

@ -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"

View File

@ -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)

View File

@ -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 } }

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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