summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rubocop.yml10
-rw-r--r--.rubocop_todo.yml50
-rw-r--r--.rubocop_todo/rails/active_record_callbacks_order.yml28
-rw-r--r--.rubocop_todo/rails/inverse_of.yml115
-rw-r--r--.rubocop_todo/rails/mailer_name.yml5
-rw-r--r--.rubocop_todo/rails/negate_include.yml58
-rw-r--r--.rubocop_todo/rails/where_exists.yml45
-rw-r--r--.rubocop_todo/rspec/repeated_example_group_body.yml68
-rw-r--r--.rubocop_todo/style/hash_as_last_array_item.yml62
-rw-r--r--.rubocop_todo/style/keyword_parameters_order.yml72
-rw-r--r--app/models/analytics/cycle_analytics/aggregation.rb8
-rw-r--r--app/services/service_ping/submit_service.rb13
-rw-r--r--data/removals/15_0/15_0-logging.yml16
-rw-r--r--db/migrate/20220511090324_add_last_consistency_check_cursors_to_vsa_aggregations.rb28
-rw-r--r--db/schema_migrations/202205110903241
-rw-r--r--db/structure.sql8
-rw-r--r--doc/.vale/gitlab/CIConfigFile.yml17
-rw-r--r--doc/ci/environments/deployment_approvals.md2
-rw-r--r--doc/ci/environments/deployment_safety.md2
-rw-r--r--doc/ci/migration/circleci.md2
-rw-r--r--doc/ci/troubleshooting.md2
-rw-r--r--doc/update/removals.md10
-rw-r--r--doc/user/compliance/license_compliance/index.md2
-rw-r--r--doc/user/infrastructure/iac/index.md2
-rw-r--r--doc/user/project/pages/introduction.md2
-rw-r--r--doc/user/project/repository/managing_large_repositories.md51
-rw-r--r--doc/user/search/global_search/advanced_search_syntax.md4
-rw-r--r--lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric.rb2
-rw-r--r--lib/service_ping/build_payload.rb (renamed from app/services/service_ping/build_payload_service.rb)8
-rw-r--r--lib/service_ping/devops_report.rb (renamed from app/services/service_ping/devops_report_service.rb)8
-rw-r--r--lib/service_ping/permit_data_categories.rb (renamed from app/services/service_ping/permit_data_categories_service.rb)4
-rw-r--r--lib/service_ping/service_ping_settings.rb (renamed from app/services/service_ping/service_ping_settings.rb)0
-rw-r--r--package.json2
-rw-r--r--spec/db/schema_spec.rb2
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric_spec.rb2
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb2
-rw-r--r--spec/lib/service_ping/build_payload_spec.rb (renamed from spec/services/service_ping/build_payload_service_spec.rb)5
-rw-r--r--spec/lib/service_ping/devops_report_spec.rb35
-rw-r--r--spec/lib/service_ping/permit_data_categories_spec.rb (renamed from spec/services/service_ping/permit_data_categories_service_spec.rb)11
-rw-r--r--spec/lib/service_ping/service_ping_settings_spec.rb (renamed from spec/services/service_ping/service_ping_settings_spec.rb)3
-rw-r--r--spec/models/analytics/cycle_analytics/aggregation_spec.rb31
-rw-r--r--spec/services/service_ping/submit_service_ping_service_spec.rb32
-rw-r--r--yarn.lock8
43 files changed, 738 insertions, 100 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index c99d3d0b6ab..7b4ec350a35 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -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
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 323f085473c..25d544ee03f 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -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
diff --git a/.rubocop_todo/rails/active_record_callbacks_order.yml b/.rubocop_todo/rails/active_record_callbacks_order.yml
new file mode 100644
index 00000000000..9585a720c6a
--- /dev/null
+++ b/.rubocop_todo/rails/active_record_callbacks_order.yml
@@ -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'
diff --git a/.rubocop_todo/rails/inverse_of.yml b/.rubocop_todo/rails/inverse_of.yml
new file mode 100644
index 00000000000..7a757ec8a9d
--- /dev/null
+++ b/.rubocop_todo/rails/inverse_of.yml
@@ -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'
diff --git a/.rubocop_todo/rails/mailer_name.yml b/.rubocop_todo/rails/mailer_name.yml
new file mode 100644
index 00000000000..17e55c178f7
--- /dev/null
+++ b/.rubocop_todo/rails/mailer_name.yml
@@ -0,0 +1,5 @@
+---
+# Cop supports --auto-correct.
+Rails/MailerName:
+ Exclude:
+ - 'app/mailers/notify.rb'
diff --git a/.rubocop_todo/rails/negate_include.yml b/.rubocop_todo/rails/negate_include.yml
new file mode 100644
index 00000000000..7bf78b82b60
--- /dev/null
+++ b/.rubocop_todo/rails/negate_include.yml
@@ -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'
diff --git a/.rubocop_todo/rails/where_exists.yml b/.rubocop_todo/rails/where_exists.yml
new file mode 100644
index 00000000000..00ff82d137e
--- /dev/null
+++ b/.rubocop_todo/rails/where_exists.yml
@@ -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'
diff --git a/.rubocop_todo/rspec/repeated_example_group_body.yml b/.rubocop_todo/rspec/repeated_example_group_body.yml
new file mode 100644
index 00000000000..87148442b08
--- /dev/null
+++ b/.rubocop_todo/rspec/repeated_example_group_body.yml
@@ -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'
diff --git a/.rubocop_todo/style/hash_as_last_array_item.yml b/.rubocop_todo/style/hash_as_last_array_item.yml
new file mode 100644
index 00000000000..eec2e77eafd
--- /dev/null
+++ b/.rubocop_todo/style/hash_as_last_array_item.yml
@@ -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'
diff --git a/.rubocop_todo/style/keyword_parameters_order.yml b/.rubocop_todo/style/keyword_parameters_order.yml
new file mode 100644
index 00000000000..0bb499cebb0
--- /dev/null
+++ b/.rubocop_todo/style/keyword_parameters_order.yml
@@ -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'
diff --git a/app/models/analytics/cycle_analytics/aggregation.rb b/app/models/analytics/cycle_analytics/aggregation.rb
index 2c04e67a04b..2e58d64ae95 100644
--- a/app/models/analytics/cycle_analytics/aggregation.rb
+++ b/app/models/analytics/cycle_analytics/aggregation.rb
@@ -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
diff --git a/app/services/service_ping/submit_service.rb b/app/services/service_ping/submit_service.rb
index 66069ef3e35..343fc00a2f0 100644
--- a/app/services/service_ping/submit_service.rb
+++ b/app/services/service_ping/submit_service.rb
@@ -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
diff --git a/data/removals/15_0/15_0-logging.yml b/data/removals/15_0/15_0-logging.yml
new file mode 100644
index 00000000000..2cff8f39e19
--- /dev/null
+++ b/data/removals/15_0/15_0-logging.yml
@@ -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
diff --git a/db/migrate/20220511090324_add_last_consistency_check_cursors_to_vsa_aggregations.rb b/db/migrate/20220511090324_add_last_consistency_check_cursors_to_vsa_aggregations.rb
new file mode 100644
index 00000000000..53c09597be5
--- /dev/null
+++ b/db/migrate/20220511090324_add_last_consistency_check_cursors_to_vsa_aggregations.rb
@@ -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
diff --git a/db/schema_migrations/20220511090324 b/db/schema_migrations/20220511090324
new file mode 100644
index 00000000000..186512ca91a
--- /dev/null
+++ b/db/schema_migrations/20220511090324
@@ -0,0 +1 @@
+4904ea4034a58dadb9b84deaade823f1e50085b5a4bce69da7fa44c38e588858 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index ee69c66a29d..a2136ae7eb1 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -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)),
diff --git a/doc/.vale/gitlab/CIConfigFile.yml b/doc/.vale/gitlab/CIConfigFile.yml
new file mode 100644
index 00000000000..5a65e51ea16
--- /dev/null
+++ b/doc/.vale/gitlab/CIConfigFile.yml
@@ -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`)'
diff --git a/doc/ci/environments/deployment_approvals.md b/doc/ci/environments/deployment_approvals.md
index 6dd981ea1fb..971a62c5dab 100644
--- a/doc/ci/environments/deployment_approvals.md
+++ b/doc/ci/environments/deployment_approvals.md
@@ -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:
diff --git a/doc/ci/environments/deployment_safety.md b/doc/ci/environments/deployment_safety.md
index a556d17ad75..af66a0949c9 100644
--- a/doc/ci/environments/deployment_safety.md
+++ b/doc/ci/environments/deployment_safety.md
@@ -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
diff --git a/doc/ci/migration/circleci.md b/doc/ci/migration/circleci.md
index d2f865a160e..b1c4c62c465 100644
--- a/doc/ci/migration/circleci.md
+++ b/doc/ci/migration/circleci.md
@@ -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.
diff --git a/doc/ci/troubleshooting.md b/doc/ci/troubleshooting.md
index dafa9188aa2..1757543be5b 100644
--- a/doc/ci/troubleshooting.md
+++ b/doc/ci/troubleshooting.md
@@ -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:
diff --git a/doc/update/removals.md b/doc/update/removals.md
index 39c6e10ec36..b56ab14cb71 100644
--- a/doc/update/removals.md
+++ b/doc/update/removals.md
@@ -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:
diff --git a/doc/user/compliance/license_compliance/index.md b/doc/user/compliance/license_compliance/index.md
index 73ccb58dfed..792ddd2f11b 100644
--- a/doc/user/compliance/license_compliance/index.md
+++ b/doc/user/compliance/license_compliance/index.md
@@ -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`. |
diff --git a/doc/user/infrastructure/iac/index.md b/doc/user/infrastructure/iac/index.md
index 37659c88827..0f7965a3527 100644
--- a/doc/user/infrastructure/iac/index.md
+++ b/doc/user/infrastructure/iac/index.md
@@ -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
diff --git a/doc/user/project/pages/introduction.md b/doc/user/project/pages/introduction.md
index f274338c2fd..5846ceeb1b6 100644
--- a/doc/user/project/pages/introduction.md
+++ b/doc/user/project/pages/introduction.md
@@ -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:
diff --git a/doc/user/project/repository/managing_large_repositories.md b/doc/user/project/repository/managing_large_repositories.md
new file mode 100644
index 00000000000..d6f88697c54
--- /dev/null
+++ b/doc/user/project/repository/managing_large_repositories.md
@@ -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).
diff --git a/doc/user/search/global_search/advanced_search_syntax.md b/doc/user/search/global_search/advanced_search_syntax.md
index 81c21c67ef3..3aa016f0bff 100644
--- a/doc/user/search/global_search/advanced_search_syntax.md
+++ b/doc/user/search/global_search/advanced_search_syntax.md
@@ -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 -->
diff --git a/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric.rb b/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric.rb
index ee51180973c..51be4bf3ccf 100644
--- a/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric.rb
+++ b/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric.rb
@@ -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
diff --git a/app/services/service_ping/build_payload_service.rb b/lib/service_ping/build_payload.rb
index f7e19dd9e42..4d3b32a1fc0 100644
--- a/app/services/service_ping/build_payload_service.rb
+++ b/lib/service_ping/build_payload.rb
@@ -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')
diff --git a/app/services/service_ping/devops_report_service.rb b/lib/service_ping/devops_report.rb
index 3b8f5dfdb82..2444dfa1d21 100644
--- a/app/services/service_ping/devops_report_service.rb
+++ b/lib/service_ping/devops_report.rb
@@ -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
diff --git a/app/services/service_ping/permit_data_categories_service.rb b/lib/service_ping/permit_data_categories.rb
index d8fa255a485..51eec0808cb 100644
--- a/app/services/service_ping/permit_data_categories_service.rb
+++ b/lib/service_ping/permit_data_categories.rb
@@ -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')
diff --git a/app/services/service_ping/service_ping_settings.rb b/lib/service_ping/service_ping_settings.rb
index 6964210b1db..6964210b1db 100644
--- a/app/services/service_ping/service_ping_settings.rb
+++ b/lib/service_ping/service_ping_settings.rb
diff --git a/package.json b/package.json
index f6a716b7312..21945c6799d 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb
index c7ab509bf59..b38a15e4c94 100644
--- a/spec/db/schema_spec.rb
+++ b/spec/db/schema_spec.rb
@@ -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],
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric_spec.rb
index 1b2170baf17..92d4de3c462 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/collected_data_categories_metric_spec.rb
@@ -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
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index a3d938b3ded..7edec6d13f4 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -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
diff --git a/spec/services/service_ping/build_payload_service_spec.rb b/spec/lib/service_ping/build_payload_spec.rb
index 6d5ba5bf4dd..6cce07262b2 100644
--- a/spec/services/service_ping/build_payload_service_spec.rb
+++ b/spec/lib/service_ping/build_payload_spec.rb
@@ -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
diff --git a/spec/lib/service_ping/devops_report_spec.rb b/spec/lib/service_ping/devops_report_spec.rb
new file mode 100644
index 00000000000..793f3066097
--- /dev/null
+++ b/spec/lib/service_ping/devops_report_spec.rb
@@ -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
diff --git a/spec/services/service_ping/permit_data_categories_service_spec.rb b/spec/lib/service_ping/permit_data_categories_spec.rb
index 550c0ea5e13..d1027a6f1ab 100644
--- a/spec/services/service_ping/permit_data_categories_service_spec.rb
+++ b/spec/lib/service_ping/permit_data_categories_spec.rb
@@ -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
diff --git a/spec/services/service_ping/service_ping_settings_spec.rb b/spec/lib/service_ping/service_ping_settings_spec.rb
index 90a5c6b30eb..040a5027274 100644
--- a/spec/services/service_ping/service_ping_settings_spec.rb
+++ b/spec/lib/service_ping/service_ping_settings_spec.rb
@@ -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
diff --git a/spec/models/analytics/cycle_analytics/aggregation_spec.rb b/spec/models/analytics/cycle_analytics/aggregation_spec.rb
index 6071e4b3d21..2fb40852791 100644
--- a/spec/models/analytics/cycle_analytics/aggregation_spec.rb
+++ b/spec/models/analytics/cycle_analytics/aggregation_spec.rb
@@ -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
diff --git a/spec/services/service_ping/submit_service_ping_service_spec.rb b/spec/services/service_ping/submit_service_ping_service_spec.rb
index 37e50613e62..7a8bd1910fe 100644
--- a/spec/services/service_ping/submit_service_ping_service_spec.rb
+++ b/spec/services/service_ping/submit_service_ping_service_spec.rb
@@ -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
diff --git a/yarn.lock b/yarn.lock
index 1ac64b3119c..2d3a1a6e048 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -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"