diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-03 12:10:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-03 12:10:02 +0300 |
commit | 119f0431e47b76f401dbb92d5774bf3380774038 (patch) | |
tree | c6b02ec8b1f3bd2f67add79de2f1cb589c65d85d | |
parent | d3a97bfbd26fe2876f64fa88d0936dfed2246fa1 (diff) |
Add latest changes from gitlab-org/gitlab@master
107 files changed, 899 insertions, 188 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 940e6a6f99d..377a109f74c 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -516e2a4a71a41e48465de590d9eaea2f8085e088 +08430e67d1673cbac3aa3e7d103e8e047e5b23c0 diff --git a/app/finders/concerns/packages/finder_helper.rb b/app/finders/concerns/packages/finder_helper.rb index 39c018818d1..6ba353fd89a 100644 --- a/app/finders/concerns/packages/finder_helper.rb +++ b/app/finders/concerns/packages/finder_helper.rb @@ -25,7 +25,7 @@ module Packages end def projects_visible_to_reporters(user, within_group:) - if user.is_a?(DeployToken) && Feature.enabled?(:packages_finder_helper_deploy_token) + if user.is_a?(DeployToken) && Feature.enabled?(:packages_finder_helper_deploy_token, default_enabled: :yaml) user.accessible_projects else within_group.all_projects diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index de0cdece134..0ce543d6eb8 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -119,7 +119,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: container_repository:delete_container_repository :worker_name: DeleteContainerRepositoryWorker :feature_category: :container_registry @@ -146,7 +147,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:analytics_usage_trends_count_job_trigger :worker_name: Analytics::UsageTrends::CountJobTriggerWorker :feature_category: :devops_reports @@ -155,7 +157,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:authorized_project_update_periodic_recalculate :worker_name: AuthorizedProjectUpdate::PeriodicRecalculateWorker :feature_category: :source_code_management @@ -182,7 +185,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:ci_platform_metrics_update_cron :worker_name: CiPlatformMetricsUpdateCronWorker :feature_category: :continuous_integration @@ -200,7 +204,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:container_expiration_policy :worker_name: ContainerExpirationPolicyWorker :feature_category: :container_registry @@ -218,7 +223,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:environments_auto_stop_cron :worker_name: Environments::AutoStopCronWorker :feature_category: :continuous_delivery @@ -290,7 +296,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:metrics_dashboard_schedule_annotations_prune :worker_name: Metrics::Dashboard::ScheduleAnnotationsPruneWorker :feature_category: :metrics @@ -308,7 +315,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:namespaces_prune_aggregation_schedules :worker_name: Namespaces::PruneAggregationSchedulesWorker :feature_category: :source_code_management @@ -326,7 +334,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:pages_domain_removal_cron :worker_name: PagesDomainRemovalCronWorker :feature_category: :pages @@ -371,7 +380,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:personal_access_tokens_expiring :worker_name: PersonalAccessTokens::ExpiringWorker :feature_category: :authentication_and_authorization @@ -416,7 +426,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:remove_expired_group_links :worker_name: RemoveExpiredGroupLinksWorker :feature_category: :authentication_and_authorization @@ -443,7 +454,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:remove_unreferenced_lfs_objects :worker_name: RemoveUnreferencedLfsObjectsWorker :feature_category: :git_lfs @@ -488,7 +500,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:schedule_migrate_external_diffs :worker_name: ScheduleMigrateExternalDiffsWorker :feature_category: :code_review @@ -506,7 +519,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:ssh_keys_expiring_soon_notification :worker_name: SshKeys::ExpiringSoonNotificationWorker :feature_category: :compliance_management @@ -515,7 +529,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:stuck_ci_jobs :worker_name: StuckCiJobsWorker :feature_category: :continuous_integration @@ -569,7 +584,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:users_create_statistics :worker_name: Users::CreateStatisticsWorker :feature_category: :users @@ -587,7 +603,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: cronjob:x509_issuer_crl_check :worker_name: X509IssuerCrlCheckWorker :feature_category: :source_code_management @@ -614,7 +631,8 @@ :resource_boundary: :unknown :weight: 3 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: deployment:deployments_execute_hooks :worker_name: Deployments::ExecuteHooksWorker :feature_category: :continuous_delivery @@ -884,7 +902,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: github_importer:github_import_import_pull_request_review :worker_name: Gitlab::GithubImport::ImportPullRequestReviewWorker :feature_category: :importers @@ -893,7 +912,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: github_importer:github_import_refresh_import_jid :worker_name: Gitlab::GithubImport::RefreshImportJidWorker :feature_category: :importers @@ -965,7 +985,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: github_importer:github_import_stage_import_pull_requests_reviews :worker_name: Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker :feature_category: :importers @@ -974,7 +995,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: github_importer:github_import_stage_import_repository :worker_name: Gitlab::GithubImport::Stage::ImportRepositoryWorker :feature_category: :importers @@ -1037,7 +1059,8 @@ :resource_boundary: :unknown :weight: 2 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: incident_management:incident_management_pager_duty_process_incident :worker_name: IncidentManagement::PagerDuty::ProcessIncidentWorker :feature_category: :incident_management @@ -1091,7 +1114,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: jira_connect:jira_connect_sync_deployments :worker_name: JiraConnect::SyncDeploymentsWorker :feature_category: :integrations @@ -1100,7 +1124,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: jira_connect:jira_connect_sync_feature_flags :worker_name: JiraConnect::SyncFeatureFlagsWorker :feature_category: :integrations @@ -1109,7 +1134,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: jira_connect:jira_connect_sync_merge_request :worker_name: JiraConnect::SyncMergeRequestWorker :feature_category: :integrations @@ -1127,7 +1153,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: jira_importer:jira_import_advance_stage :worker_name: Gitlab::JiraImport::AdvanceStageWorker :feature_category: :importers @@ -1280,7 +1307,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: package_repositories:packages_go_sync_packages :worker_name: Packages::Go::SyncPackagesWorker :feature_category: :package_registry @@ -1289,7 +1317,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: package_repositories:packages_maven_metadata_sync :worker_name: Packages::Maven::Metadata::SyncWorker :feature_category: :package_registry @@ -1298,7 +1327,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: package_repositories:packages_nuget_extraction :worker_name: Packages::Nuget::ExtractionWorker :feature_category: :package_registry @@ -1316,7 +1346,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pipeline_background:archive_trace :worker_name: ArchiveTraceWorker :feature_category: :continuous_integration @@ -1352,7 +1383,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pipeline_background:ci_pipeline_artifacts_create_quality_report :worker_name: Ci::PipelineArtifacts::CreateQualityReportWorker :feature_category: :code_testing @@ -1361,7 +1393,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pipeline_background:ci_pipeline_success_unlock_artifacts :worker_name: Ci::PipelineSuccessUnlockArtifactsWorker :feature_category: :continuous_integration @@ -1388,7 +1421,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pipeline_cache:expire_job_cache :worker_name: ExpireJobCacheWorker :feature_category: :continuous_integration @@ -1451,7 +1485,8 @@ :resource_boundary: :unknown :weight: 3 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pipeline_default:ci_merge_requests_add_todo_when_build_fails :worker_name: Ci::MergeRequests::AddTodoWhenBuildFailsWorker :feature_category: :continuous_integration @@ -1460,7 +1495,8 @@ :resource_boundary: :unknown :weight: 3 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pipeline_default:ci_pipeline_bridge_status :worker_name: Ci::PipelineBridgeStatusWorker :feature_category: :continuous_integration @@ -1649,7 +1685,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: todos_destroyer:todos_destroyer_entity_leave :worker_name: TodosDestroyer::EntityLeaveWorker :feature_category: :issue_tracking @@ -1721,7 +1758,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: analytics_usage_trends_counter_job :worker_name: Analytics::UsageTrends::CounterJobWorker :feature_category: :devops_reports @@ -1730,7 +1768,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: approve_blocked_pending_approval_users :worker_name: ApproveBlockedPendingApprovalUsersWorker :feature_category: :users @@ -1739,7 +1778,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: authorized_keys :worker_name: AuthorizedKeysWorker :feature_category: :source_code_management @@ -1775,7 +1815,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: bulk_imports_entity :worker_name: BulkImports::EntityWorker :feature_category: :importers @@ -1784,7 +1825,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: bulk_imports_pipeline :worker_name: BulkImports::PipelineWorker :feature_category: :importers @@ -1793,7 +1835,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: chat_notification :worker_name: ChatNotificationWorker :feature_category: :chatops @@ -1811,7 +1854,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: create_commit_signature :worker_name: CreateCommitSignatureWorker :feature_category: :source_code_management @@ -1883,7 +1927,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: design_management_new_version :worker_name: DesignManagement::NewVersionWorker :feature_category: :design_management @@ -1901,7 +1946,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: detect_repository_languages :worker_name: DetectRepositoryLanguagesWorker :feature_category: :source_code_management @@ -1919,7 +1965,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: disallow_two_factor_for_subgroups :worker_name: DisallowTwoFactorForSubgroupsWorker :feature_category: :subgroups @@ -1928,7 +1975,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: email_receiver :worker_name: EmailReceiverWorker :feature_category: :issue_tracking @@ -1955,7 +2003,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: error_tracking_issue_link :worker_name: ErrorTrackingIssueLinkWorker :feature_category: :error_tracking @@ -1973,7 +2022,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: expire_build_instance_artifacts :worker_name: ExpireBuildInstanceArtifactsWorker :feature_category: :continuous_integration @@ -2018,7 +2068,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: git_garbage_collect :worker_name: GitGarbageCollectWorker :feature_category: :gitaly @@ -2045,7 +2096,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: gitlab_shell :worker_name: GitlabShellWorker :feature_category: :source_code_management @@ -2065,6 +2117,7 @@ :idempotent: :tags: - :requires_disk_io + - :exclude_from_kubernetes - :name: group_export :worker_name: GroupExportWorker :feature_category: :importers @@ -2145,7 +2198,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: mailers :worker_name: ActionMailer::MailDeliveryJob :feature_category: :issue_tracking @@ -2172,7 +2226,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: merge_request_mergeability_check :worker_name: MergeRequestMergeabilityCheckWorker :feature_category: :code_review @@ -2235,7 +2290,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: migrate_external_diffs :worker_name: MigrateExternalDiffsWorker :feature_category: :code_review @@ -2262,7 +2318,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: namespaces_onboarding_pipeline_created :worker_name: Namespaces::OnboardingPipelineCreatedWorker :feature_category: :subgroups @@ -2271,7 +2328,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: namespaces_onboarding_progress :worker_name: Namespaces::OnboardingProgressWorker :feature_category: :product_analytics @@ -2280,7 +2338,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: namespaces_onboarding_user_added :worker_name: Namespaces::OnboardingUserAddedWorker :feature_category: :users @@ -2289,7 +2348,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: new_issue :worker_name: NewIssueWorker :feature_category: :issue_tracking @@ -2325,7 +2385,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pages :worker_name: PagesWorker :feature_category: :pages @@ -2336,6 +2397,7 @@ :idempotent: :tags: - :requires_disk_io + - :exclude_from_kubernetes - :name: pages_domain_ssl_renewal :worker_name: PagesDomainSslRenewalWorker :feature_category: :pages @@ -2346,6 +2408,7 @@ :idempotent: :tags: - :requires_disk_io + - :exclude_from_kubernetes - :name: pages_domain_verification :worker_name: PagesDomainVerificationWorker :feature_category: :pages @@ -2356,6 +2419,7 @@ :idempotent: :tags: - :requires_disk_io + - :exclude_from_kubernetes - :name: pages_remove :worker_name: PagesRemoveWorker :feature_category: :pages @@ -2364,7 +2428,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pages_transfer :worker_name: PagesTransferWorker :feature_category: :pages @@ -2373,7 +2438,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: pages_update_configuration :worker_name: PagesUpdateConfigurationWorker :feature_category: :pages @@ -2382,7 +2448,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: phabricator_import_import_tasks :worker_name: Gitlab::PhabricatorImport::ImportTasksWorker :feature_category: :importers @@ -2438,6 +2505,7 @@ :idempotent: :tags: - :requires_disk_io + - :exclude_from_kubernetes - :name: project_export :worker_name: ProjectExportWorker :feature_category: :importers @@ -2482,7 +2550,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: projects_post_creation :worker_name: Projects::PostCreationWorker :feature_category: :source_code_management @@ -2491,7 +2560,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: projects_schedule_bulk_repository_shard_moves :worker_name: Projects::ScheduleBulkRepositoryShardMovesWorker :feature_category: :gitaly @@ -2536,7 +2606,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: propagate_integration_inherit :worker_name: PropagateIntegrationInheritWorker :feature_category: :integrations @@ -2545,7 +2616,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: propagate_integration_inherit_descendant :worker_name: PropagateIntegrationInheritDescendantWorker :feature_category: :integrations @@ -2554,7 +2626,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: propagate_integration_project :worker_name: PropagateIntegrationProjectWorker :feature_category: :integrations @@ -2563,7 +2636,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: propagate_service_template :worker_name: PropagateServiceTemplateWorker :feature_category: :integrations @@ -2599,7 +2673,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: remote_mirror_notification :worker_name: RemoteMirrorNotificationWorker :feature_category: :source_code_management @@ -2779,7 +2854,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: web_hook :worker_name: WebHookWorker :feature_category: :integrations @@ -2797,7 +2873,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: true - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: wikis_git_garbage_collect :worker_name: Wikis::GitGarbageCollectWorker :feature_category: :gitaly @@ -2806,7 +2883,8 @@ :resource_boundary: :unknown :weight: 1 :idempotent: - :tags: [] + :tags: + - :exclude_from_kubernetes - :name: x509_certificate_revoke :worker_name: X509CertificateRevokeWorker :feature_category: :source_code_management diff --git a/app/workers/analytics/instance_statistics/count_job_trigger_worker.rb b/app/workers/analytics/instance_statistics/count_job_trigger_worker.rb index 7a05bb6dd26..083c01b166d 100644 --- a/app/workers/analytics/instance_statistics/count_job_trigger_worker.rb +++ b/app/workers/analytics/instance_statistics/count_job_trigger_worker.rb @@ -10,6 +10,7 @@ module Analytics include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :devops_reports + tags :exclude_from_kubernetes urgency :low idempotent! diff --git a/app/workers/analytics/instance_statistics/counter_job_worker.rb b/app/workers/analytics/instance_statistics/counter_job_worker.rb index 41f36291347..a4dda45ff72 100644 --- a/app/workers/analytics/instance_statistics/counter_job_worker.rb +++ b/app/workers/analytics/instance_statistics/counter_job_worker.rb @@ -10,6 +10,7 @@ module Analytics feature_category :devops_reports urgency :low + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/analytics/usage_trends/count_job_trigger_worker.rb b/app/workers/analytics/usage_trends/count_job_trigger_worker.rb index 8ac92a20cc8..f2d4404a964 100644 --- a/app/workers/analytics/usage_trends/count_job_trigger_worker.rb +++ b/app/workers/analytics/usage_trends/count_job_trigger_worker.rb @@ -12,6 +12,7 @@ module Analytics DEFAULT_DELAY = 3.minutes.freeze feature_category :devops_reports + tags :exclude_from_kubernetes urgency :low idempotent! diff --git a/app/workers/analytics/usage_trends/counter_job_worker.rb b/app/workers/analytics/usage_trends/counter_job_worker.rb index 41f197afbb9..f4dc497d25f 100644 --- a/app/workers/analytics/usage_trends/counter_job_worker.rb +++ b/app/workers/analytics/usage_trends/counter_job_worker.rb @@ -10,6 +10,7 @@ module Analytics feature_category :devops_reports urgency :low + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/approve_blocked_pending_approval_users_worker.rb b/app/workers/approve_blocked_pending_approval_users_worker.rb index 03bdd236cac..ff72aaad3ce 100644 --- a/app/workers/approve_blocked_pending_approval_users_worker.rb +++ b/app/workers/approve_blocked_pending_approval_users_worker.rb @@ -8,6 +8,7 @@ class ApproveBlockedPendingApprovalUsersWorker idempotent! feature_category :users + tags :exclude_from_kubernetes def perform(current_user_id) current_user = User.find(current_user_id) diff --git a/app/workers/bulk_import_worker.rb b/app/workers/bulk_import_worker.rb index 011a3d1d5e4..f6b1aef5069 100644 --- a/app/workers/bulk_import_worker.rb +++ b/app/workers/bulk_import_worker.rb @@ -4,6 +4,7 @@ class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker feature_category :importers + tags :exclude_from_kubernetes sidekiq_options retry: false, dead: false diff --git a/app/workers/bulk_imports/entity_worker.rb b/app/workers/bulk_imports/entity_worker.rb index 1771a1b8440..e7fce112ee1 100644 --- a/app/workers/bulk_imports/entity_worker.rb +++ b/app/workers/bulk_imports/entity_worker.rb @@ -5,6 +5,7 @@ module BulkImports include ApplicationWorker feature_category :importers + tags :exclude_from_kubernetes sidekiq_options retry: false, dead: false diff --git a/app/workers/bulk_imports/pipeline_worker.rb b/app/workers/bulk_imports/pipeline_worker.rb index ea4e78cf1ec..256301bf097 100644 --- a/app/workers/bulk_imports/pipeline_worker.rb +++ b/app/workers/bulk_imports/pipeline_worker.rb @@ -5,6 +5,7 @@ module BulkImports include ApplicationWorker feature_category :importers + tags :exclude_from_kubernetes sidekiq_options retry: false, dead: false diff --git a/app/workers/ci/delete_objects_worker.rb b/app/workers/ci/delete_objects_worker.rb index 1d6c6820ab7..ff020a3b048 100644 --- a/app/workers/ci/delete_objects_worker.rb +++ b/app/workers/ci/delete_objects_worker.rb @@ -8,6 +8,7 @@ module Ci include LimitedCapacity::Worker feature_category :continuous_integration + tags :exclude_from_kubernetes idempotent! def perform_work(*args) diff --git a/app/workers/ci/drop_pipeline_worker.rb b/app/workers/ci/drop_pipeline_worker.rb index 818e954818e..bc158433228 100644 --- a/app/workers/ci/drop_pipeline_worker.rb +++ b/app/workers/ci/drop_pipeline_worker.rb @@ -7,6 +7,8 @@ module Ci sidekiq_options retry: 3 include PipelineQueue + tags :exclude_from_kubernetes + idempotent! def perform(pipeline_id, failure_reason) diff --git a/app/workers/ci/merge_requests/add_todo_when_build_fails_worker.rb b/app/workers/ci/merge_requests/add_todo_when_build_fails_worker.rb index a088fc5cbf9..c6815b780b1 100644 --- a/app/workers/ci/merge_requests/add_todo_when_build_fails_worker.rb +++ b/app/workers/ci/merge_requests/add_todo_when_build_fails_worker.rb @@ -8,6 +8,7 @@ module Ci include PipelineQueue urgency :low + tags :exclude_from_kubernetes idempotent! def perform(job_id) diff --git a/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb b/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb index ec0cb69d0c7..dd7bfff4eb1 100644 --- a/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb +++ b/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb @@ -9,6 +9,7 @@ module Ci include PipelineBackgroundQueue feature_category :code_testing + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/ci/pipeline_artifacts/create_quality_report_worker.rb b/app/workers/ci/pipeline_artifacts/create_quality_report_worker.rb index 7b99faa1ccb..d83c7f6571e 100644 --- a/app/workers/ci/pipeline_artifacts/create_quality_report_worker.rb +++ b/app/workers/ci/pipeline_artifacts/create_quality_report_worker.rb @@ -9,6 +9,7 @@ module Ci queue_namespace :pipeline_background feature_category :code_testing + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb b/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb index 12d69c44413..004c1d444a2 100644 --- a/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb +++ b/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb @@ -14,6 +14,7 @@ module Ci deduplicate :until_executed, including_scheduled: true idempotent! feature_category :continuous_integration + tags :exclude_from_kubernetes def perform service = ::Ci::PipelineArtifacts::DestroyAllExpiredService.new diff --git a/app/workers/ci/schedule_delete_objects_cron_worker.rb b/app/workers/ci/schedule_delete_objects_cron_worker.rb index 9fb46820073..6489665fafd 100644 --- a/app/workers/ci/schedule_delete_objects_cron_worker.rb +++ b/app/workers/ci/schedule_delete_objects_cron_worker.rb @@ -11,6 +11,7 @@ module Ci # rubocop:enable Scalability/CronWorkerContext feature_category :continuous_integration + tags :exclude_from_kubernetes idempotent! def perform(*args) diff --git a/app/workers/ci/test_failure_history_worker.rb b/app/workers/ci/test_failure_history_worker.rb index 987eb2a177b..3937f720788 100644 --- a/app/workers/ci/test_failure_history_worker.rb +++ b/app/workers/ci/test_failure_history_worker.rb @@ -7,6 +7,8 @@ module Ci sidekiq_options retry: 3 include PipelineBackgroundQueue + tags :exclude_from_kubernetes + idempotent! def perform(pipeline_id) diff --git a/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb b/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb index 31251b6dbec..80bcadc7926 100644 --- a/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb +++ b/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb @@ -10,6 +10,7 @@ module ContainerExpirationPolicies queue_namespace :container_repository feature_category :container_registry + tags :exclude_from_kubernetes urgency :low worker_resource_boundary :unknown idempotent! diff --git a/app/workers/database/batched_background_migration_worker.rb b/app/workers/database/batched_background_migration_worker.rb index a2cf69d0e75..ba5b8f4f947 100644 --- a/app/workers/database/batched_background_migration_worker.rb +++ b/app/workers/database/batched_background_migration_worker.rb @@ -8,6 +8,7 @@ module Database include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :database + tags :exclude_from_kubernetes idempotent! LEASE_TIMEOUT_MULTIPLIER = 3 diff --git a/app/workers/deployments/drop_older_deployments_worker.rb b/app/workers/deployments/drop_older_deployments_worker.rb index d1c5a35dcf8..6ca819e7942 100644 --- a/app/workers/deployments/drop_older_deployments_worker.rb +++ b/app/workers/deployments/drop_older_deployments_worker.rb @@ -8,6 +8,7 @@ module Deployments queue_namespace :deployment feature_category :continuous_delivery + tags :exclude_from_kubernetes def perform(deployment_id) Deployments::OlderDeploymentsDropService.new(deployment_id).execute diff --git a/app/workers/design_management/copy_design_collection_worker.rb b/app/workers/design_management/copy_design_collection_worker.rb index b282f3a89b5..28b511c7c27 100644 --- a/app/workers/design_management/copy_design_collection_worker.rb +++ b/app/workers/design_management/copy_design_collection_worker.rb @@ -7,6 +7,7 @@ module DesignManagement sidekiq_options retry: 3 feature_category :design_management + tags :exclude_from_kubernetes idempotent! urgency :low diff --git a/app/workers/destroy_pages_deployments_worker.rb b/app/workers/destroy_pages_deployments_worker.rb index 32b539325c9..edd446628aa 100644 --- a/app/workers/destroy_pages_deployments_worker.rb +++ b/app/workers/destroy_pages_deployments_worker.rb @@ -8,6 +8,7 @@ class DestroyPagesDeploymentsWorker loggable_arguments 0, 1 sidekiq_options retry: 3 feature_category :pages + tags :exclude_from_kubernetes def perform(project_id, last_deployment_id = nil) project = Project.find_by_id(project_id) diff --git a/app/workers/disallow_two_factor_for_group_worker.rb b/app/workers/disallow_two_factor_for_group_worker.rb index 0c06d066d53..3a48e3ab5da 100644 --- a/app/workers/disallow_two_factor_for_group_worker.rb +++ b/app/workers/disallow_two_factor_for_group_worker.rb @@ -7,6 +7,7 @@ class DisallowTwoFactorForGroupWorker include ExceptionBacktrace feature_category :subgroups + tags :exclude_from_kubernetes idempotent! def perform(group_id) diff --git a/app/workers/disallow_two_factor_for_subgroups_worker.rb b/app/workers/disallow_two_factor_for_subgroups_worker.rb index 2563e6c7039..f5b31e0bcf0 100644 --- a/app/workers/disallow_two_factor_for_subgroups_worker.rb +++ b/app/workers/disallow_two_factor_for_subgroups_worker.rb @@ -9,6 +9,7 @@ class DisallowTwoFactorForSubgroupsWorker INTERVAL = 2.seconds.to_i feature_category :subgroups + tags :exclude_from_kubernetes idempotent! def perform(group_id) diff --git a/app/workers/environments/canary_ingress/update_worker.rb b/app/workers/environments/canary_ingress/update_worker.rb index 53cc38e9eec..ecdfc6f0581 100644 --- a/app/workers/environments/canary_ingress/update_worker.rb +++ b/app/workers/environments/canary_ingress/update_worker.rb @@ -9,6 +9,7 @@ module Environments idempotent! worker_has_external_dependencies! feature_category :continuous_delivery + tags :exclude_from_kubernetes def perform(environment_id, params) Environment.find_by_id(environment_id).try do |environment| diff --git a/app/workers/experiments/record_conversion_event_worker.rb b/app/workers/experiments/record_conversion_event_worker.rb index a49cd7c3484..9fc76a2173b 100644 --- a/app/workers/experiments/record_conversion_event_worker.rb +++ b/app/workers/experiments/record_conversion_event_worker.rb @@ -7,6 +7,7 @@ module Experiments sidekiq_options retry: 3 feature_category :users + tags :exclude_from_kubernetes urgency :low idempotent! diff --git a/app/workers/flush_counter_increments_worker.rb b/app/workers/flush_counter_increments_worker.rb index 921e134484b..44d30b4ba3d 100644 --- a/app/workers/flush_counter_increments_worker.rb +++ b/app/workers/flush_counter_increments_worker.rb @@ -11,6 +11,7 @@ class FlushCounterIncrementsWorker sidekiq_options retry: 3 feature_category_not_owned! + tags :exclude_from_kubernetes urgency :low deduplicate :until_executing, including_scheduled: true diff --git a/app/workers/gitlab/github_import/import_pull_request_merged_by_worker.rb b/app/workers/gitlab/github_import/import_pull_request_merged_by_worker.rb index 79ef917bbc5..a8b79cf9b3a 100644 --- a/app/workers/gitlab/github_import/import_pull_request_merged_by_worker.rb +++ b/app/workers/gitlab/github_import/import_pull_request_merged_by_worker.rb @@ -5,6 +5,8 @@ module Gitlab class ImportPullRequestMergedByWorker # rubocop:disable Scalability/IdempotentWorker include ObjectImporter + tags :exclude_from_kubernetes + def representation_class Gitlab::GithubImport::Representation::PullRequest end diff --git a/app/workers/gitlab/github_import/import_pull_request_review_worker.rb b/app/workers/gitlab/github_import/import_pull_request_review_worker.rb index b8516fb8670..5ee88d5d32b 100644 --- a/app/workers/gitlab/github_import/import_pull_request_review_worker.rb +++ b/app/workers/gitlab/github_import/import_pull_request_review_worker.rb @@ -5,6 +5,8 @@ module Gitlab class ImportPullRequestReviewWorker # rubocop:disable Scalability/IdempotentWorker include ObjectImporter + tags :exclude_from_kubernetes + def representation_class Gitlab::GithubImport::Representation::PullRequestReview end diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb index 9c17c09e7ea..5743648680d 100644 --- a/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb @@ -10,6 +10,8 @@ module Gitlab include GithubImport::Queue include StageMethods + tags :exclude_from_kubernetes + # client - An instance of Gitlab::GithubImport::Client. # project - An instance of Project. def import(client, project) diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb index 10b7cd59e5e..532d550f190 100644 --- a/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb @@ -10,6 +10,8 @@ module Gitlab include GithubImport::Queue include StageMethods + tags :exclude_from_kubernetes + # client - An instance of Gitlab::GithubImport::Client. # project - An instance of Project. def import(client, project) diff --git a/app/workers/gitlab_performance_bar_stats_worker.rb b/app/workers/gitlab_performance_bar_stats_worker.rb index 4299e2e8f78..4f7fdcf96f0 100644 --- a/app/workers/gitlab_performance_bar_stats_worker.rb +++ b/app/workers/gitlab_performance_bar_stats_worker.rb @@ -12,6 +12,7 @@ class GitlabPerformanceBarStatsWorker STATS_KEY_EXPIRE = 30.minutes.to_i feature_category :metrics + tags :exclude_from_kubernetes idempotent! def perform(lease_uuid) diff --git a/app/workers/group_destroy_worker.rb b/app/workers/group_destroy_worker.rb index 306d4801567..2c140c89e26 100644 --- a/app/workers/group_destroy_worker.rb +++ b/app/workers/group_destroy_worker.rb @@ -7,7 +7,7 @@ class GroupDestroyWorker # rubocop:disable Scalability/IdempotentWorker include ExceptionBacktrace feature_category :subgroups - tags :requires_disk_io + tags :requires_disk_io, :exclude_from_kubernetes def perform(group_id, user_id) begin diff --git a/app/workers/incident_management/add_severity_system_note_worker.rb b/app/workers/incident_management/add_severity_system_note_worker.rb index 8b274351047..62ed902e488 100644 --- a/app/workers/incident_management/add_severity_system_note_worker.rb +++ b/app/workers/incident_management/add_severity_system_note_worker.rb @@ -8,6 +8,7 @@ module IncidentManagement queue_namespace :incident_management feature_category :incident_management + tags :exclude_from_kubernetes def perform(incident_id, user_id) return if incident_id.blank? || user_id.blank? diff --git a/app/workers/issue_rebalancing_worker.rb b/app/workers/issue_rebalancing_worker.rb index cebb86ea249..27cfa5cf40a 100644 --- a/app/workers/issue_rebalancing_worker.rb +++ b/app/workers/issue_rebalancing_worker.rb @@ -8,6 +8,7 @@ class IssueRebalancingWorker idempotent! urgency :low feature_category :issue_tracking + tags :exclude_from_kubernetes def perform(ignore = nil, project_id = nil) return if project_id.nil? diff --git a/app/workers/jira_connect/sync_builds_worker.rb b/app/workers/jira_connect/sync_builds_worker.rb index 0207e481dc0..11a3b598035 100644 --- a/app/workers/jira_connect/sync_builds_worker.rb +++ b/app/workers/jira_connect/sync_builds_worker.rb @@ -11,6 +11,7 @@ module JiraConnect queue_namespace :jira_connect feature_category :integrations + tags :exclude_from_kubernetes def perform(pipeline_id, sequence_id) pipeline = Ci::Pipeline.find_by_id(pipeline_id) diff --git a/app/workers/jira_connect/sync_deployments_worker.rb b/app/workers/jira_connect/sync_deployments_worker.rb index 66f6a89af74..9f75b1161f0 100644 --- a/app/workers/jira_connect/sync_deployments_worker.rb +++ b/app/workers/jira_connect/sync_deployments_worker.rb @@ -11,6 +11,7 @@ module JiraConnect queue_namespace :jira_connect feature_category :integrations + tags :exclude_from_kubernetes def perform(deployment_id, sequence_id) deployment = Deployment.find_by_id(deployment_id) diff --git a/app/workers/jira_connect/sync_feature_flags_worker.rb b/app/workers/jira_connect/sync_feature_flags_worker.rb index e8dee70b901..0d8d3d3142e 100644 --- a/app/workers/jira_connect/sync_feature_flags_worker.rb +++ b/app/workers/jira_connect/sync_feature_flags_worker.rb @@ -11,6 +11,7 @@ module JiraConnect queue_namespace :jira_connect feature_category :integrations + tags :exclude_from_kubernetes def perform(feature_flag_id, sequence_id) feature_flag = ::Operations::FeatureFlag.find_by_id(feature_flag_id) diff --git a/app/workers/jira_connect/sync_project_worker.rb b/app/workers/jira_connect/sync_project_worker.rb index 40b60c3982a..dfff0c4b3b6 100644 --- a/app/workers/jira_connect/sync_project_worker.rb +++ b/app/workers/jira_connect/sync_project_worker.rb @@ -8,6 +8,7 @@ module JiraConnect queue_namespace :jira_connect feature_category :integrations + tags :exclude_from_kubernetes idempotent! worker_has_external_dependencies! diff --git a/app/workers/member_invitation_reminder_emails_worker.rb b/app/workers/member_invitation_reminder_emails_worker.rb index 87cb0655f82..bfee8ab1fab 100644 --- a/app/workers/member_invitation_reminder_emails_worker.rb +++ b/app/workers/member_invitation_reminder_emails_worker.rb @@ -7,6 +7,7 @@ class MemberInvitationReminderEmailsWorker # rubocop:disable Scalability/Idempot include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :subgroups + tags :exclude_from_kubernetes urgency :low def perform diff --git a/app/workers/merge_request_cleanup_refs_worker.rb b/app/workers/merge_request_cleanup_refs_worker.rb index b6afbab378b..162c6dc2a88 100644 --- a/app/workers/merge_request_cleanup_refs_worker.rb +++ b/app/workers/merge_request_cleanup_refs_worker.rb @@ -6,6 +6,7 @@ class MergeRequestCleanupRefsWorker sidekiq_options retry: 3 feature_category :code_review + tags :exclude_from_kubernetes idempotent! def perform(merge_request_id) diff --git a/app/workers/metrics/dashboard/sync_dashboards_worker.rb b/app/workers/metrics/dashboard/sync_dashboards_worker.rb index db740c94383..0fdc7825f47 100644 --- a/app/workers/metrics/dashboard/sync_dashboards_worker.rb +++ b/app/workers/metrics/dashboard/sync_dashboards_worker.rb @@ -8,6 +8,7 @@ module Metrics sidekiq_options retry: 3 feature_category :metrics + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/namespaces/in_product_marketing_emails_worker.rb b/app/workers/namespaces/in_product_marketing_emails_worker.rb index 6cb2c6c5db2..0aab7039844 100644 --- a/app/workers/namespaces/in_product_marketing_emails_worker.rb +++ b/app/workers/namespaces/in_product_marketing_emails_worker.rb @@ -8,6 +8,7 @@ module Namespaces include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :subgroups + tags :exclude_from_kubernetes urgency :low def perform diff --git a/app/workers/namespaces/onboarding_issue_created_worker.rb b/app/workers/namespaces/onboarding_issue_created_worker.rb index 1c7b1962241..7b8b1a43078 100644 --- a/app/workers/namespaces/onboarding_issue_created_worker.rb +++ b/app/workers/namespaces/onboarding_issue_created_worker.rb @@ -7,6 +7,7 @@ module Namespaces sidekiq_options retry: 3 feature_category :issue_tracking + tags :exclude_from_kubernetes urgency :low deduplicate :until_executing diff --git a/app/workers/namespaces/onboarding_pipeline_created_worker.rb b/app/workers/namespaces/onboarding_pipeline_created_worker.rb index 7c6119f8a59..128d7b6aa06 100644 --- a/app/workers/namespaces/onboarding_pipeline_created_worker.rb +++ b/app/workers/namespaces/onboarding_pipeline_created_worker.rb @@ -7,6 +7,7 @@ module Namespaces sidekiq_options retry: 3 feature_category :subgroups + tags :exclude_from_kubernetes urgency :low deduplicate :until_executing diff --git a/app/workers/namespaces/onboarding_progress_worker.rb b/app/workers/namespaces/onboarding_progress_worker.rb index 5c470e47dd5..d4db55a9207 100644 --- a/app/workers/namespaces/onboarding_progress_worker.rb +++ b/app/workers/namespaces/onboarding_progress_worker.rb @@ -7,6 +7,7 @@ module Namespaces sidekiq_options retry: 3 feature_category :product_analytics + tags :exclude_from_kubernetes urgency :low deduplicate :until_executed diff --git a/app/workers/namespaces/onboarding_user_added_worker.rb b/app/workers/namespaces/onboarding_user_added_worker.rb index 2aa91944906..8c85dfafa12 100644 --- a/app/workers/namespaces/onboarding_user_added_worker.rb +++ b/app/workers/namespaces/onboarding_user_added_worker.rb @@ -7,6 +7,7 @@ module Namespaces sidekiq_options retry: 3 feature_category :users + tags :exclude_from_kubernetes urgency :low idempotent! diff --git a/app/workers/packages/composer/cache_cleanup_worker.rb b/app/workers/packages/composer/cache_cleanup_worker.rb index 433b845881b..1d47ef87962 100644 --- a/app/workers/packages/composer/cache_cleanup_worker.rb +++ b/app/workers/packages/composer/cache_cleanup_worker.rb @@ -9,6 +9,7 @@ module Packages include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :package_registry + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/packages/composer/cache_update_worker.rb b/app/workers/packages/composer/cache_update_worker.rb index 12084ef5cb2..d87abf2e256 100644 --- a/app/workers/packages/composer/cache_update_worker.rb +++ b/app/workers/packages/composer/cache_update_worker.rb @@ -8,6 +8,7 @@ module Packages sidekiq_options retry: 3 feature_category :package_registry + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/packages/debian/process_changes_worker.rb b/app/workers/packages/debian/process_changes_worker.rb index c1731112099..edc366a7597 100644 --- a/app/workers/packages/debian/process_changes_worker.rb +++ b/app/workers/packages/debian/process_changes_worker.rb @@ -11,6 +11,7 @@ module Packages queue_namespace :package_repositories feature_category :package_registry + tags :exclude_from_kubernetes def perform(package_file_id, user_id) @package_file_id = package_file_id diff --git a/app/workers/packages/go/sync_packages_worker.rb b/app/workers/packages/go/sync_packages_worker.rb index b0616159405..c5f631c47db 100644 --- a/app/workers/packages/go/sync_packages_worker.rb +++ b/app/workers/packages/go/sync_packages_worker.rb @@ -10,6 +10,7 @@ module Packages queue_namespace :package_repositories feature_category :package_registry + tags :exclude_from_kubernetes deduplicate :until_executing idempotent! diff --git a/app/workers/packages/maven/metadata/sync_worker.rb b/app/workers/packages/maven/metadata/sync_worker.rb index 6a6ef006289..8075bd015c2 100644 --- a/app/workers/packages/maven/metadata/sync_worker.rb +++ b/app/workers/packages/maven/metadata/sync_worker.rb @@ -11,6 +11,7 @@ module Packages queue_namespace :package_repositories feature_category :package_registry + tags :exclude_from_kubernetes deduplicate :until_executing idempotent! diff --git a/app/workers/packages/rubygems/extraction_worker.rb b/app/workers/packages/rubygems/extraction_worker.rb index 195d7285e32..e5cf049b003 100644 --- a/app/workers/packages/rubygems/extraction_worker.rb +++ b/app/workers/packages/rubygems/extraction_worker.rb @@ -9,6 +9,7 @@ module Packages queue_namespace :package_repositories feature_category :package_registry + tags :exclude_from_kubernetes deduplicate :until_executing idempotent! diff --git a/app/workers/pages_domain_ssl_renewal_worker.rb b/app/workers/pages_domain_ssl_renewal_worker.rb index cfe7a34b37d..2ab41aab795 100644 --- a/app/workers/pages_domain_ssl_renewal_worker.rb +++ b/app/workers/pages_domain_ssl_renewal_worker.rb @@ -6,7 +6,7 @@ class PagesDomainSslRenewalWorker # rubocop:disable Scalability/IdempotentWorker sidekiq_options retry: 3 feature_category :pages - tags :requires_disk_io + tags :requires_disk_io, :exclude_from_kubernetes def perform(domain_id) domain = PagesDomain.find_by_id(domain_id) diff --git a/app/workers/pages_domain_verification_worker.rb b/app/workers/pages_domain_verification_worker.rb index e867f93f900..b67b1b4d8ee 100644 --- a/app/workers/pages_domain_verification_worker.rb +++ b/app/workers/pages_domain_verification_worker.rb @@ -6,7 +6,7 @@ class PagesDomainVerificationWorker # rubocop:disable Scalability/IdempotentWork sidekiq_options retry: 3 feature_category :pages - tags :requires_disk_io + tags :requires_disk_io, :exclude_from_kubernetes # rubocop: disable CodeReuse/ActiveRecord def perform(domain_id) diff --git a/app/workers/pages_remove_worker.rb b/app/workers/pages_remove_worker.rb index 67ea18545a7..3e60df9027a 100644 --- a/app/workers/pages_remove_worker.rb +++ b/app/workers/pages_remove_worker.rb @@ -6,6 +6,7 @@ class PagesRemoveWorker # rubocop:disable Scalability/IdempotentWorker sidekiq_options retry: 3 feature_category :pages + tags :exclude_from_kubernetes loggable_arguments 0 def perform(project_id) diff --git a/app/workers/pages_transfer_worker.rb b/app/workers/pages_transfer_worker.rb index 58d5b96b156..0d80ec28310 100644 --- a/app/workers/pages_transfer_worker.rb +++ b/app/workers/pages_transfer_worker.rb @@ -8,6 +8,7 @@ class PagesTransferWorker # rubocop:disable Scalability/IdempotentWorker TransferFailedError = Class.new(StandardError) feature_category :pages + tags :exclude_from_kubernetes loggable_arguments 0, 1 def perform(method, args) diff --git a/app/workers/pages_update_configuration_worker.rb b/app/workers/pages_update_configuration_worker.rb index 3b6fadff5be..8bb9f76670b 100644 --- a/app/workers/pages_update_configuration_worker.rb +++ b/app/workers/pages_update_configuration_worker.rb @@ -7,6 +7,7 @@ class PagesUpdateConfigurationWorker idempotent! feature_category :pages + tags :exclude_from_kubernetes def self.perform_async(*args) return unless ::Settings.pages.local_store.enabled diff --git a/app/workers/pages_worker.rb b/app/workers/pages_worker.rb index 0c561626f8c..ee394271653 100644 --- a/app/workers/pages_worker.rb +++ b/app/workers/pages_worker.rb @@ -6,7 +6,7 @@ class PagesWorker # rubocop:disable Scalability/IdempotentWorker sidekiq_options retry: 3 feature_category :pages loggable_arguments 0, 1 - tags :requires_disk_io + tags :requires_disk_io, :exclude_from_kubernetes def perform(action, *arg) send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend diff --git a/app/workers/personal_access_tokens/expired_notification_worker.rb b/app/workers/personal_access_tokens/expired_notification_worker.rb index 9a8f3a36c61..73568960d38 100644 --- a/app/workers/personal_access_tokens/expired_notification_worker.rb +++ b/app/workers/personal_access_tokens/expired_notification_worker.rb @@ -8,6 +8,7 @@ module PersonalAccessTokens include CronjobQueue feature_category :authentication_and_authorization + tags :exclude_from_kubernetes def perform(*args) notification_service = NotificationService.new diff --git a/app/workers/project_destroy_worker.rb b/app/workers/project_destroy_worker.rb index 9ba054b2da6..be11fa65028 100644 --- a/app/workers/project_destroy_worker.rb +++ b/app/workers/project_destroy_worker.rb @@ -7,7 +7,7 @@ class ProjectDestroyWorker # rubocop:disable Scalability/IdempotentWorker include ExceptionBacktrace feature_category :source_code_management - tags :requires_disk_io + tags :requires_disk_io, :exclude_from_kubernetes def perform(project_id, user_id, params) project = Project.find(project_id) diff --git a/app/workers/projects/git_garbage_collect_worker.rb b/app/workers/projects/git_garbage_collect_worker.rb index cf236f8b660..0d67a8ac30e 100644 --- a/app/workers/projects/git_garbage_collect_worker.rb +++ b/app/workers/projects/git_garbage_collect_worker.rb @@ -5,6 +5,8 @@ module Projects extend ::Gitlab::Utils::Override include GitGarbageCollectMethods + tags :exclude_from_kubernetes + private override :find_resource diff --git a/app/workers/projects/post_creation_worker.rb b/app/workers/projects/post_creation_worker.rb index 7ea19d695aa..1970f79729f 100644 --- a/app/workers/projects/post_creation_worker.rb +++ b/app/workers/projects/post_creation_worker.rb @@ -7,6 +7,7 @@ module Projects sidekiq_options retry: 3 feature_category :source_code_management + tags :exclude_from_kubernetes idempotent! def perform(project_id) diff --git a/app/workers/propagate_integration_group_worker.rb b/app/workers/propagate_integration_group_worker.rb index 2a380d1cc36..28bf643e27b 100644 --- a/app/workers/propagate_integration_group_worker.rb +++ b/app/workers/propagate_integration_group_worker.rb @@ -6,6 +6,7 @@ class PropagateIntegrationGroupWorker sidekiq_options retry: 3 feature_category :integrations + tags :exclude_from_kubernetes idempotent! # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/workers/propagate_integration_inherit_descendant_worker.rb b/app/workers/propagate_integration_inherit_descendant_worker.rb index b28931018b4..66d011ba6aa 100644 --- a/app/workers/propagate_integration_inherit_descendant_worker.rb +++ b/app/workers/propagate_integration_inherit_descendant_worker.rb @@ -6,6 +6,7 @@ class PropagateIntegrationInheritDescendantWorker sidekiq_options retry: 3 feature_category :integrations + tags :exclude_from_kubernetes idempotent! # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/workers/propagate_integration_inherit_worker.rb b/app/workers/propagate_integration_inherit_worker.rb index 5520b774821..887b703b882 100644 --- a/app/workers/propagate_integration_inherit_worker.rb +++ b/app/workers/propagate_integration_inherit_worker.rb @@ -6,6 +6,7 @@ class PropagateIntegrationInheritWorker sidekiq_options retry: 3 feature_category :integrations + tags :exclude_from_kubernetes idempotent! # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/workers/propagate_integration_project_worker.rb b/app/workers/propagate_integration_project_worker.rb index 1ac342412b9..c709eda7d8e 100644 --- a/app/workers/propagate_integration_project_worker.rb +++ b/app/workers/propagate_integration_project_worker.rb @@ -6,6 +6,7 @@ class PropagateIntegrationProjectWorker sidekiq_options retry: 3 feature_category :integrations + tags :exclude_from_kubernetes idempotent! # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/workers/releases/create_evidence_worker.rb b/app/workers/releases/create_evidence_worker.rb index a62fb11f875..bd790e8d0ee 100644 --- a/app/workers/releases/create_evidence_worker.rb +++ b/app/workers/releases/create_evidence_worker.rb @@ -7,6 +7,7 @@ module Releases sidekiq_options retry: 3 feature_category :release_evidence + tags :exclude_from_kubernetes # pipeline_id is optional for backward compatibility with existing jobs # caller should always try to provide the pipeline and pass nil only diff --git a/app/workers/releases/manage_evidence_worker.rb b/app/workers/releases/manage_evidence_worker.rb index 46c8e743045..88b6c4aea06 100644 --- a/app/workers/releases/manage_evidence_worker.rb +++ b/app/workers/releases/manage_evidence_worker.rb @@ -8,6 +8,7 @@ module Releases include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :release_evidence + tags :exclude_from_kubernetes def perform releases = Release.without_evidence.released_within_2hrs diff --git a/app/workers/remove_unaccepted_member_invites_worker.rb b/app/workers/remove_unaccepted_member_invites_worker.rb index 6ee2e8065c1..c1f8e3881f1 100644 --- a/app/workers/remove_unaccepted_member_invites_worker.rb +++ b/app/workers/remove_unaccepted_member_invites_worker.rb @@ -7,6 +7,7 @@ class RemoveUnacceptedMemberInvitesWorker # rubocop:disable Scalability/Idempote include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :authentication_and_authorization + tags :exclude_from_kubernetes urgency :low idempotent! diff --git a/app/workers/schedule_merge_request_cleanup_refs_worker.rb b/app/workers/schedule_merge_request_cleanup_refs_worker.rb index 109fc3065e0..b5ea5298879 100644 --- a/app/workers/schedule_merge_request_cleanup_refs_worker.rb +++ b/app/workers/schedule_merge_request_cleanup_refs_worker.rb @@ -7,6 +7,7 @@ class ScheduleMergeRequestCleanupRefsWorker include CronjobQueue # rubocop:disable Scalability/CronWorkerContext feature_category :code_review + tags :exclude_from_kubernetes idempotent! # Based on existing data, MergeRequestCleanupRefsWorker can run 3 jobs per diff --git a/app/workers/ssh_keys/expired_notification_worker.rb b/app/workers/ssh_keys/expired_notification_worker.rb index 8e2e671977e..ccae4220094 100644 --- a/app/workers/ssh_keys/expired_notification_worker.rb +++ b/app/workers/ssh_keys/expired_notification_worker.rb @@ -8,6 +8,7 @@ module SshKeys include CronjobQueue feature_category :compliance_management + tags :exclude_from_kubernetes idempotent! def perform diff --git a/app/workers/ssh_keys/expiring_soon_notification_worker.rb b/app/workers/ssh_keys/expiring_soon_notification_worker.rb index 190baeeb9c5..2765fd984bc 100644 --- a/app/workers/ssh_keys/expiring_soon_notification_worker.rb +++ b/app/workers/ssh_keys/expiring_soon_notification_worker.rb @@ -8,6 +8,7 @@ module SshKeys include CronjobQueue feature_category :compliance_management + tags :exclude_from_kubernetes idempotent! def perform diff --git a/app/workers/todos_destroyer/destroyed_issuable_worker.rb b/app/workers/todos_destroyer/destroyed_issuable_worker.rb index dcb0f6653b9..a3a8147095e 100644 --- a/app/workers/todos_destroyer/destroyed_issuable_worker.rb +++ b/app/workers/todos_destroyer/destroyed_issuable_worker.rb @@ -7,6 +7,8 @@ module TodosDestroyer sidekiq_options retry: 3 include TodosDestroyerQueue + tags :exclude_from_kubernetes + idempotent! def perform(target_id, target_type) diff --git a/app/workers/user_status_cleanup/batch_worker.rb b/app/workers/user_status_cleanup/batch_worker.rb index 84e680f2302..f46b4119f9b 100644 --- a/app/workers/user_status_cleanup/batch_worker.rb +++ b/app/workers/user_status_cleanup/batch_worker.rb @@ -11,6 +11,7 @@ module UserStatusCleanup # rubocop:enable Scalability/CronWorkerContext feature_category :users + tags :exclude_from_kubernetes idempotent! diff --git a/app/workers/users/deactivate_dormant_users_worker.rb b/app/workers/users/deactivate_dormant_users_worker.rb index 8249da11921..e583823312f 100644 --- a/app/workers/users/deactivate_dormant_users_worker.rb +++ b/app/workers/users/deactivate_dormant_users_worker.rb @@ -7,6 +7,7 @@ module Users include CronjobQueue feature_category :utilization + tags :exclude_from_kubernetes NUMBER_OF_BATCHES = 50 BATCH_SIZE = 200 diff --git a/app/workers/users/update_open_issue_count_worker.rb b/app/workers/users/update_open_issue_count_worker.rb index e5344baa012..efe4e507e20 100644 --- a/app/workers/users/update_open_issue_count_worker.rb +++ b/app/workers/users/update_open_issue_count_worker.rb @@ -5,6 +5,7 @@ module Users include ApplicationWorker feature_category :users + tags :exclude_from_kubernetes idempotent! def perform(target_user_ids) diff --git a/app/workers/web_hooks/destroy_worker.rb b/app/workers/web_hooks/destroy_worker.rb index 21f2ae3ab90..c1886576c41 100644 --- a/app/workers/web_hooks/destroy_worker.rb +++ b/app/workers/web_hooks/destroy_worker.rb @@ -7,6 +7,7 @@ module WebHooks sidekiq_options retry: 3 feature_category :integrations + tags :exclude_from_kubernetes urgency :low idempotent! diff --git a/app/workers/wikis/git_garbage_collect_worker.rb b/app/workers/wikis/git_garbage_collect_worker.rb index 1b455c50618..f34d3be51d2 100644 --- a/app/workers/wikis/git_garbage_collect_worker.rb +++ b/app/workers/wikis/git_garbage_collect_worker.rb @@ -5,6 +5,8 @@ module Wikis extend ::Gitlab::Utils::Override include GitGarbageCollectMethods + tags :exclude_from_kubernetes + private override :find_resource diff --git a/changelogs/unreleased/292253-epic-task-epic-descr.yml b/changelogs/unreleased/292253-epic-task-epic-descr.yml new file mode 100644 index 00000000000..aaf7ef56127 --- /dev/null +++ b/changelogs/unreleased/292253-epic-task-epic-descr.yml @@ -0,0 +1,5 @@ +--- +title: Track checking/unchecking tasks on epics +merge_request: 59871 +author: +type: added diff --git a/changelogs/unreleased/301141-error-getting-vulnerability-list.yml b/changelogs/unreleased/301141-error-getting-vulnerability-list.yml new file mode 100644 index 00000000000..521f7533b4d --- /dev/null +++ b/changelogs/unreleased/301141-error-getting-vulnerability-list.yml @@ -0,0 +1,5 @@ +--- +title: Drop Vulnerabilities without backing Finding +merge_request: 60023 +author: +type: other diff --git a/changelogs/unreleased/327916-enable-packages_finder_helper_deploy_token-by-default.yml b/changelogs/unreleased/327916-enable-packages_finder_helper_deploy_token-by-default.yml new file mode 100644 index 00000000000..672fa9cc351 --- /dev/null +++ b/changelogs/unreleased/327916-enable-packages_finder_helper_deploy_token-by-default.yml @@ -0,0 +1,5 @@ +--- +title: Improve the packages finder helper SQL queries when handling deploy tokens +merge_request: 59739 +author: +type: performance diff --git a/config/feature_flags/development/packages_finder_helper_deploy_token.yml b/config/feature_flags/development/packages_finder_helper_deploy_token.yml index fcc73cafd64..b847942706a 100644 --- a/config/feature_flags/development/packages_finder_helper_deploy_token.yml +++ b/config/feature_flags/development/packages_finder_helper_deploy_token.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/326808 milestone: '13.11' type: development group: group::package -default_enabled: false +default_enabled: true diff --git a/db/post_migrate/20210423160427_schedule_drop_invalid_vulnerabilities.rb b/db/post_migrate/20210423160427_schedule_drop_invalid_vulnerabilities.rb new file mode 100644 index 00000000000..8199da937d3 --- /dev/null +++ b/db/post_migrate/20210423160427_schedule_drop_invalid_vulnerabilities.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class ScheduleDropInvalidVulnerabilities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'DropInvalidVulnerabilities' + DELAY_INTERVAL = 2.minutes.to_i + BATCH_SIZE = 10_000 + + disable_ddl_transaction! + + def up + say "Scheduling #{MIGRATION} jobs" + queue_background_migration_jobs_by_range_at_intervals( + define_batchable_model('vulnerabilities'), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + # no-op + end +end diff --git a/db/schema_migrations/20210423160427 b/db/schema_migrations/20210423160427 new file mode 100644 index 00000000000..ecae878d8a2 --- /dev/null +++ b/db/schema_migrations/20210423160427 @@ -0,0 +1 @@ +e8f88972826a030894f38b8959418096771bf4e88a3b90f0026aaae3977d1db1
\ No newline at end of file diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index 491f65bd88a..9aefbed4f07 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -114,6 +114,18 @@ rails schema statement: [`add_index`](https://api.rubyonrails.org/v5.2/classes/A This is a blocking operation, but it doesn't cause problems because the table is not yet used, and therefore it does not have any records yet. +## Naming conventions + +We keep column names consistent with [ActiveRecord's schema conventions](https://guides.rubyonrails.org/active_record_basics.html#schema-conventions). + +Custom index names should follow the pattern `index_#{table_name}_on_#{column_1}_and_#{column_2}_#{condition}`. + +Examples: + +- `index_services_on_type_and_id_and_template_when_active` +- `index_projects_on_id_service_desk_enabled` +- `index_clusters_on_enabled_cluster_type_id_and_created_at` + ## Heavy operations in a single transaction When using a single-transaction migration, a transaction holds a database connection diff --git a/doc/development/usage_ping/dictionary.md b/doc/development/usage_ping/dictionary.md index 036683b3d18..9996d6eec87 100644 --- a/doc/development/usage_ping/dictionary.md +++ b/doc/development/usage_ping/dictionary.md @@ -1016,6 +1016,54 @@ Status: `data_available` Tiers: `free` +### `counts.g_project_management_users_checking_epic_task_monthly` + +Counts of MAU checking epic task + +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210421080207_g_project_management_users_checking_epic_task_monthly.yml) + +Group: `group::product planning` + +Status: `implemented` + +Tiers: `premium`, `ultimate` + +### `counts.g_project_management_users_checking_epic_task_weekly` + +Counts of WAU checking epic task + +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210421075943_g_project_management_users_checking_epic_task_weekly.yml) + +Group: `group::product planning` + +Status: `implemented` + +Tiers: `premium`, `ultimate` + +### `counts.g_project_management_users_unchecking_epic_task_monthly` + +Counts of MAU unchecking epic task + +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210421102516_g_project_management_users_unchecking_epic_task_monthly.yml) + +Group: `group::product planning` + +Status: `implemented` + +Tiers: `premium`, `ultimate` + +### `counts.g_project_management_users_unchecking_epic_task_weekly` + +Counts of WAU unchecking epic task + +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210421102812_g_project_management_users_unchecking_epic_task_weekly.yml) + +Group: `group::product planning` + +Status: `implemented` + +Tiers: `premium`, `ultimate` + ### `counts.geo_event_log_max_id` Number of replication events on a Geo primary @@ -6346,7 +6394,7 @@ Tiers: `free`, `premium`, `ultimate` ### `database.pg_system_id` -Missing description +TBD [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216183248_pg_system_id.yml) @@ -7680,7 +7728,7 @@ Tiers: `free`, `premium`, `ultimate` Number of projects using 5 min production app CI template in last 7 days. -[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210216184515_p_ci_templates_5_min_production_app_weekly.yml) +[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210216184515_p_ci_templates_5_min_production_app_weekly.yml) Group: `group::5-min-app` @@ -15926,6 +15974,8 @@ Tiers: `free` Histogram (buckets 1 to 100) of projects with at least 1 enabled integration. +[Object JSON schema](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/objects_schemas/projects_with_enabled_alert_integrations_histogram.json) + [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210309165717_projects_with_enabled_alert_integrations_histogram.yml) Group: `group::monitor` diff --git a/lib/gitlab/background_migration/drop_invalid_vulnerabilities.rb b/lib/gitlab/background_migration/drop_invalid_vulnerabilities.rb new file mode 100644 index 00000000000..ddafdb4a0e0 --- /dev/null +++ b/lib/gitlab/background_migration/drop_invalid_vulnerabilities.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# rubocop: disable Style/Documentation +class Gitlab::BackgroundMigration::DropInvalidVulnerabilities + # rubocop: disable Gitlab/NamespacedClass + class Vulnerability < ActiveRecord::Base + self.table_name = "vulnerabilities" + has_many :findings, class_name: 'VulnerabilitiesFinding', inverse_of: :vulnerability + end + + class VulnerabilitiesFinding < ActiveRecord::Base + self.table_name = "vulnerability_occurrences" + belongs_to :vulnerability, class_name: 'Vulnerability', inverse_of: :findings, foreign_key: 'vulnerability_id' + end + # rubocop: enable Gitlab/NamespacedClass + + # rubocop: disable CodeReuse/ActiveRecord + def perform(start_id, end_id) + Vulnerability + .where(id: start_id..end_id) + .left_joins(:findings) + .where(vulnerability_occurrences: { vulnerability_id: nil }) + .delete_all + end + # rubocop: enable CodeReuse/ActiveRecord +end diff --git a/lib/gitlab/ci/artifacts/migration_helper.rb b/lib/gitlab/ci/artifacts/migration_helper.rb deleted file mode 100644 index fbc120af410..00000000000 --- a/lib/gitlab/ci/artifacts/migration_helper.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Ci - module Artifacts - class MigrationHelper - def migrate_to_remote_storage(&block) - artifacts = ::Ci::JobArtifact.with_files_stored_locally - migrate(artifacts, ObjectStorage::Store::REMOTE, &block) - end - - def migrate_to_local_storage(&block) - artifacts = ::Ci::JobArtifact.with_files_stored_remotely - migrate(artifacts, ObjectStorage::Store::LOCAL, &block) - end - - private - - def batch_size - ENV.fetch('MIGRATION_BATCH_SIZE', 10).to_i - end - - def migrate(artifacts, store, &block) - artifacts.find_each(batch_size: batch_size) do |artifact| # rubocop:disable CodeReuse/ActiveRecord - artifact.file.migrate!(store) - - yield artifact if block - rescue StandardError => e - raise StandardError.new("Failed to transfer artifact of type #{artifact.file_type} and ID #{artifact.id} with error: #{e.message}") - end - end - end - end - end -end diff --git a/lib/gitlab/database/background_migration/batched_migration_wrapper.rb b/lib/gitlab/database/background_migration/batched_migration_wrapper.rb index 4851c611b5a..e37df102872 100644 --- a/lib/gitlab/database/background_migration/batched_migration_wrapper.rb +++ b/lib/gitlab/database/background_migration/batched_migration_wrapper.rb @@ -67,6 +67,7 @@ module Gitlab metric_for(:counter_updated_tuples).increment(base_labels, tracking_record.batch_size) metric_for(:gauge_migrated_tuples).set(base_labels, tracking_record.batched_migration.migrated_tuple_count) metric_for(:gauge_total_tuple_count).set(base_labels, tracking_record.batched_migration.total_tuple_count) + metric_for(:gauge_last_update_time).set(base_labels, Time.current.to_i) if metrics = tracking_record.metrics metrics['timings']&.each do |key, timings| @@ -120,6 +121,10 @@ module Gitlab gauge_total_tuple_count: Gitlab::Metrics.gauge( :batched_migration_total_tuple_count, 'Total tuple count the migration needs to touch' + ), + gauge_last_update_time: Gitlab::Metrics.gauge( + :batched_migration_last_update_time_seconds, + 'Unix epoch time in seconds' ) } end diff --git a/lib/gitlab/local_and_remote_storage_migration/artifact_migrater.rb b/lib/gitlab/local_and_remote_storage_migration/artifact_migrater.rb new file mode 100644 index 00000000000..b25305382b2 --- /dev/null +++ b/lib/gitlab/local_and_remote_storage_migration/artifact_migrater.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Gitlab + module LocalAndRemoteStorageMigration + class ArtifactMigrater < Gitlab::LocalAndRemoteStorageMigration::BaseMigrater + private + + def items_with_files_stored_locally + ::Ci::JobArtifact.with_files_stored_locally + end + + def items_with_files_stored_remotely + ::Ci::JobArtifact.with_files_stored_remotely + end + end + end +end diff --git a/lib/gitlab/local_and_remote_storage_migration/base_migrater.rb b/lib/gitlab/local_and_remote_storage_migration/base_migrater.rb new file mode 100644 index 00000000000..f859d293e76 --- /dev/null +++ b/lib/gitlab/local_and_remote_storage_migration/base_migrater.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module Gitlab + module LocalAndRemoteStorageMigration + class BaseMigrater + def initialize(logger = nil) + @logger = logger + end + + def migrate_to_remote_storage + logger.info('Starting transfer to remote storage') + + migrate(items_with_files_stored_locally, ObjectStorage::Store::REMOTE) + end + + def migrate_to_local_storage + logger.info('Starting transfer to local storage') + + migrate(items_with_files_stored_remotely, ObjectStorage::Store::LOCAL) + end + + private + + attr_reader :logger + + def batch_size + ENV.fetch('MIGRATION_BATCH_SIZE', 10).to_i + end + + def migrate(items, store) + items.find_each(batch_size: batch_size) do |item| # rubocop:disable CodeReuse/ActiveRecord + item.file.migrate!(store) + + log_success(item, store) + rescue StandardError => e + log_error(e, item) + end + end + + def log_success(item, store) + logger.info("Transferred #{item.class.name} ID #{item.id} of type #{item.file_type} with size #{item.size} to #{storage_label(store)} storage") + end + + def log_error(err, item) + logger.warn("Failed to transfer #{item.class.name} of type #{item.file_type} and ID #{item.id} with error: #{err.message}") + end + + def storage_label(store) + if store == ObjectStorage::Store::LOCAL + 'local' + else + 'object' + end + end + end + end +end diff --git a/lib/gitlab/local_and_remote_storage_migration/pages_deployment_migrater.rb b/lib/gitlab/local_and_remote_storage_migration/pages_deployment_migrater.rb new file mode 100644 index 00000000000..70437936332 --- /dev/null +++ b/lib/gitlab/local_and_remote_storage_migration/pages_deployment_migrater.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Gitlab + module LocalAndRemoteStorageMigration + class PagesDeploymentMigrater < Gitlab::LocalAndRemoteStorageMigration::BaseMigrater + private + + def items_with_files_stored_locally + ::PagesDeployment.with_files_stored_locally + end + + def items_with_files_stored_remotely + ::PagesDeployment.with_files_stored_remotely + end + end + end +end diff --git a/lib/gitlab/pages/migration_helper.rb b/lib/gitlab/pages/migration_helper.rb deleted file mode 100644 index 403b20f6059..00000000000 --- a/lib/gitlab/pages/migration_helper.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Pages - class MigrationHelper - def initialize(logger = nil) - @logger = logger - end - - def migrate_to_remote_storage - deployments = ::PagesDeployment.with_files_stored_locally - migrate(deployments, ObjectStorage::Store::REMOTE) - end - - def migrate_to_local_storage - deployments = ::PagesDeployment.with_files_stored_remotely - migrate(deployments, ObjectStorage::Store::LOCAL) - end - - private - - def batch_size - ENV.fetch('MIGRATION_BATCH_SIZE', 10).to_i - end - - def migrate(deployments, store) - deployments.find_each(batch_size: batch_size) do |deployment| # rubocop:disable CodeReuse/ActiveRecord - deployment.file.migrate!(store) - - log_success(deployment, store) - rescue StandardError => e - log_error(e, deployment) - end - end - - def log_success(deployment, store) - logger.info("Transferred deployment ID #{deployment.id} of type #{deployment.file_type} with size #{deployment.size} to #{storage_label(store)} storage") - end - - def log_error(err, deployment) - logger.warn("Failed to transfer deployment of type #{deployment.file_type} and ID #{deployment.id} with error: #{err.message}") - end - - def storage_label(store) - if store == ObjectStorage::Store::LOCAL - 'local' - else - 'object' - end - end - end - end -end diff --git a/lib/gitlab/usage_data_counters/known_events/epic_events.yml b/lib/gitlab/usage_data_counters/known_events/epic_events.yml index 80460dbe4d2..6301292a0b6 100644 --- a/lib/gitlab/usage_data_counters/known_events/epic_events.yml +++ b/lib/gitlab/usage_data_counters/known_events/epic_events.yml @@ -9,6 +9,20 @@ aggregation: daily feature_flag: track_epics_activity +# content change events + +- name: project_management_users_unchecking_epic_task + category: epics_usage + redis_slot: project_management + aggregation: daily + feature_flag: track_epics_activity + +- name: project_management_users_checking_epic_task + category: epics_usage + redis_slot: project_management + aggregation: daily + feature_flag: track_epics_activity + - name: g_project_management_users_updating_epic_titles category: epics_usage redis_slot: project_management diff --git a/lib/tasks/gitlab/artifacts/migrate.rake b/lib/tasks/gitlab/artifacts/migrate.rake index 160d084cf90..4c312ea492b 100644 --- a/lib/tasks/gitlab/artifacts/migrate.rake +++ b/lib/tasks/gitlab/artifacts/migrate.rake @@ -8,14 +8,11 @@ namespace :gitlab do namespace :artifacts do task migrate: :environment do logger = Logger.new(STDOUT) - logger.info('Starting transfer of artifacts to remote storage') - helper = Gitlab::Ci::Artifacts::MigrationHelper.new + helper = Gitlab::LocalAndRemoteStorageMigration::ArtifactMigrater.new(logger) begin - helper.migrate_to_remote_storage do |artifact| - logger.info("Transferred artifact ID #{artifact.id} of type #{artifact.file_type} with size #{artifact.size} to object storage") - end + helper.migrate_to_remote_storage rescue StandardError => e logger.error(e.message) end @@ -23,14 +20,11 @@ namespace :gitlab do task migrate_to_local: :environment do logger = Logger.new(STDOUT) - logger.info('Starting transfer of artifacts to local storage') - helper = Gitlab::Ci::Artifacts::MigrationHelper.new + helper = Gitlab::LocalAndRemoteStorageMigration::ArtifactMigrater.new(logger) begin - helper.migrate_to_local_storage do |artifact| - logger.info("Transferred artifact ID #{artifact.id} of type #{artifact.file_type} with size #{artifact.size} to local storage") - end + helper.migrate_to_local_storage rescue StandardError => e logger.error(e.message) end diff --git a/lib/tasks/gitlab/pages.rake b/lib/tasks/gitlab/pages.rake index f83ea296bd1..684d62d1367 100644 --- a/lib/tasks/gitlab/pages.rake +++ b/lib/tasks/gitlab/pages.rake @@ -61,9 +61,8 @@ namespace :gitlab do namespace :deployments do task migrate_to_object_storage: :gitlab_environment do logger = Logger.new(STDOUT) - logger.info('Starting transfer of pages deployments to remote storage') - helper = Gitlab::Pages::MigrationHelper.new(logger) + helper = Gitlab::LocalAndRemoteStorageMigration::PagesDeploymentMigrater.new(logger) begin helper.migrate_to_remote_storage @@ -74,9 +73,8 @@ namespace :gitlab do task migrate_to_local: :gitlab_environment do logger = Logger.new(STDOUT) - logger.info('Starting transfer of Pages deployments to local storage') - helper = Gitlab::Pages::MigrationHelper.new(logger) + helper = Gitlab::LocalAndRemoteStorageMigration::PagesDeploymentMigrater.new(logger) begin helper.migrate_to_local_storage diff --git a/locale/gitlab.pot b/locale/gitlab.pot index c14f2470296..18351553c64 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6692,6 +6692,9 @@ msgstr "" msgid "CloudLicense|Free trial" msgstr "" +msgid "CloudLicense|Get help for the most common connectivity issues by %{linkStart}troubleshooting the activation code%{linkEnd}." +msgstr "" + msgid "CloudLicense|I agree that my use of the GitLab Software is subject to the Subscription Agreement located at the %{linkStart}Terms of Service%{linkEnd}, unless otherwise agreed to in writing with GitLab." msgstr "" @@ -6719,6 +6722,9 @@ msgstr "" msgid "CloudLicense|This is the number of %{billableUsersLinkStart}billable users%{billableUsersLinkEnd} on your installation, and this is the minimum number you need to purchase when you renew your license." msgstr "" +msgid "CloudLicense|To activate your subscription, connect to GitLab servers through the %{linkStart}Cloud Sync service%{linkEnd}, a hassle-free way to manage your subscription." +msgstr "" + msgid "CloudLicense|Users in subscription" msgstr "" @@ -11271,7 +11277,7 @@ msgstr "" msgid "DevopsAdoption|DevOps adoption tracks the use of key features across your favorite groups. Add a group to the table to begin." msgstr "" -msgid "DevopsAdoption|Feature adoption is based on usage in the last calendar month. Last updated: %{timestamp}." +msgid "DevopsAdoption|Feature adoption is based on usage in the current calendar month. Last updated: %{timestamp}." msgstr "" msgid "DevopsAdoption|Filter by name" @@ -32237,6 +32243,9 @@ msgstr "" msgid "There are running deployments on the environment. Please retry later." msgstr "" +msgid "There is a connectivity issue" +msgstr "" + msgid "There is a halted Elasticsearch migration" msgstr "" diff --git a/qa/qa/fixtures/rubygems_package/mygem.gemspec b/qa/qa/fixtures/rubygems_package/mygem.gemspec new file mode 100644 index 00000000000..33d8c88e5ac --- /dev/null +++ b/qa/qa/fixtures/rubygems_package/mygem.gemspec @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +Gem::Specification.new do |s| + s.name = 'mygem' + s.authors = ['Tanuki Steve', 'Hal 9000'] + s.author = 'Tanuki Steve' + s.version = '0.0.1' + s.date = '2011-09-29' + s.summary = 'package is the best' + s.files = ['lib/hello_gem.rb'] + s.require_paths = ['lib'] + + s.description = 'A test package for GitLab.' + s.email = 'tanuki@not_real.com' + s.homepage = 'https://gitlab.com/ruby-co/my-package' + s.license = 'MIT' + + s.metadata = { + 'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues', + 'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md', + 'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs', + 'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme', + 'source_code_uri' => 'https://gitlab.com/ruby-co/my-package' + } + + s.bindir = 'bin' + s.platform = Gem::Platform::RUBY + s.post_install_message = 'Installed, thank you!' + s.rdoc_options = ['--main'] + s.required_ruby_version = '>= 2.7.0' + s.required_rubygems_version = '>= 1.8.11' + s.requirements = 'A high powered server or calculator' + s.rubygems_version = '1.8.09' + + s.add_dependency 'dependency_1', '~> 1.2.3' + s.add_dependency 'dependency_2', '3.0.0' + s.add_dependency 'dependency_3', '>= 1.0.0' + s.add_dependency 'dependency_4' +end diff --git a/qa/qa/specs/features/browser_ui/5_package/rubygems_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/rubygems_registry_spec.rb new file mode 100644 index 00000000000..ccc82ce7e23 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/5_package/rubygems_registry_spec.rb @@ -0,0 +1,125 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Package', :orchestrated, :packages do + describe 'RubyGems Repository' do + include Runtime::Fixtures + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'rubygems-package-project' + end + end + + let(:package) do + Resource::Package.new.tap do |package| + package.name = 'mygem' + package.project = project + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{project.name}"] + runner.executor = :docker + runner.project = project + end + end + + let(:gitlab_address_with_port) do + uri = URI.parse(Runtime::Scenario.gitlab_address) + "#{uri.scheme}://#{uri.host}:#{uri.port}" + end + + before do + Runtime::Feature.enable(:rubygem_packages, project: project) + end + + after do + Runtime::Feature.disable(:rubygem_packages, project: project) + runner.remove_via_api! + package.remove_via_api! + project.remove_via_api! + end + + it 'publishes and deletes a Ruby gem', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1131' do + Flow::Login.sign_in + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.directory = Pathname + .new(__dir__) + .join('../../../../fixtures/rubygems_package') + push.commit_message = 'RubyGems package' + end + + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add mygem.gemspec' + commit.add_files( + [ + { + file_path: '.gitlab-ci.yml', + content: + <<~YAML + image: ruby + + test_package: + stage: deploy + before_script: + - mkdir ~/.gem + - echo "---" > ~/.gem/credentials + - | + echo "#{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials + - chmod 0600 ~/.gem/credentials + script: + - gem build mygem + - gem push mygem-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems + tags: + - "runner-for-#{project.name}" + YAML + }, + { + file_path: 'lib/hello_gem.rb', + content: + <<~RUBY + class HelloWorld + def self.hi + puts "Hello world!" + end + end + RUBY + } + ] + ) + end + + project.visit! + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('test_package') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + + Page::Project::Menu.perform(&:click_packages_link) + + Page::Project::Packages::Index.perform do |index| + expect(index).to have_package(package.name) + index.click_package(package.name) + end + + Page::Project::Packages::Show.perform(&:click_delete) + + Page::Project::Packages::Index.perform do |index| + expect(index).to have_content("Package deleted successfully") + expect(index).not_to have_package(package.name) + end + end + end + end +end diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 23ffb4190e4..da9def60ff9 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -189,7 +189,7 @@ RSpec.describe 'Issue Sidebar' do click_link user2.name end - find('.js-right-sidebar').click + find('.participants').click wait_for_requests open_assignees_dropdown diff --git a/spec/lib/gitlab/background_migration/drop_invalid_vulnerabilities_spec.rb b/spec/lib/gitlab/background_migration/drop_invalid_vulnerabilities_spec.rb new file mode 100644 index 00000000000..9fd3cd5edde --- /dev/null +++ b/spec/lib/gitlab/background_migration/drop_invalid_vulnerabilities_spec.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::BackgroundMigration::DropInvalidVulnerabilities, schema: 20201110110454 do + let_it_be(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') } + let_it_be(:users) { table(:users) } + let_it_be(:user) { create_user! } + let_it_be(:project) { table(:projects).create!(id: 123, namespace_id: namespace.id) } + + let_it_be(:scanners) { table(:vulnerability_scanners) } + let_it_be(:scanner) { scanners.create!(project_id: project.id, external_id: 'test 1', name: 'test scanner 1') } + let_it_be(:different_scanner) { scanners.create!(project_id: project.id, external_id: 'test 2', name: 'test scanner 2') } + + let_it_be(:vulnerabilities) { table(:vulnerabilities) } + let_it_be(:vulnerability_with_finding) do + create_vulnerability!( + project_id: project.id, + author_id: user.id + ) + end + + let_it_be(:vulnerability_without_finding) do + create_vulnerability!( + project_id: project.id, + author_id: user.id + ) + end + + let_it_be(:vulnerability_identifiers) { table(:vulnerability_identifiers) } + let_it_be(:primary_identifier) do + vulnerability_identifiers.create!( + project_id: project.id, + external_type: 'uuid-v5', + external_id: 'uuid-v5', + fingerprint: '7e394d1b1eb461a7406d7b1e08f057a1cf11287a', + name: 'Identifier for UUIDv5') + end + + let_it_be(:vulnerabilities_findings) { table(:vulnerability_occurrences) } + let_it_be(:finding) do + create_finding!( + vulnerability_id: vulnerability_with_finding.id, + project_id: project.id, + scanner_id: scanner.id, + primary_identifier_id: primary_identifier.id + ) + end + + subject { described_class.new.perform(vulnerability_with_finding.id, vulnerability_without_finding.id) } + + it 'drops Vulnerabilities without any Findings' do + expect(vulnerabilities.pluck(:id)).to eq([vulnerability_with_finding.id, vulnerability_without_finding.id]) + + expect { subject }.to change(vulnerabilities, :count).by(-1) + + expect(vulnerabilities.pluck(:id)).to eq([vulnerability_with_finding.id]) + end + + private + + def create_vulnerability!(project_id:, author_id:, title: 'test', severity: 7, confidence: 7, report_type: 0) + vulnerabilities.create!( + project_id: project_id, + author_id: author_id, + title: title, + severity: severity, + confidence: confidence, + report_type: report_type + ) + end + + # rubocop:disable Metrics/ParameterLists + def create_finding!( + vulnerability_id:, project_id:, scanner_id:, primary_identifier_id:, + name: "test", severity: 7, confidence: 7, report_type: 0, + project_fingerprint: '123qweasdzxc', location_fingerprint: 'test', + metadata_version: 'test', raw_metadata: 'test', uuid: 'test') + vulnerabilities_findings.create!( + vulnerability_id: vulnerability_id, + project_id: project_id, + name: name, + severity: severity, + confidence: confidence, + report_type: report_type, + project_fingerprint: project_fingerprint, + scanner_id: scanner_id, + primary_identifier_id: primary_identifier_id, + location_fingerprint: location_fingerprint, + metadata_version: metadata_version, + raw_metadata: raw_metadata, + uuid: uuid + ) + end + # rubocop:enable Metrics/ParameterLists + + def create_user!(name: "Example User", email: "user@example.com", user_type: nil) + users.create!( + name: name, + email: email, + username: name, + projects_limit: 0, + user_type: user_type, + confirmed_at: Time.current + ) + end +end diff --git a/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb b/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb index 987f2c5a935..c1183a15e37 100644 --- a/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb +++ b/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb @@ -142,7 +142,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' it 'reports job duration' do freeze_time do expect(Time).to receive(:current).and_return(Time.zone.now - 5.seconds).ordered - expect(Time).to receive(:current).and_return(Time.zone.now).ordered + allow(Time).to receive(:current).and_call_original expect(described_class.metrics[:gauge_job_duration]).to receive(:set).with(labels, 5.seconds) @@ -155,6 +155,14 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' subject end + + it 'reports last updated at timestamp' do + freeze_time do + expect(described_class.metrics[:gauge_last_update_time]).to receive(:set).with(labels, Time.current.to_i) + + subject + end + end end context 'when the migration job does not raise an error' do diff --git a/spec/migrations/20210423160427_schedule_drop_invalid_vulnerabilities_spec.rb b/spec/migrations/20210423160427_schedule_drop_invalid_vulnerabilities_spec.rb new file mode 100644 index 00000000000..1588cec0258 --- /dev/null +++ b/spec/migrations/20210423160427_schedule_drop_invalid_vulnerabilities_spec.rb @@ -0,0 +1,114 @@ +# frozen_string_literal: true + +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20210423160427_schedule_drop_invalid_vulnerabilities.rb') + +RSpec.describe ScheduleDropInvalidVulnerabilities, :migration do + let_it_be(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') } + let_it_be(:users) { table(:users) } + let_it_be(:user) { create_user! } + let_it_be(:project) { table(:projects).create!(id: 123, namespace_id: namespace.id) } + + let_it_be(:scanners) { table(:vulnerability_scanners) } + let_it_be(:scanner) { scanners.create!(project_id: project.id, external_id: 'test 1', name: 'test scanner 1') } + let_it_be(:different_scanner) { scanners.create!(project_id: project.id, external_id: 'test 2', name: 'test scanner 2') } + + let_it_be(:vulnerabilities) { table(:vulnerabilities) } + let_it_be(:vulnerability_with_finding) do + create_vulnerability!( + project_id: project.id, + author_id: user.id + ) + end + + let_it_be(:vulnerability_without_finding) do + create_vulnerability!( + project_id: project.id, + author_id: user.id + ) + end + + let_it_be(:vulnerability_identifiers) { table(:vulnerability_identifiers) } + let_it_be(:primary_identifier) do + vulnerability_identifiers.create!( + project_id: project.id, + external_type: 'uuid-v5', + external_id: 'uuid-v5', + fingerprint: '7e394d1b1eb461a7406d7b1e08f057a1cf11287a', + name: 'Identifier for UUIDv5') + end + + let_it_be(:vulnerabilities_findings) { table(:vulnerability_occurrences) } + let_it_be(:finding) do + create_finding!( + vulnerability_id: vulnerability_with_finding.id, + project_id: project.id, + scanner_id: scanner.id, + primary_identifier_id: primary_identifier.id + ) + end + + before do + stub_const("#{described_class}::BATCH_SIZE", 1) + end + + around do |example| + freeze_time { Sidekiq::Testing.fake! { example.run } } + end + + it 'schedules background migrations' do + migrate! + + expect(BackgroundMigrationWorker.jobs.size).to eq(2) + expect(described_class::MIGRATION).to be_scheduled_migration(vulnerability_with_finding.id, vulnerability_with_finding.id) + expect(described_class::MIGRATION).to be_scheduled_migration(vulnerability_without_finding.id, vulnerability_without_finding.id) + end + + private + + def create_vulnerability!(project_id:, author_id:, title: 'test', severity: 7, confidence: 7, report_type: 0) + vulnerabilities.create!( + project_id: project_id, + author_id: author_id, + title: title, + severity: severity, + confidence: confidence, + report_type: report_type + ) + end + + # rubocop:disable Metrics/ParameterLists + def create_finding!( + vulnerability_id:, project_id:, scanner_id:, primary_identifier_id:, + name: "test", severity: 7, confidence: 7, report_type: 0, + project_fingerprint: '123qweasdzxc', location_fingerprint: 'test', + metadata_version: 'test', raw_metadata: 'test', uuid: 'test') + vulnerabilities_findings.create!( + vulnerability_id: vulnerability_id, + project_id: project_id, + name: name, + severity: severity, + confidence: confidence, + report_type: report_type, + project_fingerprint: project_fingerprint, + scanner_id: scanner_id, + primary_identifier_id: primary_identifier_id, + location_fingerprint: location_fingerprint, + metadata_version: metadata_version, + raw_metadata: raw_metadata, + uuid: uuid + ) + end + # rubocop:enable Metrics/ParameterLists + + def create_user!(name: "Example User", email: "user@example.com", user_type: nil) + users.create!( + name: name, + email: email, + username: name, + projects_limit: 0, + user_type: user_type, + confirmed_at: Time.current + ) + end +end diff --git a/spec/support/shared_examples/services/issuable_shared_examples.rb b/spec/support/shared_examples/services/issuable_shared_examples.rb index 5b3e0f9e0b9..ca0d940481f 100644 --- a/spec/support/shared_examples/services/issuable_shared_examples.rb +++ b/spec/support/shared_examples/services/issuable_shared_examples.rb @@ -23,9 +23,14 @@ RSpec.shared_examples 'updating a single task' do if try(:merge_request) expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter) .to receive(:track_task_item_status_changed).once.with(user: user) + elsif try(:epic) + expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter) + .to receive(:track_epic_task_checked).once.with(author: user) else expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter) .not_to receive(:track_task_item_status_changed) + expect(Gitlab::UsageDataCounters::EpicActivityUniqueCounter) + .not_to receive(:track_epic_task_checked) end update_issuable( |