diff --git a/app/controllers/concerns/check_codeowner_rules.rb b/app/controllers/concerns/check_codeowner_rules.rb new file mode 100644 index 00000000000..87947a356f7 --- /dev/null +++ b/app/controllers/concerns/check_codeowner_rules.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CheckCodeownerRules + extend ActiveSupport::Concern + + def codeowners_check_error(project, branch_name, paths) + ::Gitlab::CodeOwners::Validator.new(project, branch_name, paths).execute + end +end diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 584320a66de..d044548e147 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -9,6 +9,7 @@ class Projects::BlobController < Projects::ApplicationController include ActionView::Helpers::SanitizeHelper include RedirectsForMissingPathOnTree include SourcegraphDecorator + include CheckCodeownerRules prepend_before_action :authenticate_user!, only: [:edit] @@ -28,6 +29,7 @@ class Projects::BlobController < Projects::ApplicationController before_action :editor_variables, except: [:show, :preview, :diff] before_action :validate_diff_params, only: :diff before_action :set_last_commit_sha, only: [:edit, :update] + before_action :validate_codeowner_rules, only: [:create, :update] before_action only: :show do push_frontend_feature_flag(:code_navigation, @project) @@ -71,6 +73,7 @@ class Projects::BlobController < Projects::ApplicationController def update @path = params[:file_path] if params[:file_path].present? + create_commit(Files::UpdateService, success_path: -> { after_edit_path }, failure_view: :edit, failure_path: project_blob_path(@project, @id)) @@ -115,6 +118,19 @@ class Projects::BlobController < Projects::ApplicationController private + def validate_codeowner_rules + return if params[:file_path].blank? + + codeowners_error = codeowners_check_error(@project, @branch_name, params[:file_path]) + + if codeowners_error.present? + flash.now[:alert] = codeowners_error + view = params[:action] == 'update' ? :edit : :new + + render view + end + end + def blob @blob ||= @repository.blob_at(@commit.id, @path) diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 8dc54ee4ea0..8b3ecd32ca3 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -249,9 +249,7 @@ module Projects end end -# rubocop: disable Cop/InjectEnterpriseEditionModule Projects::CreateService.prepend_if_ee('EE::Projects::CreateService') -# rubocop: enable Cop/InjectEnterpriseEditionModule # Measurable should be at the bottom of the ancestor chain, so it will measure execution of EE::Projects::CreateService as well Projects::CreateService.prepend(Measurable) diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index 449c4c3de6b..b4abb5b6df7 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -149,9 +149,7 @@ module Projects end end -# rubocop: disable Cop/InjectEnterpriseEditionModule Projects::ImportService.prepend_if_ee('EE::Projects::ImportService') -# rubocop: enable Cop/InjectEnterpriseEditionModule # Measurable should be at the bottom of the ancestor chain, so it will measure execution of EE::Projects::ImportService as well Projects::ImportService.prepend(Measurable) diff --git a/app/services/spam/spam_action_service.rb b/app/services/spam/spam_action_service.rb index f0a4aff4443..731afb631b5 100644 --- a/app/services/spam/spam_action_service.rb +++ b/app/services/spam/spam_action_service.rb @@ -49,7 +49,8 @@ module Spam # ask the SpamVerdictService what to do with the target. spam_verdict_service.execute.tap do |result| case result - when REQUIRE_RECAPTCHA + when CONDITIONAL_ALLOW + # at the moment, this means "ask for reCAPTCHA" create_spam_log(api) break if target.allow_possible_spam? diff --git a/app/services/spam/spam_constants.rb b/app/services/spam/spam_constants.rb index 26526daa313..2a16cfae78b 100644 --- a/app/services/spam/spam_constants.rb +++ b/app/services/spam/spam_constants.rb @@ -2,7 +2,7 @@ module Spam module SpamConstants - REQUIRE_RECAPTCHA = "recaptcha" + CONDITIONAL_ALLOW = "conditional_allow" DISALLOW = "disallow" ALLOW = "allow" BLOCK_USER = "block" @@ -14,7 +14,7 @@ module Spam DISALLOW => { priority: 2 }, - REQUIRE_RECAPTCHA => { + CONDITIONAL_ALLOW => { priority: 3 }, ALLOW => { diff --git a/app/services/spam/spam_verdict_service.rb b/app/services/spam/spam_verdict_service.rb index ef026d7f9af..9705d8fc451 100644 --- a/app/services/spam/spam_verdict_service.rb +++ b/app/services/spam/spam_verdict_service.rb @@ -31,7 +31,7 @@ module Spam def akismet_verdict if akismet.spam? - Gitlab::Recaptcha.enabled? ? REQUIRE_RECAPTCHA : DISALLOW + Gitlab::Recaptcha.enabled? ? CONDITIONAL_ALLOW : DISALLOW else ALLOW end diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 1454ededc04..f06b6f83e88 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -10,6 +10,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: authorized_project_update:authorized_project_update_user_refresh_with_low_urgency :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -17,6 +18,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: auto_devops:auto_devops_disable :feature_category: :auto_devops :has_external_dependencies: @@ -24,6 +26,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: auto_merge:auto_merge_process :feature_category: :continuous_delivery :has_external_dependencies: @@ -31,6 +34,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: chaos:chaos_cpu_spin :feature_category: :not_owned :has_external_dependencies: @@ -38,6 +42,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: chaos:chaos_db_spin :feature_category: :not_owned :has_external_dependencies: @@ -45,6 +50,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: chaos:chaos_kill :feature_category: :not_owned :has_external_dependencies: @@ -52,6 +58,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: chaos:chaos_leak_mem :feature_category: :not_owned :has_external_dependencies: @@ -59,6 +66,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: chaos:chaos_sleep :feature_category: :not_owned :has_external_dependencies: @@ -66,6 +74,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: container_repository:cleanup_container_repository :feature_category: :container_registry :has_external_dependencies: @@ -73,6 +82,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: container_repository:delete_container_repository :feature_category: :container_registry :has_external_dependencies: @@ -80,6 +90,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:admin_email :feature_category: :source_code_management :has_external_dependencies: @@ -87,6 +98,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:ci_archive_traces_cron :feature_category: :continuous_integration :has_external_dependencies: @@ -94,6 +106,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:container_expiration_policy :feature_category: :container_registry :has_external_dependencies: @@ -101,6 +114,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:environments_auto_stop_cron :feature_category: :continuous_delivery :has_external_dependencies: @@ -108,6 +122,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:expire_build_artifacts :feature_category: :continuous_integration :has_external_dependencies: @@ -115,6 +130,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:gitlab_usage_ping :feature_category: :collection :has_external_dependencies: @@ -122,6 +138,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:import_export_project_cleanup :feature_category: :importers :has_external_dependencies: @@ -129,6 +146,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:issue_due_scheduler :feature_category: :issue_tracking :has_external_dependencies: @@ -136,6 +154,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:namespaces_prune_aggregation_schedules :feature_category: :source_code_management :has_external_dependencies: @@ -143,6 +162,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:pages_domain_removal_cron :feature_category: :pages :has_external_dependencies: @@ -150,6 +170,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:pages_domain_ssl_renewal_cron :feature_category: :pages :has_external_dependencies: @@ -157,6 +178,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:pages_domain_verification_cron :feature_category: :pages :has_external_dependencies: @@ -164,6 +186,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:personal_access_tokens_expiring :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -171,6 +194,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:pipeline_schedule :feature_category: :continuous_integration :has_external_dependencies: @@ -178,6 +202,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:prune_old_events :feature_category: :users :has_external_dependencies: @@ -185,6 +210,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:prune_web_hook_logs :feature_category: :integrations :has_external_dependencies: @@ -192,6 +218,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:remove_expired_group_links :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -199,6 +226,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:remove_expired_members :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -206,6 +234,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:remove_unreferenced_lfs_objects :feature_category: :git_lfs :has_external_dependencies: @@ -213,6 +242,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:repository_archive_cache :feature_category: :source_code_management :has_external_dependencies: @@ -220,6 +250,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:repository_check_dispatch :feature_category: :source_code_management :has_external_dependencies: @@ -227,6 +258,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:requests_profiles :feature_category: :source_code_management :has_external_dependencies: @@ -234,6 +266,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:schedule_migrate_external_diffs :feature_category: :source_code_management :has_external_dependencies: @@ -241,6 +274,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:stuck_ci_jobs :feature_category: :continuous_integration :has_external_dependencies: @@ -248,6 +282,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:stuck_export_jobs :feature_category: :importers :has_external_dependencies: @@ -255,6 +290,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:stuck_import_jobs :feature_category: :importers :has_external_dependencies: @@ -262,6 +298,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: cronjob:stuck_merge_jobs :feature_category: :source_code_management :has_external_dependencies: @@ -269,6 +306,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:trending_projects :feature_category: :source_code_management :has_external_dependencies: @@ -276,6 +314,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:users_create_statistics :feature_category: :users :has_external_dependencies: @@ -283,6 +322,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: cronjob:x509_issuer_crl_check :feature_category: :source_code_management :has_external_dependencies: true @@ -290,6 +330,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: deployment:deployments_finished :feature_category: :continuous_delivery :has_external_dependencies: @@ -297,6 +338,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: deployment:deployments_forward_deployment :feature_category: :continuous_delivery :has_external_dependencies: @@ -304,6 +346,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: + :tags: [] - :name: deployment:deployments_success :feature_category: :continuous_delivery :has_external_dependencies: @@ -311,6 +354,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_configure_istio :feature_category: :kubernetes_management :has_external_dependencies: true @@ -318,6 +362,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_install_app :feature_category: :kubernetes_management :has_external_dependencies: true @@ -325,6 +370,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_patch_app :feature_category: :kubernetes_management :has_external_dependencies: true @@ -332,6 +378,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_provision :feature_category: :kubernetes_management :has_external_dependencies: true @@ -339,6 +386,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_update_app :feature_category: :kubernetes_management :has_external_dependencies: @@ -346,6 +394,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_upgrade_app :feature_category: :kubernetes_management :has_external_dependencies: true @@ -353,6 +402,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_wait_for_app_installation :feature_category: :kubernetes_management :has_external_dependencies: true @@ -360,6 +410,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_wait_for_app_update :feature_category: :kubernetes_management :has_external_dependencies: @@ -367,6 +418,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:cluster_wait_for_ingress_ip_address :feature_category: :kubernetes_management :has_external_dependencies: true @@ -374,6 +426,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_applications_activate_service :feature_category: :kubernetes_management :has_external_dependencies: @@ -381,6 +434,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_applications_deactivate_service :feature_category: :kubernetes_management :has_external_dependencies: @@ -388,6 +442,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_applications_uninstall :feature_category: :kubernetes_management :has_external_dependencies: true @@ -395,6 +450,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_applications_wait_for_uninstall_app :feature_category: :kubernetes_management :has_external_dependencies: true @@ -402,6 +458,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_cleanup_app :feature_category: :kubernetes_management :has_external_dependencies: true @@ -409,6 +466,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_cleanup_project_namespace :feature_category: :kubernetes_management :has_external_dependencies: true @@ -416,6 +474,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:clusters_cleanup_service_account :feature_category: :kubernetes_management :has_external_dependencies: true @@ -423,6 +482,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gcp_cluster:wait_for_cluster_creation :feature_category: :kubernetes_management :has_external_dependencies: true @@ -430,6 +490,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_import_diff_note :feature_category: :importers :has_external_dependencies: true @@ -437,6 +498,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_import_issue :feature_category: :importers :has_external_dependencies: true @@ -444,6 +506,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_import_lfs_object :feature_category: :importers :has_external_dependencies: true @@ -451,6 +514,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_import_note :feature_category: :importers :has_external_dependencies: true @@ -458,6 +522,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_import_pull_request :feature_category: :importers :has_external_dependencies: true @@ -465,6 +530,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_refresh_import_jid :feature_category: :importers :has_external_dependencies: @@ -472,6 +538,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_finish_import :feature_category: :importers :has_external_dependencies: @@ -479,6 +546,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_import_base_data :feature_category: :importers :has_external_dependencies: @@ -486,6 +554,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_import_issues_and_diff_notes :feature_category: :importers :has_external_dependencies: @@ -493,6 +562,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_import_lfs_objects :feature_category: :importers :has_external_dependencies: @@ -500,6 +570,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_import_notes :feature_category: :importers :has_external_dependencies: @@ -507,6 +578,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_import_pull_requests :feature_category: :importers :has_external_dependencies: @@ -514,6 +586,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_importer:github_import_stage_import_repository :feature_category: :importers :has_external_dependencies: @@ -521,6 +594,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: hashed_storage:hashed_storage_migrator :feature_category: :source_code_management :has_external_dependencies: @@ -528,6 +602,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: hashed_storage:hashed_storage_project_migrate :feature_category: :source_code_management :has_external_dependencies: @@ -535,6 +610,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: hashed_storage:hashed_storage_project_rollback :feature_category: :source_code_management :has_external_dependencies: @@ -542,6 +618,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: hashed_storage:hashed_storage_rollbacker :feature_category: :source_code_management :has_external_dependencies: @@ -549,6 +626,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: incident_management:incident_management_process_alert :feature_category: :incident_management :has_external_dependencies: @@ -556,6 +634,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: incident_management:incident_management_process_prometheus_alert :feature_category: :incident_management :has_external_dependencies: @@ -563,6 +642,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: jira_importer:jira_import_advance_stage :feature_category: :importers :has_external_dependencies: @@ -570,6 +650,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_import_issue :feature_category: :importers :has_external_dependencies: @@ -577,6 +658,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_stage_finish_import :feature_category: :importers :has_external_dependencies: @@ -584,6 +666,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_stage_import_attachments :feature_category: :importers :has_external_dependencies: @@ -591,6 +674,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_stage_import_issues :feature_category: :importers :has_external_dependencies: @@ -598,6 +682,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_stage_import_labels :feature_category: :importers :has_external_dependencies: @@ -605,6 +690,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_stage_import_notes :feature_category: :importers :has_external_dependencies: @@ -612,6 +698,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: jira_importer:jira_import_stage_start_import :feature_category: :importers :has_external_dependencies: @@ -619,6 +706,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: mail_scheduler:mail_scheduler_issue_due :feature_category: :issue_tracking :has_external_dependencies: @@ -626,6 +714,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: mail_scheduler:mail_scheduler_notification_service :feature_category: :issue_tracking :has_external_dependencies: @@ -633,6 +722,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: notifications:new_release :feature_category: :release_orchestration :has_external_dependencies: @@ -640,6 +730,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: object_pool:object_pool_create :feature_category: :gitaly :has_external_dependencies: @@ -647,6 +738,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: object_pool:object_pool_destroy :feature_category: :gitaly :has_external_dependencies: @@ -654,6 +746,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: object_pool:object_pool_join :feature_category: :gitaly :has_external_dependencies: @@ -661,6 +754,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: object_pool:object_pool_schedule_join :feature_category: :gitaly :has_external_dependencies: @@ -668,6 +762,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: object_storage:object_storage_background_move :feature_category: :not_owned :has_external_dependencies: @@ -675,6 +770,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: object_storage:object_storage_migrate_uploads :feature_category: :not_owned :has_external_dependencies: @@ -682,6 +778,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: pipeline_background:archive_trace :feature_category: :continuous_integration :has_external_dependencies: @@ -689,6 +786,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: pipeline_background:ci_build_trace_chunk_flush :feature_category: :continuous_integration :has_external_dependencies: @@ -696,6 +794,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: pipeline_background:ci_daily_build_group_report_results :feature_category: :continuous_integration :has_external_dependencies: @@ -703,6 +802,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: pipeline_cache:expire_job_cache :feature_category: :continuous_integration :has_external_dependencies: @@ -710,6 +810,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: true + :tags: [] - :name: pipeline_cache:expire_pipeline_cache :feature_category: :continuous_integration :has_external_dependencies: @@ -717,6 +818,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: true + :tags: [] - :name: pipeline_creation:create_pipeline :feature_category: :continuous_integration :has_external_dependencies: @@ -724,6 +826,7 @@ :resource_boundary: :cpu :weight: 4 :idempotent: + :tags: [] - :name: pipeline_creation:run_pipeline_schedule :feature_category: :continuous_integration :has_external_dependencies: @@ -731,6 +834,7 @@ :resource_boundary: :unknown :weight: 4 :idempotent: + :tags: [] - :name: pipeline_default:build_coverage :feature_category: :continuous_integration :has_external_dependencies: @@ -738,6 +842,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: + :tags: [] - :name: pipeline_default:build_trace_sections :feature_category: :continuous_integration :has_external_dependencies: @@ -745,6 +850,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: + :tags: [] - :name: pipeline_default:ci_create_cross_project_pipeline :feature_category: :continuous_integration :has_external_dependencies: @@ -752,6 +858,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: pipeline_default:ci_pipeline_bridge_status :feature_category: :continuous_integration :has_external_dependencies: @@ -759,6 +866,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: pipeline_default:pipeline_metrics :feature_category: :continuous_integration :has_external_dependencies: @@ -766,6 +874,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: + :tags: [] - :name: pipeline_default:pipeline_notification :feature_category: :continuous_integration :has_external_dependencies: @@ -773,6 +882,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: pipeline_default:pipeline_update_ci_ref_status :feature_category: :continuous_integration :has_external_dependencies: @@ -780,6 +890,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: pipeline_hooks:build_hooks :feature_category: :continuous_integration :has_external_dependencies: @@ -787,6 +898,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: pipeline_hooks:pipeline_hooks :feature_category: :continuous_integration :has_external_dependencies: @@ -794,6 +906,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: pipeline_processing:build_finished :feature_category: :continuous_integration :has_external_dependencies: @@ -801,6 +914,7 @@ :resource_boundary: :cpu :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:build_queue :feature_category: :continuous_integration :has_external_dependencies: @@ -808,6 +922,7 @@ :resource_boundary: :cpu :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:build_success :feature_category: :continuous_integration :has_external_dependencies: @@ -815,6 +930,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:ci_build_prepare :feature_category: :continuous_integration :has_external_dependencies: @@ -822,6 +938,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:ci_build_schedule :feature_category: :continuous_integration :has_external_dependencies: @@ -829,6 +946,7 @@ :resource_boundary: :cpu :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:ci_resource_groups_assign_resource_from_resource_group :feature_category: :continuous_delivery :has_external_dependencies: @@ -836,6 +954,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:pipeline_process :feature_category: :continuous_integration :has_external_dependencies: @@ -843,6 +962,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:pipeline_update :feature_category: :continuous_integration :has_external_dependencies: @@ -850,6 +970,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: + :tags: [] - :name: pipeline_processing:stage_update :feature_category: :continuous_integration :has_external_dependencies: @@ -857,6 +978,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: true + :tags: [] - :name: pipeline_processing:update_head_pipeline_for_merge_request :feature_category: :continuous_integration :has_external_dependencies: @@ -864,6 +986,7 @@ :resource_boundary: :cpu :weight: 5 :idempotent: true + :tags: [] - :name: repository_check:repository_check_batch :feature_category: :source_code_management :has_external_dependencies: @@ -871,6 +994,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: repository_check:repository_check_clear :feature_category: :source_code_management :has_external_dependencies: @@ -878,6 +1002,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: repository_check:repository_check_single_repository :feature_category: :source_code_management :has_external_dependencies: @@ -885,6 +1010,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: todos_destroyer:todos_destroyer_confidential_issue :feature_category: :issue_tracking :has_external_dependencies: @@ -892,6 +1018,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: todos_destroyer:todos_destroyer_entity_leave :feature_category: :issue_tracking :has_external_dependencies: @@ -899,6 +1026,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: todos_destroyer:todos_destroyer_group_private :feature_category: :issue_tracking :has_external_dependencies: @@ -906,6 +1034,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: todos_destroyer:todos_destroyer_private_features :feature_category: :issue_tracking :has_external_dependencies: @@ -913,6 +1042,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: todos_destroyer:todos_destroyer_project_private :feature_category: :issue_tracking :has_external_dependencies: @@ -920,6 +1050,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: update_namespace_statistics:namespaces_root_statistics :feature_category: :source_code_management :has_external_dependencies: @@ -927,6 +1058,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: update_namespace_statistics:namespaces_schedule_aggregation :feature_category: :source_code_management :has_external_dependencies: @@ -934,6 +1066,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: authorized_keys :feature_category: :source_code_management :has_external_dependencies: @@ -941,6 +1074,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: true + :tags: [] - :name: authorized_projects :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -948,6 +1082,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: true + :tags: [] - :name: background_migration :feature_category: :database :has_external_dependencies: @@ -955,6 +1090,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: chat_notification :feature_category: :chatops :has_external_dependencies: true @@ -962,6 +1098,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: create_commit_signature :feature_category: :source_code_management :has_external_dependencies: @@ -969,6 +1106,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: true + :tags: [] - :name: create_evidence :feature_category: :release_evidence :has_external_dependencies: @@ -976,6 +1114,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: create_note_diff_file :feature_category: :source_code_management :has_external_dependencies: @@ -983,6 +1122,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: default :feature_category: :has_external_dependencies: @@ -990,6 +1130,7 @@ :resource_boundary: :weight: 1 :idempotent: + :tags: [] - :name: delete_diff_files :feature_category: :source_code_management :has_external_dependencies: @@ -997,6 +1138,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: delete_merged_branches :feature_category: :source_code_management :has_external_dependencies: @@ -1004,6 +1146,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: delete_stored_files :feature_category: :not_owned :has_external_dependencies: @@ -1011,6 +1154,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: delete_user :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -1018,6 +1162,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: design_management_new_version :feature_category: :design_management :has_external_dependencies: @@ -1025,6 +1170,7 @@ :resource_boundary: :memory :weight: 1 :idempotent: + :tags: [] - :name: detect_repository_languages :feature_category: :source_code_management :has_external_dependencies: @@ -1032,6 +1178,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: email_receiver :feature_category: :issue_tracking :has_external_dependencies: @@ -1039,6 +1186,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: emails_on_push :feature_category: :source_code_management :has_external_dependencies: @@ -1046,6 +1194,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: error_tracking_issue_link :feature_category: :error_tracking :has_external_dependencies: true @@ -1053,6 +1202,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: expire_build_instance_artifacts :feature_category: :continuous_integration :has_external_dependencies: @@ -1060,6 +1210,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: export_csv :feature_category: :issue_tracking :has_external_dependencies: @@ -1067,6 +1218,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: external_service_reactive_caching :feature_category: :not_owned :has_external_dependencies: true @@ -1074,6 +1226,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: file_hook :feature_category: :integrations :has_external_dependencies: @@ -1081,6 +1234,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: git_garbage_collect :feature_category: :gitaly :has_external_dependencies: @@ -1088,6 +1242,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: github_import_advance_stage :feature_category: :importers :has_external_dependencies: @@ -1095,6 +1250,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: gitlab_shell :feature_category: :source_code_management :has_external_dependencies: @@ -1102,6 +1258,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: group_destroy :feature_category: :subgroups :has_external_dependencies: @@ -1109,6 +1266,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: group_export :feature_category: :importers :has_external_dependencies: @@ -1116,6 +1274,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: group_import :feature_category: :importers :has_external_dependencies: @@ -1123,6 +1282,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: import_issues_csv :feature_category: :issue_tracking :has_external_dependencies: @@ -1130,6 +1290,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: invalid_gpg_signature_update :feature_category: :source_code_management :has_external_dependencies: @@ -1137,6 +1298,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: irker :feature_category: :integrations :has_external_dependencies: @@ -1144,6 +1306,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: mailers :feature_category: :has_external_dependencies: @@ -1151,6 +1314,7 @@ :resource_boundary: :weight: 2 :idempotent: + :tags: [] - :name: merge :feature_category: :source_code_management :has_external_dependencies: @@ -1158,6 +1322,7 @@ :resource_boundary: :unknown :weight: 5 :idempotent: + :tags: [] - :name: merge_request_mergeability_check :feature_category: :source_code_management :has_external_dependencies: @@ -1165,6 +1330,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: migrate_external_diffs :feature_category: :source_code_management :has_external_dependencies: @@ -1172,6 +1338,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: namespaceless_project_destroy :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -1179,6 +1346,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: new_issue :feature_category: :issue_tracking :has_external_dependencies: @@ -1186,6 +1354,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: new_merge_request :feature_category: :source_code_management :has_external_dependencies: @@ -1193,6 +1362,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: new_note :feature_category: :issue_tracking :has_external_dependencies: @@ -1200,6 +1370,7 @@ :resource_boundary: :cpu :weight: 2 :idempotent: + :tags: [] - :name: pages :feature_category: :pages :has_external_dependencies: @@ -1207,6 +1378,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: pages_domain_ssl_renewal :feature_category: :pages :has_external_dependencies: @@ -1214,6 +1386,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: pages_domain_verification :feature_category: :pages :has_external_dependencies: @@ -1221,6 +1394,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: phabricator_import_import_tasks :feature_category: :importers :has_external_dependencies: @@ -1228,6 +1402,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: post_receive :feature_category: :source_code_management :has_external_dependencies: @@ -1235,6 +1410,7 @@ :resource_boundary: :cpu :weight: 5 :idempotent: + :tags: [] - :name: process_commit :feature_category: :source_code_management :has_external_dependencies: @@ -1242,6 +1418,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: true + :tags: [] - :name: project_cache :feature_category: :source_code_management :has_external_dependencies: @@ -1249,6 +1426,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: project_daily_statistics :feature_category: :source_code_management :has_external_dependencies: @@ -1256,6 +1434,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: project_destroy :feature_category: :source_code_management :has_external_dependencies: @@ -1263,6 +1442,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: project_export :feature_category: :importers :has_external_dependencies: @@ -1270,6 +1450,7 @@ :resource_boundary: :memory :weight: 1 :idempotent: + :tags: [] - :name: project_service :feature_category: :integrations :has_external_dependencies: true @@ -1277,6 +1458,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: project_update_repository_storage :feature_category: :gitaly :has_external_dependencies: @@ -1284,6 +1466,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: prometheus_create_default_alerts :feature_category: :incident_management :has_external_dependencies: @@ -1291,6 +1474,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: propagate_integration :feature_category: :integrations :has_external_dependencies: @@ -1298,6 +1482,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] - :name: propagate_service_template :feature_category: :source_code_management :has_external_dependencies: @@ -1305,6 +1490,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: reactive_caching :feature_category: :not_owned :has_external_dependencies: @@ -1312,6 +1498,7 @@ :resource_boundary: :cpu :weight: 1 :idempotent: + :tags: [] - :name: rebase :feature_category: :source_code_management :has_external_dependencies: @@ -1319,6 +1506,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: remote_mirror_notification :feature_category: :source_code_management :has_external_dependencies: @@ -1326,6 +1514,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: repository_cleanup :feature_category: :source_code_management :has_external_dependencies: @@ -1333,6 +1522,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: repository_fork :feature_category: :source_code_management :has_external_dependencies: @@ -1340,6 +1530,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: repository_import :feature_category: :importers :has_external_dependencies: true @@ -1347,6 +1538,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: repository_remove_remote :feature_category: :source_code_management :has_external_dependencies: @@ -1354,6 +1546,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: repository_update_remote_mirror :feature_category: :source_code_management :has_external_dependencies: true @@ -1361,6 +1554,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: self_monitoring_project_create :feature_category: :metrics :has_external_dependencies: @@ -1368,6 +1562,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: self_monitoring_project_delete :feature_category: :metrics :has_external_dependencies: @@ -1375,6 +1570,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: + :tags: [] - :name: system_hook_push :feature_category: :source_code_management :has_external_dependencies: @@ -1382,6 +1578,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: update_external_pull_requests :feature_category: :source_code_management :has_external_dependencies: @@ -1389,6 +1586,7 @@ :resource_boundary: :unknown :weight: 3 :idempotent: + :tags: [] - :name: update_highest_role :feature_category: :authentication_and_authorization :has_external_dependencies: @@ -1396,6 +1594,7 @@ :resource_boundary: :unknown :weight: 2 :idempotent: true + :tags: [] - :name: update_merge_requests :feature_category: :source_code_management :has_external_dependencies: @@ -1403,6 +1602,7 @@ :resource_boundary: :cpu :weight: 3 :idempotent: + :tags: [] - :name: update_project_statistics :feature_category: :source_code_management :has_external_dependencies: @@ -1410,6 +1610,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: upload_checksum :feature_category: :geo_replication :has_external_dependencies: @@ -1417,6 +1618,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: web_hook :feature_category: :integrations :has_external_dependencies: true @@ -1424,6 +1626,7 @@ :resource_boundary: :unknown :weight: 1 :idempotent: + :tags: [] - :name: x509_certificate_revoke :feature_category: :source_code_management :has_external_dependencies: @@ -1431,3 +1634,4 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true + :tags: [] diff --git a/app/workers/concerns/worker_attributes.rb b/app/workers/concerns/worker_attributes.rb index b60179531af..7fa56c25210 100644 --- a/app/workers/concerns/worker_attributes.rb +++ b/app/workers/concerns/worker_attributes.rb @@ -111,6 +111,14 @@ module WorkerAttributes 1 end + def tags(*values) + worker_attributes[:tags] = values + end + + def get_tags + Array(worker_attributes[:tags]) + end + protected # Returns a worker attribute declared on this class or its parent class. diff --git a/changelogs/unreleased/add-tags-to-queue-attributes.yml b/changelogs/unreleased/add-tags-to-queue-attributes.yml new file mode 100644 index 00000000000..fd609109a67 --- /dev/null +++ b/changelogs/unreleased/add-tags-to-queue-attributes.yml @@ -0,0 +1,5 @@ +--- +title: Add tags to experimental queue selector attributes +merge_request: 32651 +author: +type: added diff --git a/changelogs/unreleased/jej-api-for-root-groups.yml b/changelogs/unreleased/jej-api-for-root-groups.yml new file mode 100644 index 00000000000..d859273f912 --- /dev/null +++ b/changelogs/unreleased/jej-api-for-root-groups.yml @@ -0,0 +1,5 @@ +--- +title: Groups API has top_level_only option to exclude subgroups +merge_request: 32870 +author: +type: added diff --git a/changelogs/unreleased/skip-importing-failed-jira-issue-instead-of-entrire-batch.yml b/changelogs/unreleased/skip-importing-failed-jira-issue-instead-of-entrire-batch.yml new file mode 100644 index 00000000000..89e4261c40d --- /dev/null +++ b/changelogs/unreleased/skip-importing-failed-jira-issue-instead-of-entrire-batch.yml @@ -0,0 +1,5 @@ +--- +title: Skip the individual JIRA issues if failed to import vs failing the whole batch +merge_request: 32673 +author: +type: fixed diff --git a/doc/administration/operations/extra_sidekiq_processes.md b/doc/administration/operations/extra_sidekiq_processes.md index 8f54b82c325..4e214383351 100644 --- a/doc/administration/operations/extra_sidekiq_processes.md +++ b/doc/administration/operations/extra_sidekiq_processes.md @@ -126,6 +126,8 @@ in a more general way using the following components: ### Available attributes +- [Introduced](https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/261) in GitLab 13.1, `tags`. + From the [list of all available attributes](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/workers/all_queues.yml), `experimental_queue_selector` allows selecting of queues by the @@ -144,14 +146,21 @@ following attributes: - `name` - the queue name. The other attributes are typically more useful as they are more general, but this is available in case a particular queue needs to be selected. -- `resource_boundary` - if the worker is bound by `cpu`, `memory`, or +- `resource_boundary` - if the queue is bound by `cpu`, `memory`, or `unknown`. For example, the `project_export` queue is memory bound as it has to load data in memory before saving it for export. +- `tags` - short-lived annotations for queues. These are expected to frequently + change from release to release, and may be removed entirely. `has_external_dependencies` is a boolean attribute: only the exact string `true` is considered true, and everything else is considered false. +`tags` is a set, which means that `=` checks for intersecting sets, and +`!=` checks for disjoint sets. For example, `tags=a,b` selects queues +that have tags `a`, `b`, or both. `tags!=a,b` selects queues that have +neither of those tags. + ### Available operators `experimental_queue_selector` supports the following operators, listed diff --git a/doc/api/groups.md b/doc/api/groups.md index 724302f9db8..0c2b6874c0f 100644 --- a/doc/api/groups.md +++ b/doc/api/groups.md @@ -20,6 +20,7 @@ Parameters: | `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) | | `owned` | boolean | no | Limit to groups explicitly owned by the current user | | `min_access_level` | integer | no | Limit to groups where current user has at least this [access level](members.md) | +| `top_level_only` | boolean | no | Limit to top level groups, excluding all subgroups | ```plaintext GET /groups diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index f0465edf06b..664a2820a5b 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -3790,7 +3790,7 @@ Example: .something_after: &something_after - echo 'something after' - +- echo 'another thing after' job_name: before_script: diff --git a/doc/development/i18n/translation.md b/doc/development/i18n/translation.md index e1c02c2c9c2..1ddd39bd6d1 100644 --- a/doc/development/i18n/translation.md +++ b/doc/development/i18n/translation.md @@ -61,8 +61,12 @@ This helps maintain a logical connection and consistency between tools (e.g. ### Formality -The level of formality used in software varies by language. -For example, in French we translate `you` as the formal `vous`. +The level of formality used in software varies by language: + +| Language | Formality | Example | +| -------- | --------- | ------- | +| French | formal | `vous` for `you` | +| German | informal | `du` for `you` | You can refer to other translated strings and notes in the glossary to assist determining a suitable level of formality. diff --git a/doc/user/application_security/dast/index.md b/doc/user/application_security/dast/index.md index 3ca88acf35a..a3cf1288128 100644 --- a/doc/user/application_security/dast/index.md +++ b/doc/user/application_security/dast/index.md @@ -605,24 +605,22 @@ There are two formats of data in the JSON report that are used side by side: ### Other formats -Reports can also be generated in Markdown, HTML, and XML. - -Reports can be published as artifacts using the following configuration: +Reports can also be generated in Markdown, HTML, and XML. These can be published as artifacts using the following configuration: ```yaml include: template: DAST.gitlab-ci.yml dast: - script: - - export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)} - - /analyze -r report.html -w report.md -x report.xml -t $DAST_WEBSITE - - cp /zap/wrk/report.{html,md,xml} "$PWD" + variables: + DAST_HTML_REPORT: report.html + DAST_MARKDOWN_REPORT: report.md + DAST_XML_REPORT: report.xml artifacts: paths: - - report.html - - report.md - - report.xml + - $DAST_HTML_REPORT + - $DAST_MARKDOWN_REPORT + - $DAST_XML_REPORT - gl-dast-report.json ``` diff --git a/lib/api/groups.rb b/lib/api/groups.rb index 353c8b4b242..e3f2f62d9da 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -23,13 +23,20 @@ module API optional :order_by, type: String, values: %w[name path id], default: 'name', desc: 'Order by name, path or id' optional :sort, type: String, values: %w[asc desc], default: 'asc', desc: 'Sort by asc (ascending) or desc (descending)' optional :min_access_level, type: Integer, values: Gitlab::Access.all_values, desc: 'Minimum access level of authenticated user' + optional :top_level_only, type: Boolean, desc: 'Only include top level groups' use :pagination end # rubocop: disable CodeReuse/ActiveRecord def find_groups(params, parent_id = nil) find_params = params.slice(:all_available, :custom_attributes, :owned, :min_access_level) - find_params[:parent] = find_group!(parent_id) if parent_id + + find_params[:parent] = if params[:top_level_only] + [nil] + elsif parent_id + find_group!(parent_id) + end + find_params[:all_available] = find_params.fetch(:all_available, current_user&.can_read_all_resources?) diff --git a/lib/gitlab/jira_import/issues_importer.rb b/lib/gitlab/jira_import/issues_importer.rb index 8c18e58d9df..26fa01755d1 100644 --- a/lib/gitlab/jira_import/issues_importer.rb +++ b/lib/gitlab/jira_import/issues_importer.rb @@ -57,17 +57,27 @@ module Gitlab # For such cases we exit early if issue was already imported. next if already_imported?(jira_issue.id) - issue_attrs = IssueSerializer.new(project, jira_issue, running_import.user_id, { iid: next_iid }).execute - Gitlab::JiraImport::ImportIssueWorker.perform_async(project.id, jira_issue.id, issue_attrs, job_waiter.key) + begin + issue_attrs = IssueSerializer.new(project, jira_issue, running_import.user_id, { iid: next_iid }).execute - job_waiter.jobs_remaining += 1 - next_iid += 1 + Gitlab::JiraImport::ImportIssueWorker.perform_async(project.id, jira_issue.id, issue_attrs, job_waiter.key) - # Mark the issue as imported immediately so we don't end up - # importing it multiple times within same import. - # These ids are cleaned-up when import finishes. - # see Gitlab::JiraImport::Stage::FinishImportWorker - mark_as_imported(jira_issue.id) + job_waiter.jobs_remaining += 1 + next_iid += 1 + + # Mark the issue as imported immediately so we don't end up + # importing it multiple times within same import. + # These ids are cleaned-up when import finishes. + # see Gitlab::JiraImport::Stage::FinishImportWorker + mark_as_imported(jira_issue.id) + rescue => ex + # handle exceptionn here and skip the failed to import issue, instead of + # failing to import the entire batch of issues + + # track the failed to import issue. + Gitlab::ErrorTracking.track_exception(ex, project_id: project.id) + JiraImport.increment_issue_failures(project.id) + end end job_waiter diff --git a/lib/gitlab/sidekiq_config.rb b/lib/gitlab/sidekiq_config.rb index 4e0d3da1868..633291dcdf3 100644 --- a/lib/gitlab/sidekiq_config.rb +++ b/lib/gitlab/sidekiq_config.rb @@ -14,8 +14,8 @@ module Gitlab ].compact.freeze DEFAULT_WORKERS = [ - DummyWorker.new('default', weight: 1), - DummyWorker.new('mailers', weight: 2) + DummyWorker.new('default', weight: 1, tags: []), + DummyWorker.new('mailers', weight: 2, tags: []) ].map { |worker| Gitlab::SidekiqConfig::Worker.new(worker, ee: false) }.freeze class << self diff --git a/lib/gitlab/sidekiq_config/cli_methods.rb b/lib/gitlab/sidekiq_config/cli_methods.rb index 0d0efe8ffbd..a256632bc12 100644 --- a/lib/gitlab/sidekiq_config/cli_methods.rb +++ b/lib/gitlab/sidekiq_config/cli_methods.rb @@ -28,6 +28,7 @@ module Gitlab has_external_dependencies: lambda { |value| value == 'true' }, name: :to_s, resource_boundary: :to_sym, + tags: :to_sym, urgency: :to_sym }.freeze @@ -117,7 +118,11 @@ module Gitlab raise UnknownPredicate.new("Unknown predicate: #{lhs}") unless values_block - lambda { |queue| values.map(&values_block).include?(queue[lhs.to_sym]) } + lambda do |queue| + comparator = Array(queue[lhs.to_sym]).to_set + + values.map(&values_block).to_set.intersect?(comparator) + end end end end diff --git a/lib/gitlab/sidekiq_config/dummy_worker.rb b/lib/gitlab/sidekiq_config/dummy_worker.rb index bd205c81931..7568840410b 100644 --- a/lib/gitlab/sidekiq_config/dummy_worker.rb +++ b/lib/gitlab/sidekiq_config/dummy_worker.rb @@ -12,7 +12,8 @@ module Gitlab urgency: :get_urgency, resource_boundary: :get_worker_resource_boundary, idempotent: :idempotent?, - weight: :get_weight + weight: :get_weight, + tags: :get_tags }.freeze def initialize(queue, attributes = {}) diff --git a/lib/gitlab/sidekiq_config/worker.rb b/lib/gitlab/sidekiq_config/worker.rb index ec7a82f6459..46fa0aa5be1 100644 --- a/lib/gitlab/sidekiq_config/worker.rb +++ b/lib/gitlab/sidekiq_config/worker.rb @@ -6,7 +6,7 @@ module Gitlab include Comparable attr_reader :klass - delegate :feature_category_not_owned?, :get_feature_category, + delegate :feature_category_not_owned?, :get_feature_category, :get_tags, :get_urgency, :get_weight, :get_worker_resource_boundary, :idempotent?, :queue, :queue_namespace, :worker_has_external_dependencies?, @@ -52,7 +52,8 @@ module Gitlab urgency: get_urgency, resource_boundary: get_worker_resource_boundary, weight: get_weight, - idempotent: idempotent? + idempotent: idempotent?, + tags: get_tags } end diff --git a/rubocop/cop/inject_enterprise_edition_module.rb b/rubocop/cop/inject_enterprise_edition_module.rb index 7edce94eaee..16e4b647265 100644 --- a/rubocop/cop/inject_enterprise_edition_module.rb +++ b/rubocop/cop/inject_enterprise_edition_module.rb @@ -2,9 +2,8 @@ module RuboCop module Cop - # Cop that blacklists the injecting of EE specific modules anywhere but on - # the last line of a file. Injecting a module in the middle of a file will - # cause merge conflicts, while placing it on the last line will not. + # Cop that blacklists the injecting of EE specific modules before any lines which are not already injecting another module. + # It allows multiple module injections as long as they're all at the end. class InjectEnterpriseEditionModule < RuboCop::Cop::Cop INVALID_LINE = 'Injecting EE modules must be done on the last line of this file' \ ', outside of any class or module definitions' @@ -17,10 +16,12 @@ module RuboCop CHECK_LINE_METHODS = Set.new(%i[include_if_ee extend_if_ee prepend_if_ee]).freeze - CHECK_LINE_METHODS_REGEXP = Regexp.union(CHECK_LINE_METHODS.map(&:to_s)).freeze - DISALLOW_METHODS = Set.new(%i[include extend prepend]).freeze + COMMENT_OR_EMPTY_LINE = /^\s*(#.*|$)/.freeze + + CHECK_LINE_METHODS_REGEXP = Regexp.union((CHECK_LINE_METHODS + DISALLOW_METHODS).map(&:to_s) + [COMMENT_OR_EMPTY_LINE]).freeze + def ee_const?(node) line = node.location.expression.source_line @@ -44,15 +45,11 @@ module RuboCop line = node.location.line buffer = node.location.expression.source_buffer last_line = buffer.last_line + lines = buffer.source.split("\n") + # We allow multiple includes, extends and prepends as long as they're all at the end. + allowed_line = (line...last_line).all? { |i| CHECK_LINE_METHODS_REGEXP.match?(lines[i - 1]) } - # Parser treats the final newline (if present) as a separate line, - # meaning that a simple `line < last_line` would yield true even though - # the expression is the last line _of code_. - last_line -= 1 if buffer.source.end_with?("\n") - - last_line_content = buffer.source.split("\n")[-1] - - if CHECK_LINE_METHODS_REGEXP.match?(last_line_content) + if allowed_line ignore_node(node) elsif line < last_line add_offense(node, message: INVALID_LINE) diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index ad04c6e61e8..39b0cd4fb03 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -250,6 +250,56 @@ describe Projects::BlobController do end end + shared_examples "file matches a codeowners rule" do + let(:error_msg) { "Example error msg" } + + it "renders to the edit page with an error msg" do + default_params[:file_path] = "CHANGELOG" + + expect_next_instance_of(Gitlab::CodeOwners::Validator) do |validator| + expect(validator).to receive(:execute).and_return(error_msg) + end + + subject + + expect(flash[:alert]).to eq(error_msg) + expect(response).to render_template(expected_view) + end + end + + describe 'POST create' do + let(:user) { create(:user) } + let(:default_params) do + { + namespace_id: project.namespace, + project_id: project, + id: 'master', + branch_name: 'master', + file_name: 'CHANGELOG', + content: 'Added changes', + commit_message: 'Create CHANGELOG' + } + end + + before do + project.add_developer(user) + + sign_in(user) + end + + it 'redirects to blob' do + post :create, params: default_params + + expect(response).to be_ok + end + + it_behaves_like "file matches a codeowners rule" do + subject { post :create, params: default_params } + + let(:expected_view) { :new } + end + end + describe 'PUT update' do let(:user) { create(:user) } let(:default_params) do @@ -279,6 +329,12 @@ describe Projects::BlobController do expect(response).to redirect_to(blob_after_edit_path) end + it_behaves_like "file matches a codeowners rule" do + subject { put :update, params: default_params } + + let(:expected_view) { :edit } + end + context '?from_merge_request_iid' do let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:mr_params) { default_params.merge(from_merge_request_iid: merge_request.iid) } diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 96f11f11dc4..74b858f118a 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -536,7 +536,7 @@ describe Projects::IssuesController do before do stub_application_setting(recaptcha_enabled: true) expect_next_instance_of(Spam::SpamVerdictService) do |verdict_service| - expect(verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + expect(verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end end @@ -851,7 +851,7 @@ describe Projects::IssuesController do context 'when recaptcha is not verified' do before do expect_next_instance_of(Spam::SpamVerdictService) do |verdict_service| - expect(verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + expect(verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end end @@ -1103,7 +1103,7 @@ describe Projects::IssuesController do context 'when captcha is not verified' do before do expect_next_instance_of(Spam::SpamVerdictService) do |verdict_service| - expect(verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + expect(verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end end diff --git a/spec/features/issues/spam_issues_spec.rb b/spec/features/issues/spam_issues_spec.rb index cba5e49b67e..f54ce16af93 100644 --- a/spec/features/issues/spam_issues_spec.rb +++ b/spec/features/issues/spam_issues_spec.rb @@ -81,7 +81,7 @@ describe 'New issue', :js do before do allow_next_instance_of(Spam::SpamVerdictService) do |verdict_service| - allow(verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + allow(verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end visit new_project_issue_path(project) diff --git a/spec/features/snippets/spam_snippets_spec.rb b/spec/features/snippets/spam_snippets_spec.rb index d7b181dc678..d19354e7bbe 100644 --- a/spec/features/snippets/spam_snippets_spec.rb +++ b/spec/features/snippets/spam_snippets_spec.rb @@ -68,7 +68,7 @@ shared_examples_for 'snippet editor' do context 'when SpamVerdictService requires recaptcha' do before do expect_next_instance_of(Spam::SpamVerdictService) do |verdict_service| - expect(verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + expect(verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end end diff --git a/spec/finders/groups_finder_spec.rb b/spec/finders/groups_finder_spec.rb index 939b818f165..b02bb4e0b8c 100644 --- a/spec/finders/groups_finder_spec.rb +++ b/spec/finders/groups_finder_spec.rb @@ -74,6 +74,12 @@ describe GroupsFinder do let!(:internal_subgroup) { create(:group, :internal, parent: parent_group) } let!(:private_subgroup) { create(:group, :private, parent: parent_group) } + context 'with [nil] parent' do + it 'returns only top-level groups' do + expect(described_class.new(user, parent: [nil]).execute).to contain_exactly(parent_group) + end + end + context 'without a user' do it 'only returns parent and public subgroups' do expect(described_class.new(nil).execute).to contain_exactly(parent_group, public_subgroup) diff --git a/spec/lib/gitlab/jira_import/issues_importer_spec.rb b/spec/lib/gitlab/jira_import/issues_importer_spec.rb index ebe224bdc4b..436fb139b36 100644 --- a/spec/lib/gitlab/jira_import/issues_importer_spec.rb +++ b/spec/lib/gitlab/jira_import/issues_importer_spec.rb @@ -42,12 +42,19 @@ describe Gitlab::JiraImport::IssuesImporter do jira_issue = Struct.new(:id) let_it_be(:jira_issues) { [jira_issue.new(1), jira_issue.new(2)] } - def mock_issue_serializer(count) + def mock_issue_serializer(count, raise_exception_on_even_mocks: false) serializer = instance_double(Gitlab::JiraImport::IssueSerializer, execute: { key: 'data' }) + next_iid = project.issues.maximum(:iid).to_i count.times do |i| - expect(Gitlab::JiraImport::IssueSerializer).to receive(:new) - .with(project, jira_issues[i], current_user.id, { iid: i + 1 }).and_return(serializer) + if raise_exception_on_even_mocks && i.even? + expect(Gitlab::JiraImport::IssueSerializer).to receive(:new) + .with(project, jira_issues[i], current_user.id, { iid: next_iid + 1 }).and_raise('Some error') + else + next_iid += 1 + expect(Gitlab::JiraImport::IssueSerializer).to receive(:new) + .with(project, jira_issues[i], current_user.id, { iid: next_iid }).and_return(serializer) + end end end @@ -70,21 +77,22 @@ describe Gitlab::JiraImport::IssuesImporter do end end - context 'when there is more than one page of results' do + context 'when importing some issue raises an exception' do before do - stub_const("#{described_class.name}::BATCH_SIZE", 2) + stub_const("#{described_class.name}::BATCH_SIZE", 3) end - it 'schedules 3 import jobs' do + it 'schedules 2 import jobs' do expect(subject).to receive(:fetch_issues).with(0).and_return([jira_issues[0], jira_issues[1]]) - expect(Gitlab::JiraImport::ImportIssueWorker).to receive(:perform_async).twice.times - expect(Gitlab::Cache::Import::Caching).to receive(:set_add).twice.times.and_call_original - expect(Gitlab::Cache::Import::Caching).to receive(:set_includes?).twice.times.and_call_original - mock_issue_serializer(2) + expect(Gitlab::JiraImport::ImportIssueWorker).to receive(:perform_async).once + expect(Gitlab::Cache::Import::Caching).to receive(:set_add).once.and_call_original + expect(Gitlab::Cache::Import::Caching).to receive(:set_includes?).twice.and_call_original + expect(Gitlab::ErrorTracking).to receive(:track_exception).once + mock_issue_serializer(2, raise_exception_on_even_mocks: true) job_waiter = subject.execute - expect(job_waiter.jobs_remaining).to eq(2) + expect(job_waiter.jobs_remaining).to eq(1) expect(Gitlab::JiraImport.get_issues_next_start_at(project.id)).to eq(2) end end diff --git a/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb b/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb index 80e8da58f23..1b9be994453 100644 --- a/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb +++ b/spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb @@ -117,28 +117,32 @@ describe Gitlab::SidekiqConfig::CliMethods do feature_category: :category_a, has_external_dependencies: false, urgency: :low, - resource_boundary: :cpu + resource_boundary: :cpu, + tags: [:no_disk_io, :git_access] }, { name: 'a:2', feature_category: :category_a, has_external_dependencies: false, urgency: :high, - resource_boundary: :none + resource_boundary: :none, + tags: [:git_access] }, { name: 'b', feature_category: :category_b, has_external_dependencies: true, urgency: :high, - resource_boundary: :memory + resource_boundary: :memory, + tags: [:no_disk_io] }, { name: 'c', feature_category: :category_c, has_external_dependencies: false, urgency: :throttled, - resource_boundary: :memory + resource_boundary: :memory, + tags: [] } ] end @@ -177,6 +181,18 @@ describe Gitlab::SidekiqConfig::CliMethods do 'resource_boundary=memory|resource_boundary=cpu' | %w(a b c) 'resource_boundary!=memory,cpu' | %w(a:2) + # tags + 'tags=no_disk_io' | %w(a b) + 'tags=no_disk_io,git_access' | %w(a a:2 b) + 'tags=no_disk_io|tags=git_access' | %w(a a:2 b) + 'tags=no_disk_io&tags=git_access' | %w(a) + 'tags!=no_disk_io' | %w(a:2 c) + 'tags!=no_disk_io,git_access' | %w(c) + 'tags=unknown_tag' | [] + 'tags!=no_disk_io' | %w(a:2 c) + 'tags!=no_disk_io,git_access' | %w(c) + 'tags!=unknown_tag' | %w(a a:2 b c) + # combinations 'feature_category=category_a&urgency=high' | %w(a:2) 'feature_category=category_a&urgency=high|feature_category=category_c' | %w(a:2 c) diff --git a/spec/lib/gitlab/sidekiq_config/worker_spec.rb b/spec/lib/gitlab/sidekiq_config/worker_spec.rb index 817755e3507..00343a0264d 100644 --- a/spec/lib/gitlab/sidekiq_config/worker_spec.rb +++ b/spec/lib/gitlab/sidekiq_config/worker_spec.rb @@ -13,7 +13,8 @@ describe Gitlab::SidekiqConfig::Worker do get_worker_resource_boundary: attributes[:resource_boundary], get_urgency: attributes[:urgency], worker_has_external_dependencies?: attributes[:has_external_dependencies], - idempotent?: attributes[:idempotent] + idempotent?: attributes[:idempotent], + get_tags: attributes[:tags] ) described_class.new(inner_worker, ee: false) @@ -91,7 +92,8 @@ describe Gitlab::SidekiqConfig::Worker do urgency: :low, resource_boundary: :memory, weight: 2, - idempotent: true + idempotent: true, + tags: [] } attributes_b = { @@ -100,7 +102,8 @@ describe Gitlab::SidekiqConfig::Worker do urgency: :high, resource_boundary: :unknown, weight: 3, - idempotent: false + idempotent: false, + tags: [:no_disk_io] } worker_a = create_worker(queue: 'a', **attributes_a) diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 18feff85482..81bb540f79f 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -231,6 +231,27 @@ describe API::Groups do end end + context "when using top_level_only" do + let(:top_level_group) { create(:group, name: 'top-level-group') } + let(:subgroup) { create(:group, :nested, name: 'subgroup') } + let(:response_groups) { json_response.map { |group| group['name'] } } + + before do + top_level_group.add_owner(user1) + subgroup.add_owner(user1) + end + + it "doesn't return subgroups" do + get api("/groups", user1), params: { top_level_only: true } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(response_groups).to include(top_level_group.name) + expect(response_groups).not_to include(subgroup.name) + end + end + context "when using sorting" do let(:group3) { create(:group, name: "a#{group1.name}", path: "z#{group1.path}") } let(:group4) { create(:group, name: "same-name", path: "y#{group1.path}") } diff --git a/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb b/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb index 3cb1dbbbc2c..f047baa3bc2 100644 --- a/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb +++ b/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb @@ -170,6 +170,20 @@ describe RuboCop::Cop::InjectEnterpriseEditionModule do SOURCE end + it 'does not flag the use of `prepend_if_ee EE` as long as all injections are at the end of the file' do + expect_no_offenses(<<~SOURCE) + class Foo + end + + Foo.include_if_ee('EE::Foo') + Foo.prepend_if_ee('EE::Foo') + + Foo.include(Bar) + # comment on prepending Bar + Foo.prepend(Bar) + SOURCE + end + it 'autocorrects offenses by just disabling the Cop' do source = <<~SOURCE class Foo diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 7a251e03e51..bb02941576a 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -458,7 +458,7 @@ describe Issues::CreateService do context 'when SpamVerdictService requires reCAPTCHA' do before do expect_next_instance_of(Spam::SpamVerdictService) do |verdict_service| - expect(verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + expect(verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end end diff --git a/spec/services/spam/spam_action_service_spec.rb b/spec/services/spam/spam_action_service_spec.rb index 560833aba97..13151c4c0a7 100644 --- a/spec/services/spam/spam_action_service_spec.rb +++ b/spec/services/spam/spam_action_service_spec.rb @@ -163,9 +163,9 @@ describe Spam::SpamActionService do end end - context 'when spam verdict service requires reCAPTCHA' do + context 'when spam verdict service conditionally allows' do before do - allow(fake_verdict_service).to receive(:execute).and_return(REQUIRE_RECAPTCHA) + allow(fake_verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW) end context 'when allow_possible_spam feature flag is false' do diff --git a/spec/services/spam/spam_verdict_service_spec.rb b/spec/services/spam/spam_verdict_service_spec.rb index 2568b708ad8..87da9088b35 100644 --- a/spec/services/spam/spam_verdict_service_spec.rb +++ b/spec/services/spam/spam_verdict_service_spec.rb @@ -123,8 +123,8 @@ describe Spam::SpamVerdictService do stub_application_setting(recaptcha_enabled: true) end - it 'returns require reCAPTCHA verdict' do - expect(subject).to eq REQUIRE_RECAPTCHA + it 'returns conditionally allow verdict' do + expect(subject).to eq CONDITIONAL_ALLOW end end diff --git a/spec/support/shared_contexts/spam_constants.rb b/spec/support/shared_contexts/spam_constants.rb index 0eb5e541965..32371f4b92f 100644 --- a/spec/support/shared_contexts/spam_constants.rb +++ b/spec/support/shared_contexts/spam_constants.rb @@ -2,7 +2,7 @@ shared_context 'includes Spam constants' do before do - stub_const('REQUIRE_RECAPTCHA', Spam::SpamConstants::REQUIRE_RECAPTCHA) + stub_const('CONDITIONAL_ALLOW', Spam::SpamConstants::CONDITIONAL_ALLOW) stub_const('DISALLOW', Spam::SpamConstants::DISALLOW) stub_const('ALLOW', Spam::SpamConstants::ALLOW) stub_const('BLOCK_USER', Spam::SpamConstants::BLOCK_USER)