Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-05-14 00:08:57 +00:00
parent 8d9963a8e3
commit 3e81e2db0b
43 changed files with 738 additions and 100 deletions

View File

@ -243,6 +243,11 @@ Rails/ApplicationRecord:
- ee/db/**/*.rb
- ee/spec/**/*.rb
Rails/ActiveRecordCallbacksOrder:
Include:
- app/models/**/*.rb
- ee/app/models/**/*.rb
Cop/DefaultScope:
Enabled: true
@ -258,6 +263,11 @@ Rails/IndexBy:
Exclude:
- 'tooling/danger/**/*.rb'
Rails/InverseOf:
Include:
- app/models/**/*.rb
- ee/app/models/**/*.rb
# This is currently exiting with a rubocop exception error and should be
# resolved hopefully a future update
# An error occurred while Rails/UniqueValidationWithoutIndex cop was inspecting

View File

@ -11,18 +11,6 @@ Gitlab/PolicyRuleBoolean:
Exclude:
- 'ee/app/policies/ee/identity_provider_policy.rb'
# Offense count: 118
RSpec/RepeatedExampleGroupBody:
Enabled: false
# Offense count: 26
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/ActiveRecordCallbacksOrder:
Enabled: false
# Offense count: 313
# Configuration parameters: Include.
# Include: db/migrate/*.rb
Rails/CreateTableWithTimestamps:
@ -34,32 +22,6 @@ Rails/CreateTableWithTimestamps:
Rails/HasManyOrHasOneDependent:
Enabled: false
# Offense count: 118
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/InverseOf:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/mailers/**/*.rb
Rails/MailerName:
Exclude:
- 'app/mailers/notify.rb'
# Offense count: 51
# Cop supports --auto-correct.
Rails/NegateInclude:
Enabled: false
# Offense count: 44
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: exists, where
Rails/WhereExists:
Enabled: false
# Offense count: 42
# Cop supports --auto-correct.
Style/CaseLikeIf:
@ -71,15 +33,3 @@ Style/CaseLikeIf:
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Enabled: false
# Offense count: 59
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: braces, no_braces
Style/HashAsLastArrayItem:
Enabled: false
# Offense count: 64
# Cop supports --auto-correct.
Style/KeywordParametersOrder:
Enabled: false

View File

@ -0,0 +1,28 @@
---
# Cop supports --auto-correct.
Rails/ActiveRecordCallbacksOrder:
# Offense count: 30
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/models/award_emoji.rb'
- 'app/models/ci/job_artifact.rb'
- 'app/models/gpg_key.rb'
- 'app/models/group.rb'
- 'app/models/issue.rb'
- 'app/models/key.rb'
- 'app/models/merge_request.rb'
- 'app/models/namespace.rb'
- 'app/models/namespace_statistics.rb'
- 'app/models/note.rb'
- 'app/models/pages_domain.rb'
- 'app/models/personal_access_token.rb'
- 'app/models/project.rb'
- 'app/models/prometheus_alert.rb'
- 'app/models/remote_mirror.rb'
- 'app/models/resource_label_event.rb'
- 'app/models/snippet_statistics.rb'
- 'app/models/upload.rb'
- 'app/models/user.rb'
- 'ee/app/models/dast_site_profile.rb'
- 'ee/app/models/geo_node.rb'

View File

@ -0,0 +1,115 @@
---
Rails/InverseOf:
# Offense count: 210
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/models/alert_management/alert.rb'
- 'app/models/alert_management/alert_assignee.rb'
- 'app/models/analytics/cycle_analytics/project_stage.rb'
- 'app/models/application_setting.rb'
- 'app/models/audit_event.rb'
- 'app/models/board.rb'
- 'app/models/bulk_imports/entity.rb'
- 'app/models/bulk_imports/tracker.rb'
- 'app/models/chat_name.rb'
- 'app/models/ci/bridge.rb'
- 'app/models/ci/build.rb'
- 'app/models/ci/build_pending_state.rb'
- 'app/models/ci/build_trace_chunk.rb'
- 'app/models/ci/daily_build_group_report_result.rb'
- 'app/models/ci/job_artifact.rb'
- 'app/models/ci/job_variable.rb'
- 'app/models/ci/pipeline.rb'
- 'app/models/ci/pipeline_schedule.rb'
- 'app/models/ci/runner.rb'
- 'app/models/ci/runner_namespace.rb'
- 'app/models/ci/sources/pipeline.rb'
- 'app/models/ci/stage.rb'
- 'app/models/ci/trigger_request.rb'
- 'app/models/ci/unit_test_failure.rb'
- 'app/models/clusters/applications/runner.rb'
- 'app/models/clusters/cluster.rb'
- 'app/models/clusters/concerns/application_core.rb'
- 'app/models/clusters/integrations/elastic_stack.rb'
- 'app/models/clusters/integrations/prometheus.rb'
- 'app/models/clusters/project.rb'
- 'app/models/commit_signatures/x509_commit_signature.rb'
- 'app/models/commit_status.rb'
- 'app/models/concerns/analytics/cycle_analytics/stage.rb'
- 'app/models/concerns/awardable.rb'
- 'app/models/concerns/commit_signature.rb'
- 'app/models/concerns/merge_request_reviewer_state.rb'
- 'app/models/concerns/with_uploads.rb'
- 'app/models/custom_emoji.rb'
- 'app/models/customer_relations/contact.rb'
- 'app/models/customer_relations/organization.rb'
- 'app/models/deploy_key.rb'
- 'app/models/deploy_token.rb'
- 'app/models/environment.rb'
- 'app/models/error_tracking/error.rb'
- 'app/models/exported_protected_branch.rb'
- 'app/models/group.rb'
- 'app/models/group/crm_settings.rb'
- 'app/models/group_group_link.rb'
- 'app/models/hooks/service_hook.rb'
- 'app/models/incident_management/timeline_event.rb'
- 'app/models/integrations/base_slash_commands.rb'
- 'app/models/issue.rb'
- 'app/models/jira_connect_subscription.rb'
- 'app/models/members/group_member.rb'
- 'app/models/members/project_member.rb'
- 'app/models/merge_request.rb'
- 'app/models/merge_request/metrics.rb'
- 'app/models/merge_request_diff.rb'
- 'app/models/namespace.rb'
- 'app/models/notification_setting.rb'
- 'app/models/packages/composer/cache_file.rb'
- 'app/models/packages/maven/metadatum.rb'
- 'app/models/project.rb'
- 'app/models/resource_state_event.rb'
- 'app/models/serverless/domain_cluster.rb'
- 'app/models/terraform/state_version.rb'
- 'app/models/todo.rb'
- 'app/models/user.rb'
- 'app/models/x509_certificate.rb'
- 'ee/app/models/allowed_email_domain.rb'
- 'ee/app/models/analytics/cycle_analytics/group_stage.rb'
- 'ee/app/models/analytics/cycle_analytics/group_value_stream.rb'
- 'ee/app/models/analytics/devops_adoption/enabled_namespace.rb'
- 'ee/app/models/analytics/devops_adoption/snapshot.rb'
- 'ee/app/models/audit_events/external_audit_event_destination.rb'
- 'ee/app/models/ci/sources/project.rb'
- 'ee/app/models/compliance_management/compliance_framework/project_settings.rb'
- 'ee/app/models/concerns/incident_management/base_pending_escalation.rb'
- 'ee/app/models/dast/profile_schedule.rb'
- 'ee/app/models/ee/ci/build.rb'
- 'ee/app/models/ee/ci/pipeline.rb'
- 'ee/app/models/ee/epic.rb'
- 'ee/app/models/ee/group.rb'
- 'ee/app/models/ee/iteration.rb'
- 'ee/app/models/ee/merge_request.rb'
- 'ee/app/models/ee/plan.rb'
- 'ee/app/models/ee/project.rb'
- 'ee/app/models/ee/service_desk_setting.rb'
- 'ee/app/models/ee/user.rb'
- 'ee/app/models/elastic/reindexing_subtask.rb'
- 'ee/app/models/elastic/reindexing_task.rb'
- 'ee/app/models/geo/event.rb'
- 'ee/app/models/geo/event_log.rb'
- 'ee/app/models/geo/job_artifact_registry.rb'
- 'ee/app/models/geo/upload_registry.rb'
- 'ee/app/models/group_deletion_schedule.rb'
- 'ee/app/models/incident_management/escalation_rule.rb'
- 'ee/app/models/incident_management/oncall_participant.rb'
- 'ee/app/models/insight.rb'
- 'ee/app/models/integrations/gitlab_slack_application.rb'
- 'ee/app/models/requirements_management/requirement.rb'
- 'ee/app/models/requirements_management/test_report.rb'
- 'ee/app/models/security/orchestration_policy_configuration.rb'
- 'ee/app/models/security/orchestration_policy_rule_schedule.rb'
- 'ee/app/models/slack_integration.rb'
- 'ee/app/models/software_license_policy.rb'
- 'ee/app/models/user_permission_export_upload.rb'
- 'ee/app/models/vulnerabilities/feedback.rb'
- 'ee/app/models/vulnerabilities/statistic.rb'

View File

@ -0,0 +1,5 @@
---
# Cop supports --auto-correct.
Rails/MailerName:
Exclude:
- 'app/mailers/notify.rb'

View File

@ -0,0 +1,58 @@
---
# Cop supports --auto-correct.
Rails/NegateInclude:
# Offense count: 65
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/finders/projects_finder.rb'
- 'app/helpers/application_settings_helper.rb'
- 'app/helpers/projects_helper.rb'
- 'app/helpers/tree_helper.rb'
- 'app/models/concerns/timebox.rb'
- 'app/models/integrations/chat_message/pipeline_message.rb'
- 'app/models/label.rb'
- 'app/models/merge_request.rb'
- 'app/services/todo_service.rb'
- 'config/application.rb'
- 'config/initializers/1_settings.rb'
- 'danger/roulette/Dangerfile'
- 'ee/app/finders/security/pipeline_vulnerabilities_finder.rb'
- 'ee/app/models/ee/epic.rb'
- 'ee/app/models/ee/vulnerability.rb'
- 'ee/app/services/epic_issues/create_service.rb'
- 'ee/app/services/security/ingestion/tasks/ingest_remediations.rb'
- 'ee/app/services/security/security_orchestration_policies/validate_policy_service.rb'
- 'lib/api/maven_packages.rb'
- 'lib/generators/gitlab/usage_metric_generator.rb'
- 'lib/gitlab/background_migration/legacy_upload_mover.rb'
- 'lib/gitlab/ci/build/rules/rule/clause/exists.rb'
- 'lib/gitlab/ci/parsers/coverage/sax_document.rb'
- 'lib/gitlab/ci/queue/metrics.rb'
- 'lib/gitlab/database/each_database.rb'
- 'lib/gitlab/email/handler/create_issue_handler.rb'
- 'lib/gitlab/email/handler/service_desk_handler.rb'
- 'lib/gitlab/graphql/queries.rb'
- 'lib/gitlab/import_export/attributes_permitter.rb'
- 'lib/gitlab/search_results.rb'
- 'lib/gitlab/task_helpers.rb'
- 'lib/gitlab/url_blocker.rb'
- 'lib/gitlab_edition.rb'
- 'qa/qa/runtime/ip_address.rb'
- 'qa/qa/support/run.rb'
- 'qa/qa/tools/delete_test_users.rb'
- 'qa/qa/vendor/jenkins/page/configure_job.rb'
- 'qa/qa/vendor/jenkins/page/last_job_console.rb'
- 'rubocop/cop/gitlab/feature_available_usage.rb'
- 'rubocop/cop/graphql/id_type.rb'
- 'rubocop/cop/migration/add_reference.rb'
- 'rubocop/cop/rspec/factory_bot/inline_association.rb'
- 'scripts/lib/gitlab.rb'
- 'scripts/static-analysis'
- 'spec/lib/container_registry/blob_spec.rb'
- 'spec/lib/container_registry/client_spec.rb'
- 'spec/lib/gitlab/metrics/dashboard/stages/metric_endpoint_inserter_spec.rb'
- 'spec/lib/gitlab/metrics/subscribers/active_record_spec.rb'
- 'spec/support/matchers/pushed_frontend_feature_flags_matcher.rb'
- 'spec/support/shared_contexts/markdown_golden_master_shared_examples.rb'
- 'spec/uploaders/object_storage_spec.rb'

View File

@ -0,0 +1,45 @@
---
# Cop supports --auto-correct.
Rails/WhereExists:
# Offense count: 48
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/models/application_setting/term.rb'
- 'app/models/ci/pipeline_artifact.rb'
- 'app/models/ci/ref.rb'
- 'app/models/clusters/agent.rb'
- 'app/models/concerns/has_wiki.rb'
- 'app/models/concerns/noteable.rb'
- 'app/models/container_repository.rb'
- 'app/models/design_management/design.rb'
- 'app/models/group.rb'
- 'app/models/group_deploy_token.rb'
- 'app/models/label.rb'
- 'app/models/lfs_object.rb'
- 'app/models/merge_request_diff.rb'
- 'app/models/namespace.rb'
- 'app/models/onboarding_progress.rb'
- 'app/models/project.rb'
- 'app/models/protected_branch/push_access_level.rb'
- 'app/services/projects/transfer_service.rb'
- 'app/services/todos/destroy/unauthorized_features_service.rb'
- 'db/migrate/20210422195929_create_elastic_reindexing_slices.rb'
- 'ee/app/models/approval_merge_request_rule_source.rb'
- 'ee/app/models/concerns/ee/protected_ref_access.rb'
- 'ee/app/models/ee/epic.rb'
- 'ee/app/models/ee/group_member.rb'
- 'ee/app/models/ee/milestone_release.rb'
- 'ee/app/models/geo_node.rb'
- 'ee/app/models/merge_requests/external_status_check.rb'
- 'ee/app/models/merge_train.rb'
- 'ee/app/workers/concerns/elastic/indexing_control.rb'
- 'lib/gitlab/auth.rb'
- 'lib/gitlab/checks/matching_merge_request.rb'
- 'lib/gitlab/database/partitioning/detached_partition_dropper.rb'
- 'spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb'
- 'spec/migrations/recreate_index_security_ci_builds_on_name_and_id_parser_features_spec.rb'
- 'spec/migrations/recreate_index_security_ci_builds_on_name_and_id_parser_with_new_features_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/services/clusters/cleanup/service_account_service_spec.rb'
- 'spec/services/clusters/destroy_service_spec.rb'

View File

@ -0,0 +1,68 @@
---
RSpec/RepeatedExampleGroupBody:
# Offense count: 143
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'ee/spec/controllers/ee/groups_controller_spec.rb'
- 'ee/spec/lib/banzai/filter/references/vulnerability_reference_filters_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/dast_latest_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/geo_spec.rb'
- 'ee/spec/models/geo/deleted_project_spec.rb'
- 'ee/spec/models/gitlab_subscriptions/upcoming_reconciliation_spec.rb'
- 'ee/spec/models/merge_requests/external_status_check_spec.rb'
- 'ee/spec/models/project_spec.rb'
- 'ee/spec/models/software_license_spec.rb'
- 'ee/spec/policies/app_sec/fuzzing/coverage/corpus_policy_spec.rb'
- 'ee/spec/policies/group_policy_spec.rb'
- 'ee/spec/requests/api/graphql/mutations/compliance_management/frameworks/update_spec.rb'
- 'ee/spec/requests/groups/security/credentials_controller_spec.rb'
- 'ee/spec/services/app_sec/dast/profiles/create_associations_service_spec.rb'
- 'ee/spec/services/groups/sync_service_spec.rb'
- 'spec/controllers/groups/registry/repositories_controller_spec.rb'
- 'spec/controllers/projects/blob_controller_spec.rb'
- 'spec/controllers/projects/graphs_controller_spec.rb'
- 'spec/controllers/projects/registry/repositories_controller_spec.rb'
- 'spec/features/incidents/incident_details_spec.rb'
- 'spec/features/issues/spam_akismet_issue_creation_spec.rb'
- 'spec/features/merge_request/user_sees_closing_issues_message_spec.rb'
- 'spec/features/projects/commit/cherry_pick_spec.rb'
- 'spec/features/projects/pipelines/legacy_pipeline_spec.rb'
- 'spec/features/security/project/private_access_spec.rb'
- 'spec/finders/packages/nuget/package_finder_spec.rb'
- 'spec/helpers/gitlab_routing_helper_spec.rb'
- 'spec/lib/api/entities/application_setting_spec.rb'
- 'spec/lib/banzai/filter/references/commit_range_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/commit_reference_filter_spec.rb'
- 'spec/lib/bitbucket_server/representation/comment_spec.rb'
- 'spec/lib/gitlab/blob_helper_spec.rb'
- 'spec/lib/gitlab/ci/config/entry/release_spec.rb'
- 'spec/lib/gitlab/ci/pipeline/seed/build_spec.rb'
- 'spec/lib/gitlab/ci/yaml_processor_spec.rb'
- 'spec/lib/gitlab/empty_search_results_spec.rb'
- 'spec/lib/gitlab/import_export/project/sample/relation_factory_spec.rb'
- 'spec/lib/gitlab/import_export/project/tree_restorer_spec.rb'
- 'spec/lib/gitlab/lfs/client_spec.rb'
- 'spec/lib/gitlab/pagination/keyset/simple_order_builder_spec.rb'
- 'spec/lib/gitlab/sanitizers/exif_spec.rb'
- 'spec/models/ci/build_spec.rb'
- 'spec/models/deploy_token_spec.rb'
- 'spec/models/group_spec.rb'
- 'spec/models/merge_request_spec.rb'
- 'spec/models/project_spec.rb'
- 'spec/policies/project_policy_spec.rb'
- 'spec/presenters/project_hook_presenter_spec.rb'
- 'spec/requests/api/graphql/ci/runners_spec.rb'
- 'spec/services/boards/lists/update_service_spec.rb'
- 'spec/services/ci/create_web_ide_terminal_service_spec.rb'
- 'spec/services/ci/pipeline_artifacts/create_code_quality_mr_diff_report_service_spec.rb'
- 'spec/services/ci/register_job_service_spec.rb'
- 'spec/services/merge_requests/create_service_spec.rb'
- 'spec/services/merge_requests/mark_reviewer_reviewed_service_spec.rb'
- 'spec/services/merge_requests/mergeability/check_base_service_spec.rb'
- 'spec/services/packages/maven/metadata/sync_service_spec.rb'
- 'spec/services/projects/group_links/destroy_service_spec.rb'
- 'spec/services/verify_pages_domain_service_spec.rb'
- 'spec/support/shared_examples/requests/api/repository_storage_moves_shared_examples.rb'
- 'spec/support/shared_examples/services/boards/lists_create_service_shared_examples.rb'
- 'spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb'

View File

@ -0,0 +1,62 @@
---
# Cop supports --auto-correct.
Style/HashAsLastArrayItem:
# Offense count: 79
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/controllers/admin/application_settings_controller.rb'
- 'app/controllers/admin/groups_controller.rb'
- 'app/controllers/admin/users_controller.rb'
- 'app/controllers/boards/issues_controller.rb'
- 'app/controllers/clusters/clusters_controller.rb'
- 'app/controllers/concerns/issuable_actions.rb'
- 'app/controllers/concerns/issuable_collections.rb'
- 'app/controllers/profiles_controller.rb'
- 'app/controllers/projects/feature_flags_controller.rb'
- 'app/controllers/projects/merge_requests/application_controller.rb'
- 'app/controllers/projects/performance_monitoring/dashboards_controller.rb'
- 'app/controllers/projects/protected_branches_controller.rb'
- 'app/controllers/projects/settings/ci_cd_controller.rb'
- 'app/controllers/projects/settings/operations_controller.rb'
- 'app/controllers/projects_controller.rb'
- 'app/graphql/resolvers/clusters/agents_resolver.rb'
- 'app/graphql/resolvers/concerns/issue_resolver_arguments.rb'
- 'app/graphql/types/boards/board_issuable_input_base_type.rb'
- 'app/graphql/types/boards/board_issue_input_base_type.rb'
- 'app/helpers/learn_gitlab_helper.rb'
- 'app/helpers/namespaces_helper.rb'
- 'app/models/customer_relations/contact.rb'
- 'app/models/customer_relations/organization.rb'
- 'app/models/deploy_key.rb'
- 'app/models/issue.rb'
- 'app/models/merge_request.rb'
- 'app/models/milestone.rb'
- 'app/models/preloaders/labels_preloader.rb'
- 'app/models/user.rb'
- 'app/serializers/deployment_serializer.rb'
- 'app/services/ci/delete_objects_service.rb'
- 'ee/app/controllers/ee/admin/groups_controller.rb'
- 'ee/app/controllers/ee/admin/users_controller.rb'
- 'ee/app/controllers/groups/epics_controller.rb'
- 'ee/app/graphql/ee/resolvers/base_issues_resolver.rb'
- 'ee/app/graphql/types/epics/negated_epic_filter_input_type.rb'
- 'ee/app/models/ee/merge_request.rb'
- 'ee/app/models/ee/vulnerability.rb'
- 'ee/app/models/vulnerabilities/read.rb'
- 'ee/app/serializers/dashboard_environments_serializer.rb'
- 'ee/spec/finders/projects/integrations/jira/by_ids_finder_spec.rb'
- 'ee/spec/lib/ee/gitlab/ci/config/entry/needs_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/container_repository_updated_event_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/design_repository_updated_event_spec.rb'
- 'ee/spec/models/ee/ci/job_artifact_spec.rb'
- 'lib/api/entities/project.rb'
- 'lib/gitlab/analytics/cycle_analytics/request_params.rb'
- 'lib/gitlab/database/migration_helpers.rb'
- 'spec/lib/gitlab/database/migration_helpers/v2_spec.rb'
- 'spec/migrations/20210914095310_cleanup_orphan_project_access_tokens_spec.rb'
- 'spec/requests/rack_attack_global_spec.rb'
- 'spec/services/git/branch_hooks_service_spec.rb'
- 'spec/services/metrics/dashboard/panel_preview_service_spec.rb'
- 'spec/support/helpers/rack_attack_spec_helpers.rb'
- 'spec/workers/merge_worker_spec.rb'

View File

@ -0,0 +1,72 @@
---
# Cop supports --auto-correct.
Style/KeywordParametersOrder:
# Offense count: 110
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/finders/group_descendants_finder.rb'
- 'app/finders/merge_request_target_project_finder.rb'
- 'app/graphql/resolvers/package_pipelines_resolver.rb'
- 'app/helpers/timeboxes_helper.rb'
- 'app/models/concerns/sortable.rb'
- 'app/services/clusters/kubernetes/create_or_update_service_account_service.rb'
- 'app/services/import/gitlab_projects/file_acquisition_strategies/file_upload.rb'
- 'app/services/import/gitlab_projects/file_acquisition_strategies/remote_file.rb'
- 'app/services/import/gitlab_projects/file_acquisition_strategies/remote_file_s3.rb'
- 'app/services/issues/create_service.rb'
- 'app/services/merge_requests/push_options_handler_service.rb'
- 'app/services/snippets/create_service.rb'
- 'app/services/work_items/create_and_link_service.rb'
- 'app/services/work_items/create_from_task_service.rb'
- 'app/services/work_items/create_service.rb'
- 'app/services/work_items/delete_task_service.rb'
- 'ee/app/graphql/mutations/dast/profiles/create.rb'
- 'ee/app/graphql/mutations/dast_scanner_profiles/create.rb'
- 'ee/app/graphql/mutations/dast_site_profiles/update.rb'
- 'ee/app/models/license.rb'
- 'ee/app/models/requirements_management/test_report.rb'
- 'ee/app/services/analytics/devops_adoption/enabled_namespaces/bulk_find_or_create_service.rb'
- 'ee/app/services/analytics/devops_adoption/enabled_namespaces/create_service.rb'
- 'ee/app/services/analytics/devops_adoption/enabled_namespaces/find_or_create_service.rb'
- 'ee/app/services/audit_events/user_impersonation_group_audit_event_service.rb'
- 'ee/app/services/members/activate_service.rb'
- 'ee/lib/gitlab/elastic/helper.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/drop_invalid_remediations_spec.rb'
- 'ee/spec/requests/api/deployments_spec.rb'
- 'lib/gitlab/checks/timed_logger.rb'
- 'lib/gitlab/ci/reports/security/finding.rb'
- 'lib/gitlab/database/partitioning/monthly_strategy.rb'
- 'lib/gitlab/database/with_lock_retries.rb'
- 'lib/gitlab/diff/diff_refs.rb'
- 'lib/gitlab/email/smime/signer.rb'
- 'lib/gitlab/error_tracking.rb'
- 'lib/gitlab/exclusive_lease.rb'
- 'lib/gitlab/import_export/import_failure_service.rb'
- 'lib/gitlab/merge_requests/mergeability/results_store.rb'
- 'lib/microsoft_teams/notifier.rb'
- 'qa/qa/specs/features/ee/browser_ui/3_create/repository/file_locking_spec.rb'
- 'qa/qa/specs/features/ee/browser_ui/3_create/repository/push_rules_spec.rb'
- 'qa/spec/runtime/env_spec.rb'
- 'spec/features/projects/branches_spec.rb'
- 'spec/graphql/types/ci/pipeline_counts_type_spec.rb'
- 'spec/lib/gitlab/background_migration/populate_vulnerability_reads_spec.rb'
- 'spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb'
- 'spec/lib/gitlab/background_migration/remove_duplicate_vulnerabilities_findings_spec.rb'
- 'spec/lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb'
- 'spec/lib/gitlab/database/partitioning/detached_partition_dropper_spec.rb'
- 'spec/migrations/20211018152654_schedule_remove_duplicate_vulnerabilities_findings3_spec.rb'
- 'spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb'
- 'spec/migrations/20220106111958_add_insert_or_update_vulnerability_reads_trigger_spec.rb'
- 'spec/migrations/20220106112043_add_update_vulnerability_reads_trigger_spec.rb'
- 'spec/migrations/20220106112085_add_update_vulnerability_reads_location_trigger_spec.rb'
- 'spec/migrations/20220106163326_add_has_issues_on_vulnerability_reads_trigger_spec.rb'
- 'spec/migrations/20220107064845_populate_vulnerability_reads_spec.rb'
- 'spec/migrations/confirm_support_bot_user_spec.rb'
- 'spec/services/service_ping/submit_service_ping_service_spec.rb'
- 'spec/support/helpers/smime_helper.rb'
- 'spec/support/helpers/workhorse_helpers.rb'
- 'spec/support/shared_examples/services/container_expiration_policy_shared_examples.rb'
- 'spec/support/shared_examples/services/dependency_proxy_ttl_policies_shared_examples.rb'
- 'spec/support/shared_examples/services/namespace_package_settings_shared_examples.rb'
- 'spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb'

View File

@ -26,6 +26,14 @@ class Analytics::CycleAnalytics::Aggregation < ApplicationRecord
}.compact
end
def consistency_check_cursor_for(model)
{
:start_event_timestamp => self["last_consistency_check_#{model.issuable_model.table_name}_start_event_timestamp"],
:end_event_timestamp => self["last_consistency_check_#{model.issuable_model.table_name}_end_event_timestamp"],
model.issuable_id_column => self["last_consistency_check_#{model.issuable_model.table_name}_issuable_id"]
}.compact
end
def refresh_last_run(mode)
self["last_#{mode}_run_at"] = Time.current
end

View File

@ -19,7 +19,7 @@ module ServicePing
start = Time.current
begin
usage_data = BuildPayloadService.new.execute
usage_data = ServicePing::BuildPayload.new.execute
response = submit_usage_data_payload(usage_data)
rescue StandardError => e
return unless Gitlab::CurrentSettings.usage_ping_enabled?
@ -38,7 +38,8 @@ module ServicePing
response = submit_usage_data_payload(usage_data)
end
version_usage_data_id = response.dig('conv_index', 'usage_data_id') || response.dig('dev_ops_score', 'usage_data_id')
version_usage_data_id =
response.dig('conv_index', 'usage_data_id') || response.dig('dev_ops_score', 'usage_data_id')
unless version_usage_data_id.is_a?(Integer) && version_usage_data_id > 0
raise SubmissionError, "Invalid usage_data_id in response: #{version_usage_data_id}"
@ -47,7 +48,7 @@ module ServicePing
unless @skip_db_write
raw_usage_data = save_raw_usage_data(usage_data)
raw_usage_data.update_version_metadata!(usage_data_id: version_usage_data_id)
DevopsReportService.new(response).execute
ServicePing::DevopsReport.new(response).execute
end
return unless Feature.enabled?(:measure_service_ping_metric_collection)
@ -90,9 +91,13 @@ module ServicePing
end
def save_raw_usage_data(usage_data)
RawUsageData.safe_find_or_create_by(recorded_at: usage_data[:recorded_at]) do |record|
# safe_find_or_create_by! was originally called here.
# We merely switched to `find_or_create_by!`
# rubocop: disable CodeReuse/ActiveRecord
RawUsageData.find_or_create_by(recorded_at: usage_data[:recorded_at]) do |record|
record.payload = usage_data
end
# rubocop: enable CodeReuse/ActiveRecord
end
# See https://gitlab.com/gitlab-org/gitlab/-/issues/233615 for details

View File

@ -0,0 +1,16 @@
- name: "ELK stack logging removed in GitLab 15.0" # The headline announcing the removal. i.e. "`CI_PROJECT_CONFIG_PATH` removed in Gitlab 14.0"
announcement_milestone: "14.7" # The milestone when this feature was deprecated.
announcement_date: "2022-01-22" # The date of the milestone release when this feature was deprecated. This should almost always be the 22nd of a month (YYYY-MM-DD), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is being removed.
removal_date: "2022-05-22" # This should almost always be the 22nd of a month (YYYY-MM-DD), the date of the milestone release when this feature will be removed.
breaking_change: true # Change to true if this removal is a breaking change.
reporter: kbychu # GitLab username of the person reporting the removal
body: | # Do not modify this line, instead modify the lines below.
The logging features in GitLab allow users to install the ELK stack (Elasticsearch, Logstash, and Kibana) to aggregate and manage application logs. Users could search for relevant logs in GitLab directly. However, since deprecating certificate-based integration with Kubernetes clusters and GitLab Managed Apps, this feature is no longer available. For more information on the future of logging and observability, you can follow the issue for [integrating Opstrace with GitLab](https://gitlab.com/groups/gitlab-org/-/epics/6976).
# The following items are not published on the docs page, but may be used in the future.
stage: Monitor # (optional - may be required in the future) String value of the stage that the feature was created in. e.g., Growth
tiers: [Free] # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate]
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/346485 # (optional) This is a link to the deprecation issue in GitLab
documentation_url: https://docs.gitlab.com/ee/operations/index.html # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class AddLastConsistencyCheckCursorsToVsaAggregations < Gitlab::Database::Migration[2.0]
def up
change_table(:analytics_cycle_analytics_aggregations, bulk: true) do |t|
t.column :last_consistency_check_issues_stage_event_hash_id, :bigint, null: true
t.column :last_consistency_check_issues_start_event_timestamp, :datetime_with_timezone, null: true
t.column :last_consistency_check_issues_end_event_timestamp, :datetime_with_timezone, null: true
t.column :last_consistency_check_issues_issuable_id, :bigint, null: true
t.column :last_consistency_check_merge_requests_stage_event_hash_id, :bigint, null: true
t.column :last_consistency_check_merge_requests_start_event_timestamp, :datetime_with_timezone, null: true
t.column :last_consistency_check_merge_requests_end_event_timestamp, :datetime_with_timezone, null: true
t.column :last_consistency_check_merge_requests_issuable_id, :bigint, null: true
end
end
def down
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_issues_stage_event_hash_id
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_issues_start_event_timestamp
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_issues_end_event_timestamp
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_issues_issuable_id
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_merge_requests_stage_event_hash_id
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_merge_requests_start_event_timestamp
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_merge_requests_end_event_timestamp
remove_column :analytics_cycle_analytics_aggregations, :last_consistency_check_merge_requests_issuable_id
end
end

View File

@ -0,0 +1 @@
4904ea4034a58dadb9b84deaade823f1e50085b5a4bce69da7fa44c38e588858

View File

@ -10661,6 +10661,14 @@ CREATE TABLE analytics_cycle_analytics_aggregations (
last_full_issues_updated_at timestamp with time zone,
last_full_issues_id integer,
last_full_merge_requests_id integer,
last_consistency_check_issues_stage_event_hash_id bigint,
last_consistency_check_issues_start_event_timestamp timestamp with time zone,
last_consistency_check_issues_end_event_timestamp timestamp with time zone,
last_consistency_check_issues_issuable_id bigint,
last_consistency_check_merge_requests_stage_event_hash_id bigint,
last_consistency_check_merge_requests_start_event_timestamp timestamp with time zone,
last_consistency_check_merge_requests_end_event_timestamp timestamp with time zone,
last_consistency_check_merge_requests_issuable_id bigint,
CONSTRAINT chk_rails_1ef688e577 CHECK ((cardinality(incremental_runtimes_in_seconds) <= 10)),
CONSTRAINT chk_rails_7810292ec9 CHECK ((cardinality(last_full_run_processed_records) <= 10)),
CONSTRAINT chk_rails_8b9e89687c CHECK ((cardinality(last_full_run_runtimes_in_seconds) <= 10)),

View File

@ -0,0 +1,17 @@
---
# Error: gitlab.CIConfigFile
#
# Checks that the `.gitlab-ci.yml` file is referenced properly.
#
# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles
extends: existence
message: 'The CI/CD configuration file should be exactly: `.gitlab-ci.yml`'
link: https://docs.gitlab.com/ee/development/documentation/versions.html
level: error
scope: raw
raw:
- '(`gitlab-ci.yml`|'
- '`gitlabci.yml`|'
- '`gitlab.ci.yml`|'
- '`.gitlab.ci-yml`|'
- '`.gitlab-ci.yaml`)'

View File

@ -34,7 +34,7 @@ To configure deployment approvals for a project:
### Create a deployment job
Create a deployment job in the `.gitlab-ci.yaml` file of the desired project. The job does **not** need to be manual (`when: manual`).
Create a deployment job in the `.gitlab-ci.yml` file of the desired project. The job does **not** need to be manual (`when: manual`).
Example:

View File

@ -132,7 +132,7 @@ permission model that isolates the CD permissions from the original project and
original users with the Maintainer role for the project from accessing the production secret and CD configuration. You can
connect the CD project to your development projects by using [multi-project pipelines](../pipelines/multi_project_pipelines.md).
## Protect `gitlab-ci.yml` from change
## Protect `.gitlab-ci.yml` from change
A `.gitlab-ci.yml` may contain rules to deploy an application to the production server. This
deployment usually runs automatically after pushing a merge request. To prevent developers from

View File

@ -21,7 +21,7 @@ For advanced CI/CD teams, [custom project templates](../../user/admin_area/custo
If you have questions that are not answered here, the [GitLab community forum](https://forum.gitlab.com/) can be a great resource.
## `config.yml` vs `gitlab-ci.yml`
## `config.yml` vs `.gitlab-ci.yml`
CircleCI's `config.yml` configuration file defines scripts, jobs, and workflows (known as "stages" in GitLab). In GitLab, a similar approach is used with a `.gitlab-ci.yml` file in the root directory of your repository.

View File

@ -16,7 +16,7 @@ This guide also lists common issues and possible solutions.
An early source of problems can be incorrect syntax. The pipeline shows a `yaml invalid`
badge and does not start running if any syntax or formatting problems are found.
### Edit `gitlab-ci.yml` with the pipeline editor
### Edit `.gitlab-ci.yml` with the pipeline editor
The [pipeline editor](pipeline_editor/index.md) is the recommended editing
experience (rather than the single file editor or the Web IDE). It includes:

View File

@ -126,6 +126,16 @@ changes to your code, settings, or workflow.
We are removing the `DS_DEFAULT_ANALYZERS` environment variable from Dependency Scanning on May 22, 2022 in 15.0. After this removal, this variable's value will be ignored. To configure which analyzers to run with the default configuration, you should use the `DS_EXCLUDED_ANALYZERS` variable instead.
### ELK stack logging removed in GitLab 15.0
WARNING:
This feature was changed or removed in 15.0
as a [breaking change](https://docs.gitlab.com/ee/development/contributing/#breaking-changes).
Before updating GitLab, review the details carefully to determine if you need to make any
changes to your code, settings, or workflow.
The logging features in GitLab allow users to install the ELK stack (Elasticsearch, Logstash, and Kibana) to aggregate and manage application logs. Users could search for relevant logs in GitLab directly. However, since deprecating certificate-based integration with Kubernetes clusters and GitLab Managed Apps, this feature is no longer available. For more information on the future of logging and observability, you can follow the issue for [integrating Opstrace with GitLab](https://gitlab.com/groups/gitlab-org/-/epics/6976).
### Elasticsearch 6.8.x in GitLab 15.0
WARNING:

View File

@ -134,7 +134,7 @@ License Compliance can be configured using CI/CD variables.
| `ASDF_PYTHON_VERSION` | no | Version of Python to use for the scan. [Configuration](#selecting-the-version-of-python) |
| `ASDF_RUBY_VERSION` | no | Version of Ruby to use for the scan. |
| `GRADLE_CLI_OPTS` | no | Additional arguments for the Gradle executable. If not supplied, defaults to `--exclude-task=test`. |
| `LICENSE_FINDER_CLI_OPTS` | no | Additional arguments for the `license_finder` executable. For example, if you have multiple projects in nested directories, you can update your `.gitlab-ci-yml` template to specify a recursive scan, like `LICENSE_FINDER_CLI_OPTS: '--recursive'`. |
| `LICENSE_FINDER_CLI_OPTS` | no | Additional arguments for the `license_finder` executable. For example, if you have multiple projects in nested directories, you can update your `.gitlab-ci.yml` template to specify a recursive scan, like `LICENSE_FINDER_CLI_OPTS: '--recursive'`. |
| `LM_JAVA_VERSION` | no | Version of Java. If set to `11`, Maven and Gradle use Java 11 instead of Java 8. [Configuration](#selecting-the-version-of-java) |
| `LM_PYTHON_VERSION` | no | Version of Python. If set to `3`, dependencies are installed using Python 3 instead of Python 2.7. [Configuration](#selecting-the-version-of-python) |
| `MAVEN_CLI_OPTS` | no | Additional arguments for the `mvn` executable. If not supplied, defaults to `-DskipTests`. |

View File

@ -86,7 +86,7 @@ To use a Terraform template:
# TF_ROOT: terraform/production
```
1. (Optional) Override in your `.gitlab-ci.yaml` file the attributes present
1. (Optional) Override in your `.gitlab-ci.yml` file the attributes present
in the template you fetched to customize your configuration.
## GitLab-managed Terraform state

View File

@ -304,7 +304,7 @@ Find more details in the [Pages administration documentation](../../../administr
Safari requires the web server to support the [Range request header](https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6)
in order to play your media content. For GitLab Pages to serve
HTTP Range requests, you should use the following two variables in your `.gitlab-ci.yaml` file:
HTTP Range requests, you should use the following two variables in your `.gitlab-ci.yml` file:
```yaml
pages:

View File

@ -0,0 +1,51 @@
---
stage: Enablement
group: Distribution
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
description: "Documentation on large repositories."
---
# Managing large repositories **(FREE SELF)**
GitLab, like any Git based system, is subject to similar performance restraints when it comes to large
repositories that size into the gigabytes.
On this page we detail several best practices to improve performance with these large repositories on GitLab.
## Large File System (LFS)
It's *strongly* recommended in any Git system that binary or blob files (for example, packages, audio, video, graphics, etc.) are stored as Large File Storage (LFS) objects. In such setup, the Objects are stored elsewhere, such as in Object Storage, and this can reduce the repository size significantly, thus improving performance.
Refer to the [Git LFS docs for more info](../../../topics/git/lfs/index.md).
## Gitaly Pack Objects Cache
Gitaly, the service that provides storage for Git repositories, can be configured to cache a short rolling window of Git fetch responses. This is recommended for large repositories as it can notably reduce server load when your server receives lots of fetch traffic.
Refer to the [Gitaly Pack Objects Cache for more info](../../../administration/gitaly/configure_gitaly.md#pack-objects-cache).
## Reference Architectures
Large repositories tend to be found in larger organisations with many users. The GitLab Quality and Support teams provide several [Reference Architectures](../../../administration/reference_architectures/index.md) that are the recommended way to deploy GitLab at scale.
In these types of setups it's recommended that the GitLab environment used matches a Reference Architecture to improve performance.
## Gitaly Cluster
Gitaly Cluster can notably improve large repository performance as it holds multiple replicas of the repository across several nodes. As a result, Gitaly Cluster can load balance read requests against those repositories and is also fault tolerant.
It's recommended for large repositories, however, Gitaly Cluster is a large solution with additional complexity of setup and management. Refer to the [Gitaly Cluster docs for more info](../../../administration/gitaly/index.md), specifically the [Before deploying Gitaly Cluster](../../../administration/gitaly/index.md#before-deploying-gitaly-cluster) section.
## Keep GitLab up to date
Performance improvements and fixes are added continuously in GitLab. As such, it's recommended you keep GitLab updated to the latest version where possible to benefit from these.
## Reduce concurrent clones in CI/CD
Large repositories tend to be monorepos. This in turn typically means that these repositories get a lot of traffic not only from users, but from CI/CD.
CI/CD loads tend to be concurrent as pipelines are scheduled during set times. As a result, the Git requests against the repositories can spike notably during these times and lead to reduced performance for both CI and users alike.
When designing CI/CD pipelines, it's advisable to reduce their concurrency by staggering them to run at different times, for example, a set running at one time and then another set running several minutes later.
There's several other actions that can be explored to improve CI/CD performance with large repositories. Refer to the [Runner docs for more info](../../../ci/large_repositories/index.md).

View File

@ -23,7 +23,7 @@ Advanced Search searches default project branches only.
| Use | Description | Example |
|-----|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `"` | Exact search | [`"gem sidekiq"`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=%22gem+sidekiq%22) |
| `|` | Or | [`display | banner`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+%7C+banner) |
| <code>&#124;</code> | Or | [<code>display &#124; banner</code>](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+%7C+banner) |
| `+` | And | [`display +banner`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=display+%2Bbanner&snippets=) |
| `-` | Exclude | [`display -banner`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=display+-banner) |
| `*` | Partial | [`bug error 50*`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=bug+error+50%2A&snippets=) |
@ -46,6 +46,6 @@ Advanced Search searches default project branches only.
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [`rails -filename:gemfile.lock`](https://gitlab.com/search?group_id=9970&project_id=278964&repository_ref=&scope=blobs&search=rails+-filename%3Agemfile.lock&snippets=) | Show _rails_ in all files except the _`gemfile.lock`_ file. |
| [`RSpec.describe Resolvers -*builder`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=RSpec.describe+Resolvers+-*builder) | Show all _RSpec.describe Resolvers_ that don't start with _builder_. |
| [`bug | (display +banner)`](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964) | Show _bug_ **or** _display_ **and** _banner_. |
| [<code>bug &#124; (display +banner)</code>](https://gitlab.com/search?snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964) | Show _bug_ **or** _display_ **and** _banner_. |
<!-- markdownlint-enable -->

View File

@ -6,7 +6,7 @@ module Gitlab
module Instrumentations
class CollectedDataCategoriesMetric < GenericMetric
value do
::ServicePing::PermitDataCategoriesService.new.execute.to_a
::ServicePing::PermitDataCategories.new.execute.to_a
end
end
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module ServicePing
class BuildPayloadService
class BuildPayload
def execute
return {} unless ServicePingSettings.product_intelligence_enabled?
@ -37,7 +37,7 @@ module ServicePing
end
def permitted_categories
@permitted_categories ||= ::ServicePing::PermitDataCategoriesService.new.execute
@permitted_categories ||= ::ServicePing::PermitDataCategories.new.execute
end
def permitted_metric?(key_path)
@ -51,7 +51,7 @@ module ServicePing
def metric_category(key_path)
metric_definitions[key_path]
&.attributes
&.fetch(:data_category, ::ServicePing::PermitDataCategoriesService::OPTIONAL_CATEGORY)
&.fetch(:data_category, ::ServicePing::PermitDataCategories::OPTIONAL_CATEGORY)
end
def metric_definitions
@ -60,4 +60,4 @@ module ServicePing
end
end
ServicePing::BuildPayloadService.prepend_mod_with('ServicePing::BuildPayloadService')
ServicePing::BuildPayload.prepend_mod_with('ServicePing::BuildPayload')

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module ServicePing
class DevopsReportService
class DevopsReport
def initialize(data)
@data = data
end
@ -20,7 +20,11 @@ module ServicePing
metrics.slice(*DevOpsReport::Metric::METRICS)
)
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(ActiveRecord::RecordInvalid.new(report)) unless report.persisted?
unless report.persisted?
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(
ActiveRecord::RecordInvalid.new(report)
)
end
end
end
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module ServicePing
class PermitDataCategoriesService
class PermitDataCategories
STANDARD_CATEGORY = 'standard'
SUBSCRIPTION_CATEGORY = 'subscription'
OPERATIONAL_CATEGORY = 'operational'
@ -21,4 +21,4 @@ module ServicePing
end
end
ServicePing::PermitDataCategoriesService.prepend_mod_with('ServicePing::PermitDataCategoriesService')
ServicePing::PermitDataCategories.prepend_mod_with('ServicePing::PermitDataCategories')

View File

@ -58,7 +58,7 @@
"@gitlab/favicon-overlay": "2.0.0",
"@gitlab/svgs": "2.14.0",
"@gitlab/ui": "40.2.1",
"@gitlab/visual-review-tools": "1.7.1",
"@gitlab/visual-review-tools": "1.7.3",
"@rails/actioncable": "6.1.4-7",
"@rails/ujs": "6.1.4-7",
"@sentry/browser": "5.30.0",

View File

@ -22,7 +22,7 @@ RSpec.describe 'Database schema' do
approvals: %w[user_id],
approver_groups: %w[target_id],
approvers: %w[target_id user_id],
analytics_cycle_analytics_aggregations: %w[last_full_issues_id last_full_merge_requests_id last_incremental_issues_id last_full_run_issues_id last_full_run_merge_requests_id last_incremental_merge_requests_id],
analytics_cycle_analytics_aggregations: %w[last_full_issues_id last_full_merge_requests_id last_incremental_issues_id last_full_run_issues_id last_full_run_merge_requests_id last_incremental_merge_requests_id last_consistency_check_issues_stage_event_hash_id last_consistency_check_issues_issuable_id last_consistency_check_merge_requests_stage_event_hash_id last_consistency_check_merge_requests_issuable_id],
analytics_cycle_analytics_merge_request_stage_events: %w[author_id group_id merge_request_id milestone_id project_id stage_event_hash_id state_id],
analytics_cycle_analytics_issue_stage_events: %w[author_id group_id issue_id milestone_id project_id stage_event_hash_id state_id],
audit_events: %w[author_id entity_id target_id],

View File

@ -7,7 +7,7 @@ RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CollectedDataCategories
let(:expected_value) { %w[standard subscription operational optional] }
before do
allow_next_instance_of(ServicePing::PermitDataCategoriesService) do |instance|
allow_next_instance_of(ServicePing::PermitDataCategories) do |instance|
expect(instance).to receive(:execute).and_return(expected_value)
end
end

View File

@ -1080,7 +1080,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
it 'reports collected data categories' do
expected_value = %w[standard subscription operational optional]
allow_next_instance_of(ServicePing::PermitDataCategoriesService) do |instance|
allow_next_instance_of(ServicePing::PermitDataCategories) do |instance|
expect(instance).to receive(:execute).and_return(expected_value)
end

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe ServicePing::BuildPayloadService do
RSpec.describe ServicePing::BuildPayload do
describe '#execute', :without_license do
subject(:service_ping_payload) { described_class.new.execute }
@ -35,7 +35,8 @@ RSpec.describe ServicePing::BuildPayloadService do
context 'with require stats consent enabled' do
before do
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: true))
allow(User).to receive(:single_user)
.and_return(instance_double(User, :user, requires_usage_stats_consent?: true))
end
it 'returns empty service ping payload' do

View File

@ -0,0 +1,35 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ServicePing::DevopsReport do
let_it_be(:data) { { "conv_index": {} }.to_json }
let_it_be(:subject) { ServicePing::DevopsReport.new(Gitlab::Json.parse(data)) }
let_it_be(:devops_report) { DevOpsReport::Metric.new }
describe '#execute' do
context 'when metric is persisted' do
before do
allow(DevOpsReport::Metric).to receive(:create).and_return(devops_report)
allow(devops_report).to receive(:persisted?).and_return(true)
end
it 'does not call `track_and_raise_for_dev_exception`' do
expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception)
subject.execute
end
end
context 'when metric is not persisted' do
before do
allow(DevOpsReport::Metric).to receive(:create).and_return(devops_report)
allow(devops_report).to receive(:persisted?).and_return(false)
end
it 'calls `track_and_raise_for_dev_exception`' do
expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception)
subject.execute
end
end
end
end

View File

@ -2,13 +2,14 @@
require 'spec_helper'
RSpec.describe ServicePing::PermitDataCategoriesService do
RSpec.describe ServicePing::PermitDataCategories do
describe '#execute', :without_license do
subject(:permitted_categories) { described_class.new.execute }
context 'when usage ping setting is set to true' do
before do
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: false))
allow(User).to receive(:single_user)
.and_return(instance_double(User, :user, requires_usage_stats_consent?: false))
stub_config_setting(usage_ping_enabled: true)
end
@ -19,7 +20,8 @@ RSpec.describe ServicePing::PermitDataCategoriesService do
context 'when usage ping setting is set to false' do
before do
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: false))
allow(User).to receive(:single_user)
.and_return(instance_double(User, :user, requires_usage_stats_consent?: false))
stub_config_setting(usage_ping_enabled: false)
end
@ -30,7 +32,8 @@ RSpec.describe ServicePing::PermitDataCategoriesService do
context 'when User.single_user&.requires_usage_stats_consent? is required' do
before do
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: true))
allow(User).to receive(:single_user)
.and_return(instance_double(User, :user, requires_usage_stats_consent?: true))
stub_config_setting(usage_ping_enabled: true)
end

View File

@ -18,7 +18,8 @@ RSpec.describe ServicePing::ServicePingSettings do
with_them do
before do
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: requires_usage_stats_consent))
allow(User).to receive(:single_user)
.and_return(instance_double(User, :user, requires_usage_stats_consent?: requires_usage_stats_consent))
stub_config_setting(usage_ping_enabled: usage_ping_enabled)
end

View File

@ -43,6 +43,37 @@ RSpec.describe Analytics::CycleAnalytics::Aggregation, type: :model do
end
end
describe '#consistency_check_cursor_for' do
it 'returns empty cursor' do
expect(aggregation.consistency_check_cursor_for(Analytics::CycleAnalytics::IssueStageEvent)).to eq({})
expect(aggregation.consistency_check_cursor_for(Analytics::CycleAnalytics::MergeRequestStageEvent)).to eq({})
end
it 'returns the cursor value for IssueStageEvent' do
aggregation.last_consistency_check_issues_start_event_timestamp = 2.weeks.ago
aggregation.last_consistency_check_issues_end_event_timestamp = 1.week.ago
aggregation.last_consistency_check_issues_issuable_id = 42
expect(aggregation.consistency_check_cursor_for(Analytics::CycleAnalytics::IssueStageEvent)).to eq({
start_event_timestamp: aggregation.last_consistency_check_issues_start_event_timestamp,
end_event_timestamp: aggregation.last_consistency_check_issues_end_event_timestamp,
issue_id: aggregation.last_consistency_check_issues_issuable_id
})
end
it 'returns the cursor value for MergeRequestStageEvent' do
aggregation.last_consistency_check_merge_requests_start_event_timestamp = 2.weeks.ago
aggregation.last_consistency_check_merge_requests_end_event_timestamp = 1.week.ago
aggregation.last_consistency_check_merge_requests_issuable_id = 42
expect(aggregation.consistency_check_cursor_for(Analytics::CycleAnalytics::MergeRequestStageEvent)).to eq({
start_event_timestamp: aggregation.last_consistency_check_merge_requests_start_event_timestamp,
end_event_timestamp: aggregation.last_consistency_check_merge_requests_end_event_timestamp,
merge_request_id: aggregation.last_consistency_check_merge_requests_issuable_id
})
end
end
describe '#refresh_last_run' do
it 'updates the run_at column' do
freeze_time do

View File

@ -139,7 +139,8 @@ RSpec.describe ServicePing::SubmitService do
context 'and user requires usage stats consent' do
before do
allow(User).to receive(:single_user).and_return(double(:user, requires_usage_stats_consent?: true))
allow(User).to receive(:single_user)
.and_return(instance_double(User, :user, requires_usage_stats_consent?: true))
end
it_behaves_like 'does not run'
@ -173,7 +174,8 @@ RSpec.describe ServicePing::SubmitService do
recorded_at = Time.current
usage_data = { uuid: 'uuid', recorded_at: recorded_at }
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values).and_return(usage_data)
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values)
.and_return(usage_data)
subject.execute
@ -196,7 +198,8 @@ RSpec.describe ServicePing::SubmitService do
recorded_at = Time.current
usage_data = { uuid: 'uuid', recorded_at: recorded_at }
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values).and_return(usage_data)
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values)
.and_return(usage_data)
subject.execute
@ -241,7 +244,8 @@ RSpec.describe ServicePing::SubmitService do
recorded_at = Time.current
usage_data = { uuid: 'uuid', recorded_at: recorded_at }
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values).and_return(usage_data)
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values)
.and_return(usage_data)
subject.execute
@ -274,7 +278,7 @@ RSpec.describe ServicePing::SubmitService do
context 'and usage data is nil' do
before do
allow(ServicePing::BuildPayloadService).to receive(:execute).and_return(nil)
allow(ServicePing::BuildPayload).to receive(:execute).and_return(nil)
allow(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values).and_return(nil)
end
@ -285,14 +289,15 @@ RSpec.describe ServicePing::SubmitService do
before do
stub_response(body: with_dev_ops_score_params)
allow(ServicePing::BuildPayloadService).to receive_message_chain(:new, :execute)
allow(ServicePing::BuildPayload).to receive_message_chain(:new, :execute)
.and_raise(described_class::SubmissionError, 'SubmissionError')
end
it 'calls Gitlab::Usage::ServicePingReport .for method' do
usage_data = build_usage_data
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values).and_return(usage_data)
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values)
.and_return(usage_data)
subject.execute
end
@ -309,7 +314,7 @@ RSpec.describe ServicePing::SubmitService do
end
end
context 'calls BuildPayloadService first' do
context 'calls BuildPayload first' do
before do
stub_response(body: with_dev_ops_score_params)
end
@ -317,7 +322,7 @@ RSpec.describe ServicePing::SubmitService do
it 'returns usage data' do
usage_data = build_usage_data
expect_next_instance_of(ServicePing::BuildPayloadService) do |service|
expect_next_instance_of(ServicePing::BuildPayload) do |service|
expect(service).to receive(:execute).and_return(usage_data)
end
@ -330,7 +335,7 @@ RSpec.describe ServicePing::SubmitService do
stub_response(body: with_dev_ops_score_params, status: 404)
usage_data = build_usage_data
allow_next_instance_of(ServicePing::BuildPayloadService) do |service|
allow_next_instance_of(ServicePing::BuildPayload) do |service|
allow(service).to receive(:execute).and_return(usage_data)
end
end
@ -338,7 +343,8 @@ RSpec.describe ServicePing::SubmitService do
it 'calls Gitlab::Usage::ServicePingReport .for method' do
usage_data = build_usage_data
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values).and_return(usage_data)
expect(Gitlab::Usage::ServicePingReport).to receive(:for).with(output: :all_metrics_values)
.and_return(usage_data)
# SubmissionError is raised as a result of 404 in response from HTTP Request
expect { subject.execute }.to raise_error(described_class::SubmissionError)
@ -358,7 +364,7 @@ RSpec.describe ServicePing::SubmitService do
end
it 'does not call DevOpsReport service' do
expect(ServicePing::DevopsReportService).not_to receive(:new)
expect(ServicePing::DevopsReport).not_to receive(:new)
subject.execute
end
@ -400,7 +406,7 @@ RSpec.describe ServicePing::SubmitService do
before do
stub_feature_flags(measure_service_ping_metric_collection: true)
allow_next_instance_of(ServicePing::BuildPayloadService) do |service|
allow_next_instance_of(ServicePing::BuildPayload) do |service|
allow(service).to receive(:execute).and_return(payload)
end
end

View File

@ -982,10 +982,10 @@
portal-vue "^2.1.6"
vue-runtime-helpers "^1.1.2"
"@gitlab/visual-review-tools@1.7.1":
version "1.7.1"
resolved "https://registry.yarnpkg.com/@gitlab/visual-review-tools/-/visual-review-tools-1.7.1.tgz#9cc51c40bb530a621d0f5cb48ef3e891a79e92cc"
integrity sha512-64lbKhJierSKOQxZQ30gimUDZhOXjtC7GdovSJwKMECqUB5pmDzmQn4fY0Nxn8jREWluiur8N3+z3jr2HJJofg==
"@gitlab/visual-review-tools@1.7.3":
version "1.7.3"
resolved "https://registry.yarnpkg.com/@gitlab/visual-review-tools/-/visual-review-tools-1.7.3.tgz#9ea641146436da388ffbad25d7f2abe0df52c235"
integrity sha512-NMV++7Ew1FSBDN1xiZaauU9tfeSfgDHcOLpn+8bGpP+O5orUPm2Eu66R5eC5gkjBPaXosNAxNWtriee+aFk4+g==
"@graphql-eslint/eslint-plugin@3.10.2":
version "3.10.2"