diff --git a/.haml-lint.yml b/.haml-lint.yml index 1345df2c0bd..7db3d64409b 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -134,6 +134,7 @@ linters: - Style/NegatedIf - Style/NestedTernaryOperator - Style/SelfAssignment + - Style/StringConcatenation - Style/TernaryParentheses - Style/TrailingCommaInHashLiteral - Style/UnlessElse diff --git a/.rubocop_todo/layout/hash_alignment.yml b/.rubocop_todo/layout/hash_alignment.yml index fb69a08e2d9..94cba6f59bf 100644 --- a/.rubocop_todo/layout/hash_alignment.yml +++ b/.rubocop_todo/layout/hash_alignment.yml @@ -28,26 +28,6 @@ Layout/HashAlignment: - 'ee/app/graphql/ee/types/merge_request_type.rb' - 'ee/app/graphql/ee/types/project_type.rb' - 'ee/app/graphql/ee/types/query_type.rb' - - 'ee/app/graphql/mutations/iterations/cadences/create.rb' - - 'ee/app/graphql/mutations/iterations/cadences/update.rb' - - 'ee/app/graphql/mutations/iterations/delete.rb' - - 'ee/app/graphql/mutations/projects/set_locked.rb' - - 'ee/app/graphql/resolvers/iterations/cadences_resolver.rb' - - 'ee/app/graphql/resolvers/vulnerabilities_count_per_day_resolver.rb' - - 'ee/app/graphql/types/admin/cloud_licenses/current_license_type.rb' - - 'ee/app/graphql/types/admin/cloud_licenses/license_type.rb' - - 'ee/app/graphql/types/admin/cloud_licenses/subscription_future_entry_type.rb' - - 'ee/app/graphql/types/analytics/devops_adoption/enabled_namespace_type.rb' - - 'ee/app/graphql/types/analytics/devops_adoption/snapshot_type.rb' - - 'ee/app/graphql/types/app_sec/fuzzing/api/ci_configuration_type.rb' - - 'ee/app/graphql/types/app_sec/fuzzing/api/scan_profile_type.rb' - - 'ee/app/graphql/types/app_sec/fuzzing/coverage/corpus_type.rb' - - 'ee/app/graphql/types/boards/epic_board_type.rb' - - 'ee/app/graphql/types/boards/epic_list_type.rb' - - 'ee/app/graphql/types/boards/epic_user_preferences_type.rb' - - 'ee/app/graphql/types/burnup_chart_daily_totals_type.rb' - - 'ee/app/graphql/types/ci/code_coverage_activity_type.rb' - - 'ee/app/graphql/types/ci/code_quality_degradation_type.rb' - 'ee/app/graphql/types/ci/namespace_ci_cd_setting_type.rb' - 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_type.rb' - 'ee/app/graphql/types/dast/profile_schedule_type.rb' @@ -224,7 +204,6 @@ Layout/HashAlignment: - 'ee/spec/services/status_page/unpublish_details_service_spec.rb' - 'ee/spec/services/vulnerabilities/create_from_security_finding_service_spec.rb' - 'ee/spec/services/vulnerabilities/findings/create_from_security_finding_service_spec.rb' - - 'ee/spec/services/vulnerabilities/security_finding/create_issue_service_spec.rb' - 'ee/spec/support/shared_examples/services/audit_event_logging_shared_examples.rb' - 'ee/spec/support/shared_examples/status_page/publish_shared_examples.rb' - 'ee/spec/support/shared_examples/status_page/reference_links_examples.rb' diff --git a/.rubocop_todo/style/hash_as_last_array_item.yml b/.rubocop_todo/style/hash_as_last_array_item.yml index eec2e77eafd..384d2dc5fce 100644 --- a/.rubocop_todo/style/hash_as_last_array_item.yml +++ b/.rubocop_todo/style/hash_as_last_array_item.yml @@ -1,15 +1,11 @@ --- # 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' @@ -29,6 +25,7 @@ Style/HashAsLastArrayItem: - 'app/models/customer_relations/contact.rb' - 'app/models/customer_relations/organization.rb' - 'app/models/deploy_key.rb' + - 'app/models/deployment.rb' - 'app/models/issue.rb' - 'app/models/merge_request.rb' - 'app/models/milestone.rb' @@ -59,4 +56,5 @@ Style/HashAsLastArrayItem: - '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/concerns/worker_attributes_spec.rb' - 'spec/workers/merge_worker_spec.rb' diff --git a/.rubocop_todo/style/hash_each_methods.yml b/.rubocop_todo/style/hash_each_methods.yml index 648b6fbbe08..cebfe5c0c7d 100644 --- a/.rubocop_todo/style/hash_each_methods.yml +++ b/.rubocop_todo/style/hash_each_methods.yml @@ -1,9 +1,6 @@ --- # Cop supports --auto-correct. Style/HashEachMethods: - # Offense count: 95 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/graphql/resolvers/concerns/caching_array_resolver.rb' - 'app/graphql/types/alert_management/severity_enum.rb' @@ -12,6 +9,7 @@ Style/HashEachMethods: - 'app/graphql/types/ci/job_artifact_file_type_enum.rb' - 'app/graphql/types/ci/pipeline_config_source_enum.rb' - 'app/graphql/types/ci/runner_access_level_enum.rb' + - 'app/graphql/types/ci/variable_type_enum.rb' - 'app/graphql/types/clusters/agent_token_status_enum.rb' - 'app/graphql/types/container_repository_status_enum.rb' - 'app/graphql/types/data_visualization_palette/color_enum.rb' @@ -34,6 +32,7 @@ Style/HashEachMethods: - 'config/initializers/8_gitaly.rb' - 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_reason_enum.rb' - 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_severity_enum.rb' + - 'ee/app/graphql/types/incident_management/issuable_resource_link_type_enum.rb' - 'ee/app/graphql/types/incident_management/oncall_rotation_length_unit_enum.rb' - 'ee/app/graphql/types/security_report_summary_type.rb' - 'ee/app/graphql/types/vulnerabilities_count_by_day_type.rb' @@ -69,7 +68,6 @@ Style/HashEachMethods: - 'spec/helpers/application_helper_spec.rb' - 'spec/lib/gitlab/ci/status/build/failed_spec.rb' - 'spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb' - - 'spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb' - 'spec/lib/gitlab/usage_data_spec.rb' - 'spec/models/ci/build_spec.rb' - 'spec/models/ci/job_artifact_spec.rb' @@ -77,6 +75,7 @@ Style/HashEachMethods: - 'spec/models/clusters/cluster_spec.rb' - 'spec/models/concerns/has_user_type_spec.rb' - 'spec/models/packages/package_spec.rb' + - 'spec/models/project_spec.rb' - 'spec/models/user_spec.rb' - 'spec/presenters/ci/pipeline_presenter_spec.rb' - 'spec/presenters/commit_status_presenter_spec.rb' diff --git a/.rubocop_todo/style/redundant_self.yml b/.rubocop_todo/style/redundant_self.yml index 9951160ae02..65f2ea327d7 100644 --- a/.rubocop_todo/style/redundant_self.yml +++ b/.rubocop_todo/style/redundant_self.yml @@ -1,12 +1,11 @@ --- # Cop supports --auto-correct. Style/RedundantSelf: - # Offense count: 1222 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: + - 'app/channels/awareness_channel.rb' - 'app/controllers/application_controller.rb' - 'app/finders/security/jobs_finder.rb' + - 'app/graphql/types/permission_types/base_permission_type.rb' - 'app/models/abuse_report.rb' - 'app/models/analytics/usage_trends/measurement.rb' - 'app/models/application_record.rb' @@ -74,6 +73,7 @@ Style/RedundantSelf: - 'app/models/concerns/merge_request_reviewer_state.rb' - 'app/models/concerns/noteable.rb' - 'app/models/concerns/packages/debian/distribution.rb' + - 'app/models/concerns/participable.rb' - 'app/models/concerns/pg_full_text_searchable.rb' - 'app/models/concerns/protected_ref.rb' - 'app/models/concerns/protected_ref_access.rb' @@ -102,6 +102,7 @@ Style/RedundantSelf: - 'app/models/gpg_key.rb' - 'app/models/group.rb' - 'app/models/group_group_link.rb' + - 'app/models/hooks/web_hook_log.rb' - 'app/models/identity.rb' - 'app/models/integration.rb' - 'app/models/integrations/base_chat_notification.rb' @@ -112,6 +113,7 @@ Style/RedundantSelf: - 'app/models/integrations/emails_on_push.rb' - 'app/models/integrations/jira.rb' - 'app/models/integrations/pipelines_email.rb' + - 'app/models/integrations/slack.rb' - 'app/models/integrations/zentao.rb' - 'app/models/internal_id.rb' - 'app/models/issue.rb' @@ -125,11 +127,10 @@ Style/RedundantSelf: - 'app/models/member.rb' - 'app/models/members/project_member.rb' - 'app/models/merge_request.rb' + - 'app/models/merge_request/cleanup_schedule.rb' - 'app/models/merge_request/metrics.rb' - - 'app/models/merge_request_assignee.rb' - 'app/models/merge_request_diff.rb' - 'app/models/merge_request_diff_commit.rb' - - 'app/models/merge_request_reviewer.rb' - 'app/models/namespaces/traversal/linear.rb' - 'app/models/note.rb' - 'app/models/packages/dependency.rb' @@ -179,10 +180,11 @@ Style/RedundantSelf: - 'app/uploaders/gitlab_uploader.rb' - 'app/uploaders/object_storage.rb' - 'app/workers/background_migration/single_database_worker.rb' + - 'app/workers/build_hooks_worker.rb' - 'app/workers/concerns/application_worker.rb' - 'app/workers/concerns/limited_capacity/worker.rb' - 'app/workers/concerns/project_start_import.rb' - - 'app/workers/concerns/waitable_worker.rb' + - 'app/workers/concerns/reenqueuer.rb' - 'app/workers/database/batched_background_migration/single_database_worker.rb' - 'app/workers/group_import_worker.rb' - 'app/workers/project_export_worker.rb' @@ -193,6 +195,7 @@ Style/RedundantSelf: - 'db/post_migrate/20210329102724_add_new_trail_plans.rb' - 'db/post_migrate/20211029102822_add_open_source_plan.rb' - 'ee/app/graphql/resolvers/geo/registries_resolver.rb' + - 'ee/app/models/approval_merge_request_rule.rb' - 'ee/app/models/approval_project_rule.rb' - 'ee/app/models/concerns/approval_rule_like.rb' - 'ee/app/models/concerns/custom_model_naming.rb' @@ -216,9 +219,12 @@ Style/RedundantSelf: - 'ee/app/models/ee/description_version.rb' - 'ee/app/models/ee/environment.rb' - 'ee/app/models/ee/epic.rb' + - 'ee/app/models/ee/group.rb' - 'ee/app/models/ee/group_member.rb' - 'ee/app/models/ee/issue.rb' - 'ee/app/models/ee/iteration.rb' + - 'ee/app/models/ee/member.rb' + - 'ee/app/models/ee/merge_request.rb' - 'ee/app/models/ee/namespace.rb' - 'ee/app/models/ee/packages/package_file.rb' - 'ee/app/models/ee/project.rb' @@ -247,13 +253,17 @@ Style/RedundantSelf: - 'ee/lib/ee/gitlab/auth/ldap/sync/groups.rb' - 'ee/lib/ee/gitlab/auth/ldap/sync/proxy.rb' - 'ee/lib/ee/gitlab/auth/ldap/sync/users.rb' + - 'ee/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size.rb' + - 'ee/lib/ee/gitlab/background_migration/delete_invalid_epic_issues.rb' - 'ee/lib/ee/gitlab/background_migration/fix_incorrect_max_seats_used.rb' - 'ee/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings.rb' + - 'ee/lib/ee/gitlab/database.rb' - 'ee/lib/ee/gitlab/tracking.rb' - 'ee/lib/ee/legacy_model.rb' - 'ee/lib/ee/model.rb' - 'ee/lib/elastic/instance_proxy_util.rb' - 'ee/lib/elastic/latest/application_class_proxy.rb' + - 'ee/lib/elastic/latest/commit_config.rb' - 'ee/lib/elastic/latest/issue_config.rb' - 'ee/lib/elastic/latest/merge_request_config.rb' - 'ee/lib/elastic/latest/note_config.rb' @@ -275,9 +285,9 @@ Style/RedundantSelf: - 'ee/lib/gitlab/geo/oauth/logout_state.rb' - 'ee/lib/gitlab/geo/replicator.rb' - 'ee/lib/gitlab/template/custom_template.rb' + - 'ee/lib/system_check/app/search_check.rb' - 'ee/spec/helpers/ee/feature_flags_helper_spec.rb' - 'ee/spec/helpers/ee/graph_helper_spec.rb' - - 'ee/spec/models/geo/deleted_project_spec.rb' - 'lib/api/entities/wiki_attachment.rb' - 'lib/api/helpers.rb' - 'lib/api/helpers/packages_helpers.rb' @@ -328,6 +338,7 @@ Style/RedundantSelf: - 'lib/gitlab/database/load_balancing/service_discovery.rb' - 'lib/gitlab/database/loose_foreign_keys.rb' - 'lib/gitlab/database/migration_helpers/restrict_gitlab_schema.rb' + - 'lib/gitlab/database/migrations/background_migration_helpers.rb' - 'lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb' - 'lib/gitlab/database/query_analyzers/base.rb' - 'lib/gitlab/database/query_analyzers/prevent_cross_database_modification.rb' @@ -339,6 +350,7 @@ Style/RedundantSelf: - 'lib/gitlab/diff/file.rb' - 'lib/gitlab/diff/rendered/notebook/diff_file.rb' - 'lib/gitlab/email/smtp_config.rb' + - 'lib/gitlab/error_tracking/logger.rb' - 'lib/gitlab/feature_categories.rb' - 'lib/gitlab/git.rb' - 'lib/gitlab/git/blob.rb' @@ -347,6 +359,7 @@ Style/RedundantSelf: - 'lib/gitlab/git/tree.rb' - 'lib/gitlab/git_access.rb' - 'lib/gitlab/github_import.rb' + - 'lib/gitlab/graphql/deprecations_base.rb' - 'lib/gitlab/graphql/known_operations.rb' - 'lib/gitlab/graphql/lazy.rb' - 'lib/gitlab/graphql/representation/submodule_tree_entry.rb' @@ -399,10 +412,10 @@ Style/RedundantSelf: - 'lib/system_check/rake_task/rake_task_helpers.rb' - 'lib/uploaded_file.rb' - 'qa/lib/gitlab/page/main/sign_up.rb' - - 'qa/qa/git/repository.rb' - 'qa/qa/page/validatable.rb' - 'qa/qa/resource/base.rb' - 'qa/qa/resource/events/project.rb' + - 'qa/qa/resource/personal_access_token.rb' - 'qa/qa/resource/protected_branch.rb' - 'qa/qa/resource/reusable.rb' - 'qa/qa/resource/user_gpg.rb' @@ -416,6 +429,8 @@ Style/RedundantSelf: - 'spec/helpers/graph_helper_spec.rb' - 'spec/helpers/ide_helper_spec.rb' - 'spec/helpers/submodule_helper_spec.rb' + - 'spec/lib/gitlab/background_task_spec.rb' - 'spec/lib/gitlab/database/load_balancing_spec.rb' + - 'spec/models/integration_spec.rb' - 'spec/support/before_all_adapter.rb' - 'spec/support/cycle_analytics_helpers/test_generation.rb' diff --git a/.rubocop_todo/style/string_concatenation.yml b/.rubocop_todo/style/string_concatenation.yml index 8c8dbf86b1c..2330683cc18 100644 --- a/.rubocop_todo/style/string_concatenation.yml +++ b/.rubocop_todo/style/string_concatenation.yml @@ -1,10 +1,8 @@ --- # Cop supports --auto-correct. Style/StringConcatenation: - # Offense count: 611 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: + - 'app/components/pajamas/button_component.rb' - 'app/controllers/concerns/creates_commit.rb' - 'app/controllers/groups/dependency_proxy_for_containers_controller.rb' - 'app/controllers/jira_connect/app_descriptor_controller.rb' @@ -45,7 +43,6 @@ Style/StringConcatenation: - 'app/services/packages/debian/generate_distribution_key_service.rb' - 'app/services/packages/debian/generate_distribution_service.rb' - 'app/services/pages/zip_directory_service.rb' - - 'app/services/projects/update_pages_service.rb' - 'app/services/repositories/base_service.rb' - 'app/services/verify_pages_domain_service.rb' - 'app/uploaders/gitlab_uploader.rb' @@ -56,6 +53,7 @@ Style/StringConcatenation: - 'db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb' - 'ee/app/controllers/admin/elasticsearch_controller.rb' - 'ee/app/finders/ee/issuables/label_filter.rb' + - 'ee/app/helpers/ee/geo_helper.rb' - 'ee/app/helpers/ee/gitlab_routing_helper.rb' - 'ee/app/helpers/ee/mirror_helper.rb' - 'ee/app/helpers/ee/search_helper.rb' @@ -70,6 +68,7 @@ Style/StringConcatenation: - 'ee/lib/api/project_mirror.rb' - 'ee/lib/ee/audit/project_changes_auditor.rb' - 'ee/lib/ee/gitlab/auth/ldap/person.rb' + - 'ee/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size.rb' - 'ee/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids.rb' - 'ee/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column.rb' - 'ee/lib/elastic/latest/git_class_proxy.rb' @@ -81,7 +80,6 @@ Style/StringConcatenation: - 'ee/spec/controllers/trial_registrations_controller_spec.rb' - 'ee/spec/features/boards/boards_spec.rb' - 'ee/spec/features/projects/pipelines/pipeline_spec.rb' - - 'ee/spec/helpers/ee/integrations_helper_spec.rb' - 'ee/spec/helpers/search_helper_spec.rb' - 'ee/spec/lib/gitlab/auth/ldap/person_spec.rb' - 'ee/spec/lib/gitlab/auth/o_auth/user_spec.rb' @@ -94,8 +92,8 @@ Style/StringConcatenation: - 'ee/spec/models/dast_site_validation_spec.rb' - 'ee/spec/models/ee/audit_event_spec.rb' - 'ee/spec/models/geo_node_spec.rb' + - 'ee/spec/models/incident_management/issuable_resource_link_spec.rb' - 'ee/spec/models/status_page/project_setting_spec.rb' - - 'ee/spec/requests/api/internal/kubernetes_spec.rb' - 'ee/spec/services/jira/jql_builder_service_spec.rb' - 'ee/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb' - 'ee/spec/services/todo_service_spec.rb' @@ -138,6 +136,7 @@ Style/StringConcatenation: - 'lib/gitlab/kubernetes/kubectl_cmd.rb' - 'lib/gitlab/lfs/client.rb' - 'lib/gitlab/logger.rb' + - 'lib/gitlab/pages/deployment_update.rb' - 'lib/gitlab/path_regex.rb' - 'lib/gitlab/prometheus/internal.rb' - 'lib/gitlab/quick_actions/extractor.rb' @@ -150,6 +149,7 @@ Style/StringConcatenation: - 'lib/gitlab/throttle.rb' - 'lib/gitlab/time_tracking_formatter.rb' - 'lib/gitlab/untrusted_regexp.rb' + - 'lib/gitlab/usage/metrics/instrumentations/issues_created_from_alerts_metric.rb' - 'lib/gitlab/usage_data_counters/quick_action_activity_unique_counter.rb' - 'lib/gitlab/usage_data_queries.rb' - 'lib/google_api/cloud_platform/client.rb' @@ -163,8 +163,8 @@ Style/StringConcatenation: - 'qa/qa/page/milestone/new.rb' - 'qa/qa/page/project/milestone/new.rb' - 'qa/qa/page/project/settings/deploy_tokens.rb' + - 'qa/qa/specs/features/browser_ui/3_create/source_editor/source_editor_toolbar_spec.rb' - 'qa/qa/specs/features/ee/browser_ui/3_create/repository/assign_code_owners_spec.rb' - - 'qa/qa/support/page_error_checker.rb' - 'qa/qa/tools/generate_perf_testdata.rb' - 'scripts/perf/gc/print_gc_stats.rb' - 'scripts/perf/query_limiting_report.rb' @@ -230,7 +230,6 @@ Style/StringConcatenation: - 'spec/lib/gitlab/gitaly_client/repository_service_spec.rb' - 'spec/lib/gitlab/gitaly_client/wiki_service_spec.rb' - 'spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb' - - 'spec/lib/gitlab/kubernetes/kube_client_spec.rb' - 'spec/lib/gitlab/lfs/client_spec.rb' - 'spec/lib/gitlab/other_markup_spec.rb' - 'spec/lib/gitlab/path_regex_spec.rb' @@ -246,6 +245,7 @@ Style/StringConcatenation: - 'spec/lib/gitlab/tree_summary_spec.rb' - 'spec/lib/gitlab/url_blocker_spec.rb' - 'spec/lib/gitlab/utils_spec.rb' + - 'spec/lib/gitlab/visibility_level_spec.rb' - 'spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb' - 'spec/lib/gitlab/workhorse_spec.rb' - 'spec/lib/kramdown/kramdown_spec.rb' @@ -288,12 +288,14 @@ Style/StringConcatenation: - 'spec/requests/api/merge_requests_spec.rb' - 'spec/requests/api/notes_spec.rb' - 'spec/requests/api/pypi_packages_spec.rb' + - 'spec/requests/users_controller_spec.rb' - 'spec/routing/git_http_routing_spec.rb' - 'spec/services/ci/find_exposed_artifacts_service_spec.rb' - 'spec/services/clusters/gcp/finalize_creation_service_spec.rb' - 'spec/services/clusters/kubernetes/configure_istio_ingress_service_spec.rb' - 'spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb' - 'spec/services/error_tracking/list_projects_service_spec.rb' + - 'spec/services/groups/update_service_spec.rb' - 'spec/services/merge_requests/build_service_spec.rb' - 'spec/services/metrics/dashboard/grafana_metric_embed_service_spec.rb' - 'spec/services/packages/conan/create_package_file_service_spec.rb' @@ -303,6 +305,7 @@ Style/StringConcatenation: - 'spec/services/projects/create_service_spec.rb' - 'spec/services/projects/destroy_service_spec.rb' - 'spec/services/projects/download_service_spec.rb' + - 'spec/services/projects/update_service_spec.rb' - 'spec/services/push_event_payload_service_spec.rb' - 'spec/services/repositories/destroy_service_spec.rb' - 'spec/services/snippets/bulk_destroy_service_spec.rb' @@ -323,9 +326,9 @@ Style/StringConcatenation: - 'spec/support/shared_examples/lib/banzai/reference_parser_shared_examples.rb' - 'spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb' - 'spec/support/shared_examples/models/wiki_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/hooks_shared_examples.rb' - 'spec/support/shared_examples/requests/snippet_shared_examples.rb' - 'spec/support/unpack-gitlab-git-test' - - 'spec/tasks/gitlab/backup_rake_spec.rb' - 'spec/tooling/lib/tooling/kubernetes_client_spec.rb' - 'spec/uploaders/job_artifact_uploader_spec.rb' - 'spec/validators/addressable_url_validator_spec.rb' diff --git a/.rubocop_todo/style/symbol_proc.yml b/.rubocop_todo/style/symbol_proc.yml index ea3a505d2da..770b99109b4 100644 --- a/.rubocop_todo/style/symbol_proc.yml +++ b/.rubocop_todo/style/symbol_proc.yml @@ -1,9 +1,6 @@ --- # Cop supports --auto-correct. Style/SymbolProc: - # Offense count: 341 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/controllers/admin/users_controller.rb' - 'app/controllers/concerns/renders_blob.rb' @@ -14,7 +11,10 @@ Style/SymbolProc: - 'app/controllers/profiles_controller.rb' - 'app/finders/packages/go/version_finder.rb' - 'app/graphql/mutations/commits/create.rb' + - 'app/graphql/mutations/concerns/mutations/work_items/widgetable.rb' - 'app/graphql/mutations/jira_import/start.rb' + - 'app/graphql/mutations/work_items/update_widgets.rb' + - 'app/graphql/types/work_items/widgets/description_type.rb' - 'app/helpers/graph_helper.rb' - 'app/models/ci/build_metadata.rb' - 'app/models/ci/build_trace_chunk.rb' @@ -24,6 +24,7 @@ Style/SymbolProc: - 'app/models/concerns/board_recent_visit.rb' - 'app/models/concerns/resolvable_discussion.rb' - 'app/models/container_repository.rb' + - 'app/models/deployment.rb' - 'app/models/discussion.rb' - 'app/models/environment.rb' - 'app/models/integrations/prometheus.rb' @@ -43,11 +44,9 @@ Style/SymbolProc: - 'app/serializers/build_details_entity.rb' - 'app/serializers/ci/pipeline_entity.rb' - 'app/serializers/ci/trigger_entity.rb' - - 'app/serializers/cluster_entity.rb' - 'app/serializers/deployment_cluster_entity.rb' - 'app/serializers/deployment_entity.rb' - 'app/serializers/draft_note_entity.rb' - - 'app/serializers/environment_entity.rb' - 'app/serializers/import/bitbucket_provider_repo_entity.rb' - 'app/serializers/import/fogbugz_provider_repo_entity.rb' - 'app/serializers/issuable_sidebar_basic_entity.rb' @@ -55,6 +54,7 @@ Style/SymbolProc: - 'app/serializers/linked_project_issue_entity.rb' - 'app/serializers/member_entity.rb' - 'app/serializers/member_user_entity.rb' + - 'app/serializers/merge_request_poll_widget_entity.rb' - 'app/serializers/merge_request_widget_entity.rb' - 'app/serializers/project_entity.rb' - 'app/serializers/project_mirror_entity.rb' @@ -69,7 +69,6 @@ Style/SymbolProc: - 'app/services/ci/update_build_state_service.rb' - 'app/services/clusters/agents/delete_expired_events_service.rb' - 'app/services/feature_flags/update_service.rb' - - 'app/services/google_cloud/enable_cloud_run_service.rb' - 'app/services/merge_requests/base_service.rb' - 'app/services/merge_requests/bulk_remove_attention_requested_service.rb' - 'app/services/merge_requests/reopen_service.rb' @@ -81,6 +80,7 @@ Style/SymbolProc: - 'app/workers/bulk_imports/stuck_import_worker.rb' - 'app/workers/ci/build_trace_chunk_flush_worker.rb' - 'app/workers/gitlab/import/stuck_import_job.rb' + - 'app/workers/merge_requests/update_head_pipeline_worker.rb' - 'app/workers/namespaces/prune_aggregation_schedules_worker.rb' - 'app/workers/stuck_export_jobs_worker.rb' - 'app/workers/update_head_pipeline_for_merge_request_worker.rb' @@ -119,6 +119,7 @@ Style/SymbolProc: - 'ee/lib/ee/api/entities/geo_node.rb' - 'ee/lib/ee/api/entities/merge_request_approval_state.rb' - 'ee/lib/ee/gitlab/auth/ldap/access.rb' + - 'ee/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size.rb' - 'ee/lib/ee/gitlab/background_migration/drop_invalid_remediations.rb' - 'ee/lib/ee/gitlab/background_migration/fix_incorrect_max_seats_used.rb' - 'ee/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings.rb' @@ -126,6 +127,7 @@ Style/SymbolProc: - 'ee/lib/gitlab/contribution_analytics/data_collector.rb' - 'ee/lib/gitlab/custom_file_templates.rb' - 'ee/lib/gitlab/geo/oauth/logout_state.rb' + - 'ee/spec/elastic/migrate/20220118150500_delete_orphaned_commits_spec.rb' - 'ee/spec/factories/issues.rb' - 'ee/spec/features/billings/extend_reactivate_trial_spec.rb' - 'ee/spec/features/billings/qrtly_reconciliation_alert_spec.rb' @@ -133,13 +135,12 @@ Style/SymbolProc: - 'ee/spec/helpers/ee/registrations_helper_spec.rb' - 'ee/spec/lib/ee/gitlab/search_results_spec.rb' - 'ee/spec/lib/gitlab/elastic/document_reference_spec.rb' - - 'ee/spec/lib/gitlab/graphql/aggregations/issues/lazy_links_aggregate_spec.rb' - 'ee/spec/models/ee/iterations/cadence_spec.rb' - 'ee/spec/services/groups/participants_service_spec.rb' - 'ee/spec/support/helpers/subscription_portal_helpers.rb' + - 'ee/spec/support/shared_examples/lib/gitlab/graphql/issuables_lazy_links_aggregate_shared_examples.rb' - 'lib/api/api_guard.rb' - 'lib/api/entities/board.rb' - - 'lib/api/entities/environment.rb' - 'lib/api/entities/issuable_references.rb' - 'lib/api/entities/merge_request_approvals.rb' - 'lib/api/entities/package.rb' @@ -148,7 +149,6 @@ Style/SymbolProc: - 'lib/api/go_proxy.rb' - 'lib/api/helpers/internal_helpers.rb' - 'lib/api/package_files.rb' - - 'lib/api/terraform/state.rb' - 'lib/atlassian/jira_connect/serializers/base_entity.rb' - 'lib/banzai/filter/inline_cluster_metrics_filter.rb' - 'lib/banzai/filter/inline_embeds_filter.rb' @@ -157,6 +157,7 @@ Style/SymbolProc: - 'lib/container_registry/client.rb' - 'lib/container_registry/gitlab_api_client.rb' - 'lib/gitlab/analytics/cycle_analytics/stage_events.rb' + - 'lib/gitlab/auth/o_auth/auth_hash.rb' - 'lib/gitlab/background_migration/cleanup_orphaned_lfs_objects_projects.rb' - 'lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb' - 'lib/gitlab/background_migration/remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings.rb' @@ -164,7 +165,6 @@ Style/SymbolProc: - 'lib/gitlab/cache/ci/project_pipeline_status.rb' - 'lib/gitlab/checks/changes_access.rb' - 'lib/gitlab/ci/pipeline/preloader.rb' - - 'lib/gitlab/ci/runner_upgrade_check.rb' - 'lib/gitlab/ci/trace.rb' - 'lib/gitlab/config/entry/node.rb' - 'lib/gitlab/database/async_indexes/migration_helpers.rb' @@ -172,6 +172,7 @@ Style/SymbolProc: - 'lib/gitlab/database/migrations/background_migration_helpers.rb' - 'lib/gitlab/database/migrations/instrumentation.rb' - 'lib/gitlab/diff/file_collection/base.rb' + - 'lib/gitlab/diff/rendered/notebook/diff_file_helper.rb' - 'lib/gitlab/git/diff_stats_collection.rb' - 'lib/gitlab/gitaly_client/commit_service.rb' - 'lib/gitlab/gitaly_client/wiki_service.rb' @@ -199,9 +200,9 @@ Style/SymbolProc: - 'qa/qa/resource/project_snippet.rb' - 'qa/qa/runtime/ip_address.rb' - 'qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb' - - 'qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb' + - 'qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb' - 'qa/qa/specs/features/browser_ui/5_package/container_registry/online_garbage_collection_spec.rb' - 'qa/qa/specs/features/ee/browser_ui/12_geo/attachment_replication_spec.rb' - 'qa/qa/specs/features/ee/browser_ui/12_geo/http_push_spec.rb' @@ -219,6 +220,7 @@ Style/SymbolProc: - 'spec/controllers/concerns/product_analytics_tracking_spec.rb' - 'spec/controllers/concerns/redis_tracking_spec.rb' - 'spec/controllers/projects/merge_requests/conflicts_controller_spec.rb' + - 'spec/factories/application_settings.rb' - 'spec/factories/ci/builds.rb' - 'spec/factories/clusters/providers/aws.rb' - 'spec/factories/oauth_openid_requests.rb' @@ -234,16 +236,19 @@ Style/SymbolProc: - 'spec/finders/license_template_finder_spec.rb' - 'spec/finders/packages/go/version_finder_spec.rb' - 'spec/graphql/mutations/releases/create_spec.rb' + - 'spec/graphql/types/work_items/widget_type_enum_spec.rb' - 'spec/helpers/instance_configuration_helper_spec.rb' - 'spec/helpers/learn_gitlab_helper_spec.rb' - 'spec/helpers/members_helper_spec.rb' - 'spec/lib/backup/gitaly_backup_spec.rb' - 'spec/lib/gitlab/database/dynamic_model_helpers_spec.rb' + - 'spec/lib/gitlab/database/loose_foreign_keys_spec.rb' - 'spec/lib/gitlab/database/migration_helpers/loose_foreign_key_helpers_spec.rb' - 'spec/lib/gitlab/git/commit_spec.rb' - 'spec/lib/gitlab/git/repository_spec.rb' - 'spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb' - 'spec/lib/gitlab/graphql/lazy_spec.rb' + - 'spec/lib/gitlab/graphql/markdown_field_spec.rb' - 'spec/lib/gitlab/instrumentation/redis_spec.rb' - 'spec/lib/gitlab/optimistic_locking_spec.rb' - 'spec/lib/gitlab/pagination/keyset/in_operator_optimization/query_builder_spec.rb' @@ -252,12 +257,14 @@ Style/SymbolProc: - 'spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb' - 'spec/lib/omni_auth/strategies/jwt_spec.rb' - 'spec/models/member_spec.rb' + - 'spec/models/merge_request_diff_spec.rb' - 'spec/models/namespace/root_storage_statistics_spec.rb' - 'spec/models/operations/feature_flags/strategy_spec.rb' - 'spec/models/project_statistics_spec.rb' - 'spec/models/repository_spec.rb' - 'spec/models/user_spec.rb' - 'spec/presenters/projects/import_export/project_export_presenter_spec.rb' + - 'spec/requests/api/internal/mail_room_spec.rb' - 'spec/requests/api/snippet_repository_storage_moves_spec.rb' - 'spec/requests/api/tags_spec.rb' - 'spec/services/ci/pipelines/add_job_service_spec.rb' @@ -266,12 +273,14 @@ Style/SymbolProc: - 'spec/services/notification_recipients/builder/default_spec.rb' - 'spec/services/packages/go/create_package_service_spec.rb' - 'spec/services/suggestions/apply_service_spec.rb' + - 'spec/spec_helper.rb' - 'spec/support/generate-seed-repo-rb' - 'spec/support/helpers/filter_spec_helper.rb' - 'spec/support/helpers/migrations_helpers.rb' - 'spec/support/shared_contexts/finders/users_finder_shared_contexts.rb' - 'spec/support/shared_examples/lib/gitlab/ci/ci_trace_shared_examples.rb' - 'spec/support/shared_examples/lib/gitlab/import_export/attributes_permitter_shared_examples.rb' + - 'spec/support/shared_examples/lib/gitlab/search_language_filter_shared_examples.rb' - 'spec/support/shared_examples/models/label_note_shared_examples.rb' - 'spec/views/layouts/_published_experiments.html.haml_spec.rb' - 'spec/workers/snippets/schedule_bulk_repository_shard_moves_worker_spec.rb' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index fc9822ad023..adcb4891d83 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -6bb5f6969910ce5010f1c894ee671a86e656e6da +03a82b12c4f30ff3ffce9ad3332223f104ef7c53 diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 874eb8985fb..5cc0c8f3970 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -88,7 +88,7 @@ class Admin::UsersController < Admin::ApplicationController result = Users::RejectService.new(current_user).execute(user) if result[:status] == :success - redirect_to admin_users_path, status: :found, notice: _("You've rejected %{user}" % { user: user.name }) + redirect_back_or_admin_user(notice: _("You've rejected %{user}" % { user: user.name })) else redirect_back_or_admin_user(alert: result[:message]) end diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 13ebe57a4d9..ce5d0c45a1e 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -365,7 +365,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo end def rebase - @merge_request.rebase_async(current_user.id) + @merge_request.rebase_async(current_user.id, skip_ci: Gitlab::Utils.to_boolean(merge_params[:skip_ci], default: false)) head :ok rescue MergeRequest::RebaseLockTimeout => e diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 93e051776df..84355390ea0 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -184,7 +184,7 @@ module Types end def ci_variables - return unless current_user.can_admin_all_resources? + return unless current_user&.can_admin_all_resources? ::Ci::InstanceVariable.all end diff --git a/app/helpers/admin/identities_helper.rb b/app/helpers/admin/identities_helper.rb new file mode 100644 index 00000000000..8557f322bff --- /dev/null +++ b/app/helpers/admin/identities_helper.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Admin + module IdentitiesHelper + def label_for_identity_provider(identity) + provider = identity.provider + "#{Gitlab::Auth::OAuth::Provider.label_for(provider)} (#{provider})" + end + + def provider_id_cell_testid(identity) + 'provider_id_blank' + end + + def provider_id(identity) + '-' + end + + def saml_group_cell_testid(identity) + 'saml_group_blank' + end + + def saml_group_link(identity) + '-' + end + end +end + +Admin::IdentitiesHelper.prepend_mod diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 32536b38895..b2dd2264046 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -123,7 +123,8 @@ class MergeRequest < ApplicationRecord :force_remove_source_branch, :commit_message, :squash_commit_message, - :sha + :sha, + :skip_ci ].freeze serialize :merge_params, Hash # rubocop:disable Cop/ActiveRecordSerialize diff --git a/app/models/project.rb b/app/models/project.rb index d18ef68fd80..6c99f929237 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -53,6 +53,7 @@ class Project < ApplicationRecord ignore_columns :mirror_last_update_at, :mirror_last_successful_update_at, remove_after: '2021-09-22', remove_with: '14.4' ignore_columns :pull_mirror_branch_prefix, remove_after: '2021-09-22', remove_with: '14.4' + ignore_columns :build_coverage_regex, remove_after: '2022-10-22', remove_with: '15.5' STATISTICS_ATTRIBUTE = 'repositories_count' UNKNOWN_IMPORT_URL = 'http://unknown.git' diff --git a/app/views/admin/application_settings/_repository_storage.html.haml b/app/views/admin/application_settings/_repository_storage.html.haml index 5dc2d322bb3..ff10e4a8f77 100644 --- a/app/views/admin/application_settings/_repository_storage.html.haml +++ b/app/views/admin/application_settings/_repository_storage.html.haml @@ -23,7 +23,7 @@ = link_to s_('Learn more.'), help_page_path('administration/repository_storage_paths.md'), target: '_blank', rel: 'noopener noreferrer' .form-check = f.fields_for :repository_storages_weighted, storage_weights do |storage_form| - - Gitlab.config.repositories.storages.keys.each do |storage| + - Gitlab.config.repositories.storages.each_key do |storage| = storage_form.text_field storage, class: 'form-text-input' = storage_form.label storage, storage, class: 'label-bold form-check-label' %br diff --git a/app/views/admin/application_settings/_whats_new.html.haml b/app/views/admin/application_settings/_whats_new.html.haml index 8ae912d24b7..d82bb1c94e4 100644 --- a/app/views/admin/application_settings/_whats_new.html.haml +++ b/app/views/admin/application_settings/_whats_new.html.haml @@ -1,7 +1,7 @@ = gitlab_ui_form_for @application_setting, url: preferences_admin_application_settings_path(anchor: 'js-whats-new-settings'), html: { class: 'fieldset-form whats-new-settings' } do |f| = form_errors(@application_setting, pajamas_alert: true) - - whats_new_variants.keys.each do |variant| + - whats_new_variants.each_key do |variant| .gl-mb-4 = f.gitlab_ui_radio_component :whats_new_variant, variant, whats_new_variants_label(variant), help_text: whats_new_variants_description(variant) diff --git a/app/views/admin/identities/_identity.html.haml b/app/views/admin/identities/_identity.html.haml index d852e4a2463..3121cd2ae59 100644 --- a/app/views/admin/identities/_identity.html.haml +++ b/app/views/admin/identities/_identity.html.haml @@ -1,12 +1,24 @@ %tr %td - #{Gitlab::Auth::OAuth::Provider.label_for(identity.provider)} (#{identity.provider}) #{identity.saml_provider_id.present? ? "for #{link_to identity.saml_provider.group.path, identity.saml_provider.group} ID: #{identity.saml_provider_id}".html_safe : ""} + = label_for_identity_provider(identity) + %td{ data: { testid: provider_id_cell_testid(identity) } } + = provider_id(identity) + %td{ data: { testid: saml_group_cell_testid(identity) } } + = saml_group_link(identity) %td = identity.extern_uid - %td - = link_to edit_admin_user_identity_path(@user, identity), class: 'gl-button btn btn-sm btn-grouped' do - = _("Edit") - = link_to [:admin, @user, identity], method: :delete, - class: 'gl-button btn btn-sm btn-danger', - data: { confirm: _("Are you sure you want to remove this identity?") } do - = _('Delete') + %td{ class: 'gl-py-0!' } + - button_classes = 'has-tooltip gl-my-3' + = render Pajamas::ButtonComponent.new(category: :tertiary, + href: edit_admin_user_identity_path(@user, identity), + icon: 'pencil', + button_options: { title: _('Edit'), + 'aria-label' => _('Edit'), + class: button_classes } ) + = render Pajamas::ButtonComponent.new(category: :tertiary, + href: url_for([:admin, @user, identity]), + icon: 'remove', + button_options: { title: _('Delete'), + 'aria-label' => _('Delete identity'), + class: button_classes, + data: { method: :delete, confirm: _("Are you sure you want to remove this identity?") } } ) diff --git a/app/views/admin/identities/index.html.haml b/app/views/admin/identities/index.html.haml index 2bab802b2c1..99d5e2a93c4 100644 --- a/app/views/admin/identities/index.html.haml +++ b/app/views/admin/identities/index.html.haml @@ -3,14 +3,18 @@ - page_title _("Identities"), @user.name, _("Users") = render 'admin/users/head' -- if @identities.present? - .table-holder - %table.table - %thead - %tr - %th= _('Provider') - %th= _('Identifier') - %th - = render @identities -- else - %h4= _('This user has no identities') +%table.table.gl-table + %thead + %tr + %th{ class: 'gl-border-t-0!' }= _('Provider') + %th{ class: 'gl-border-t-0!' }= s_('Identity|Provider ID') + %th{ class: 'gl-border-t-0!' }= _('Group') + %th{ class: 'gl-border-t-0!' }= _('Identifier') + %th{ class: 'gl-border-t-0!' }= _('Actions') + = render @identities + - if @identities.blank? + %tbody + %tr + %td{ colspan: '5' } + .text-center.my-2 + = _('This user has no identities') diff --git a/app/views/import/_githubish_status.html.haml b/app/views/import/_githubish_status.html.haml index 08f7cd57732..35fd5d6eda6 100644 --- a/app/views/import/_githubish_status.html.haml +++ b/app/views/import/_githubish_status.html.haml @@ -13,9 +13,9 @@ can_select_namespace: current_user.can_select_namespace?.to_s, ci_cd_only: has_ci_cd_only_params?.to_s, namespaces_path: import_available_namespaces_path, - repos_path: url_for([:status, :import, provider, format: :json]), - jobs_path: url_for([:realtime_changes, :import, provider, format: :json]), + repos_path: url_for([:status, :import, provider, { format: :json }]), + jobs_path: url_for([:realtime_changes, :import, provider, { format: :json }]), default_target_namespace: default_namespace_path, - import_path: url_for([:import, provider, format: :json]), + import_path: url_for([:import, provider, { format: :json }]), filterable: filterable.to_s, paginatable: paginatable.to_s }.merge(extra_data) } diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml index d596199f816..11984a9d6f6 100644 --- a/app/views/projects/diffs/_diffs.html.haml +++ b/app/views/projects/diffs/_diffs.html.haml @@ -11,7 +11,7 @@ .content-block.oneline-block.files-changed.diff-files-changed.js-diff-files-changed .files-changed-inner .inline-parallel-buttons.gl-display-none.gl-md-display-flex - - if !diffs_expanded? && diff_files.any? { |diff_file| diff_file.collapsed? } + - if !diffs_expanded? && diff_files.any?(&:collapsed?) = link_to _('Expand all'), url_for(safe_params.merge(expanded: 1, format: nil)), class: 'gl-button btn btn-default' - if show_whitespace_toggle - if current_controller?(:commit) diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 1c58e94b2b3..bd15a2c10d6 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1551,15 +1551,6 @@ :weight: 1 :idempotent: false :tags: [] -- :name: pipeline_background:archive_trace - :worker_name: ArchiveTraceWorker - :feature_category: :continuous_integration - :has_external_dependencies: false - :urgency: :low - :resource_boundary: :unknown - :weight: 1 - :idempotent: false - :tags: [] - :name: pipeline_background:ci_archive_trace :worker_name: Ci::ArchiveTraceWorker :feature_category: :continuous_integration @@ -1776,15 +1767,6 @@ :weight: 2 :idempotent: false :tags: [] -- :name: pipeline_processing:build_finished - :worker_name: BuildFinishedWorker - :feature_category: :continuous_integration - :has_external_dependencies: false - :urgency: :high - :resource_boundary: :cpu - :weight: 5 - :idempotent: false - :tags: [] - :name: pipeline_processing:build_queue :worker_name: BuildQueueWorker :feature_category: :continuous_integration diff --git a/app/workers/archive_trace_worker.rb b/app/workers/archive_trace_worker.rb deleted file mode 100644 index ecde05f94dc..00000000000 --- a/app/workers/archive_trace_worker.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class ArchiveTraceWorker < ::Ci::ArchiveTraceWorker # rubocop:disable Scalability/IdempotentWorker - # DEPRECATED: Not triggered since https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64934/ -end diff --git a/app/workers/build_finished_worker.rb b/app/workers/build_finished_worker.rb deleted file mode 100644 index 0d41f7b9438..00000000000 --- a/app/workers/build_finished_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class BuildFinishedWorker < ::Ci::BuildFinishedWorker # rubocop:disable Scalability/IdempotentWorker - # DEPRECATED: Not triggered since https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64934/ - - # We need to explicitly specify these settings. They aren't inheriting from the parent class. - urgency :high - worker_resource_boundary :cpu -end diff --git a/config/feature_flags/development/ci_new_public_oss_cost_factor.yml b/config/feature_flags/development/ci_new_public_oss_cost_factor.yml new file mode 100644 index 00000000000..20ab9bd4509 --- /dev/null +++ b/config/feature_flags/development/ci_new_public_oss_cost_factor.yml @@ -0,0 +1,8 @@ +--- +name: ci_new_public_oss_cost_factor +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93046 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/369113 +milestone: '15.3' +type: development +group: group::pipeline execution +default_enabled: false diff --git a/config/feature_flags/development/group_level_protected_environment_settings_permission.yml b/config/feature_flags/development/group_level_protected_environment_settings_permission.yml new file mode 100644 index 00000000000..4fd71b82943 --- /dev/null +++ b/config/feature_flags/development/group_level_protected_environment_settings_permission.yml @@ -0,0 +1,8 @@ +--- +name: group_level_protected_environment_settings_permission +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92801 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/369873 +milestone: '15.3' +type: development +group: group::release +default_enabled: false diff --git a/config/feature_flags/development/override_group_level_protected_environment_settings_permission.yml b/config/feature_flags/development/override_group_level_protected_environment_settings_permission.yml new file mode 100644 index 00000000000..7e7789e2e8f --- /dev/null +++ b/config/feature_flags/development/override_group_level_protected_environment_settings_permission.yml @@ -0,0 +1,8 @@ +--- +name: override_group_level_protected_environment_settings_permission +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92801 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/369875 +milestone: '15.3' +type: development +group: group::release +default_enabled: false diff --git a/config/feature_flags/development/performance_bar_stats.yml b/config/feature_flags/ops/performance_bar_stats.yml similarity index 93% rename from config/feature_flags/development/performance_bar_stats.yml rename to config/feature_flags/ops/performance_bar_stats.yml index 79315050c58..00f2a8eeef8 100644 --- a/config/feature_flags/development/performance_bar_stats.yml +++ b/config/feature_flags/ops/performance_bar_stats.yml @@ -3,6 +3,6 @@ name: performance_bar_stats introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48149 rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/285480 milestone: '13.7' -type: development +type: ops group: group::product_planning default_enabled: false diff --git a/doc/administration/geo/disaster_recovery/planned_failover.md b/doc/administration/geo/disaster_recovery/planned_failover.md index 5a5d896c20a..6c3353e7d7e 100644 --- a/doc/administration/geo/disaster_recovery/planned_failover.md +++ b/doc/administration/geo/disaster_recovery/planned_failover.md @@ -45,7 +45,7 @@ be adapted for use with any other file-based data, such as [GitLab Pages](../../ ### Container registry By default, the container registry is not automatically replicated to secondary -sites and this needs to be manually configured, see [Docker Registry for a secondary site](../replication/docker_registry.md). +sites and this needs to be manually configured, see [Container Registry for a secondary site](../replication/container_registry.md). If you are using local storage on your current primary site for the container registry, you can `rsync` the container registry objects to the secondary diff --git a/doc/administration/geo/index.md b/doc/administration/geo/index.md index cf7d2649142..6056a0c07c3 100644 --- a/doc/administration/geo/index.md +++ b/doc/administration/geo/index.md @@ -283,7 +283,7 @@ For information on using Geo in disaster recovery situations to mitigate data-lo ### Replicating the Container Registry -For more information on how to replicate the Container Registry, see [Docker Registry for a **secondary** site](replication/docker_registry.md). +For more information on how to replicate the Container Registry, see [Container Registry for a **secondary** site](replication/container_registry.md). ### Geo secondary proxy diff --git a/doc/administration/geo/replication/container_registry.md b/doc/administration/geo/replication/container_registry.md new file mode 100644 index 00000000000..b425e5dcc0d --- /dev/null +++ b/doc/administration/geo/replication/container_registry.md @@ -0,0 +1,167 @@ +--- +stage: Systems +group: Geo +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 +type: howto +--- + +# Container Registry for a secondary site **(PREMIUM SELF)** + +You can set up a Container Registry on your **secondary** Geo site that mirrors the one on the **primary** Geo site. + +## Supported container registries + +Geo supports the following types of container registries: + +- [Docker](https://docs.docker.com/registry/) +- [OCI](https://github.com/opencontainers/distribution-spec/blob/main/spec.md) + +## Supported image formats + +The following container image formats are support by Geo: + +- [Docker V2, schema 1](https://docs.docker.com/registry/spec/manifest-v2-1/) +- [Docker V2, schema 2](https://docs.docker.com/registry/spec/manifest-v2-2/) +- [OCI (Open Container Initiative)](https://github.com/opencontainers/image-spec) + +In addition, Geo also supports [BuildKit cache images](https://github.com/moby/buildkit). + +## Supported storage + +### Docker + +For more information on supported registry storage drivers see +[Docker registry storage drivers](https://docs.docker.com/registry/storage-drivers/) + +Read the [Load balancing considerations](https://docs.docker.com/registry/deploying/#load-balancing-considerations) +when deploying the Registry, and how to set up the storage driver for the GitLab integrated +[Container Registry](../../packages/container_registry.md#use-object-storage). + +### Registries that support OCI artifacts + +The following registries support OCI artifacts: + +- CNCF Distribution - local/offline verification +- Azure Container Registry (ACR) +- Amazon Elastic Container Registry (ECR) +- Google Artifact Registry (GAR) +- GitHub Packages container registry (GHCR) +- Bundle Bar + +For more information, see the [OCI Distribution Specification](https://github.com/opencontainers/distribution-spec). + +## Configure Container Registry replication + +You can enable a storage-agnostic replication so it +can be used for cloud or local storage. Whenever a new image is pushed to the +**primary** site, each **secondary** site pulls it to its own container +repository. + +To configure Container Registry replication: + +1. Configure the [**primary** site](#configure-primary-site). +1. Configure the [**secondary** site](#configure-secondary-site). +1. Verify Container Registry [replication](#verify-replication). + +### Configure **primary** site + +Make sure that you have Container Registry set up and working on +the **primary** site before following the next steps. + +We need to make Container Registry send notification events to the +**primary** site. + +1. SSH into your GitLab **primary** server and login as root: + + ```shell + sudo -i + ``` + +1. Edit `/etc/gitlab/gitlab.rb`: + + ```ruby + registry['notifications'] = [ + { + 'name' => 'geo_event', + 'url' => 'https:///api/v4/container_registry_event/events', + 'timeout' => '500ms', + 'threshold' => 5, + 'backoff' => '1s', + 'headers' => { + 'Authorization' => [''] + } + } + ] + ``` + + NOTE: + Replace `` with the `external_url` defined in your primary site's `/etc/gitlab/gitlab.rb` file, and + replace `` with a case sensitive alphanumeric string + that starts with a letter. You can generate one with `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32 | sed "s/^[0-9]*//"; echo` + + NOTE: + If you use an external Registry (not the one integrated with GitLab), you must add + these settings to its configuration yourself. In this case, you also have to specify + notification secret in `registry.notification_secret` section of + `/etc/gitlab/gitlab.rb` file. + + NOTE: + If you use GitLab HA, you also have to specify + the notification secret in `registry.notification_secret` section of + `/etc/gitlab/gitlab.rb` file for every web node. + +1. Reconfigure the **primary** node for the change to take effect: + + ```shell + gitlab-ctl reconfigure + ``` + +### Configure **secondary** site + +Make sure you have Container Registry set up and working on +the **secondary** site before following the next steps. + +The following steps should be done on each **secondary** site you're +expecting to see the container images replicated. + +Because we need to allow the **secondary** site to communicate securely with +the **primary** site Container Registry, we need to have a single key +pair for all the sites. The **secondary** site uses this key to +generate a short-lived JWT that is pull-only-capable to access the +**primary** site Container Registry. + +For each application and Sidekiq node on the **secondary** site: + +1. SSH into the node and login as the `root` user: + + ```shell + sudo -i + ``` + +1. Copy `/var/opt/gitlab/gitlab-rails/etc/gitlab-registry.key` from the **primary** to the node. + +1. Edit `/etc/gitlab/gitlab.rb` and add: + + ```ruby + gitlab_rails['geo_registry_replication_enabled'] = true + + # Primary registry's hostname and port, it will be used by + # the secondary node to directly communicate to primary registry + gitlab_rails['geo_registry_replication_primary_api_url'] = 'https://primary.example.com:5050/' + ``` + +1. Reconfigure the node for the change to take effect: + + ```shell + gitlab-ctl reconfigure + ``` + +### Verify replication + +To verify Container Registry replication is working, on the **secondary** site: + +1. On the top bar, select **Menu > Admin**. +1. On the left sidebar, select **Geo > Nodes**. + The initial replication, or "backfill", is probably still in progress. + +You can monitor the synchronization process on each Geo site from the **primary** site's **Geo Nodes** dashboard in your browser. diff --git a/doc/administration/geo/replication/datatypes.md b/doc/administration/geo/replication/datatypes.md index 4eb7c1c895f..1481d79b81a 100644 --- a/doc/administration/geo/replication/datatypes.md +++ b/doc/administration/geo/replication/datatypes.md @@ -194,7 +194,7 @@ successfully, you must replicate their data using some other means. |[Project snippets](../../../user/snippets.md) | **Yes** (10.2) | **Yes** (10.2) | N/A | N/A | | |[CI job artifacts](../../../ci/pipelines/job_artifacts.md) | **Yes** (10.4) | **Yes** (14.10) | [**Yes** (15.1)](https://gitlab.com/groups/gitlab-org/-/epics/5551) | [No](object_storage.md#verification-of-files-in-object-storage) | Verification is behind the feature flag `geo_job_artifact_replication`, enabled by default in 14.10. | |[CI Pipeline Artifacts](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/ci/pipeline_artifact.rb) | [**Yes** (13.11)](https://gitlab.com/gitlab-org/gitlab/-/issues/238464) | [**Yes** (13.11)](https://gitlab.com/gitlab-org/gitlab/-/issues/238464) | [**Yes** (15.1)](https://gitlab.com/groups/gitlab-org/-/epics/5551) | [No](object_storage.md#verification-of-files-in-object-storage) | Persists additional artifacts after a pipeline completes. | -|[Container Registry](../../packages/container_registry.md) | **Yes** (12.3) | No | No | No | Disabled by default. See [instructions](docker_registry.md) to enable. | +|[Container Registry](../../packages/container_registry.md) | **Yes** (12.3) | No | No | No | Disabled by default. See [instructions](container_registry.md) to enable. | |[Infrastructure Registry](../../../user/packages/infrastructure_registry/index.md) | **Yes** (14.0) | **Yes** (14.0) | [**Yes** (15.1)](https://gitlab.com/groups/gitlab-org/-/epics/5551) | [No](object_storage.md#verification-of-files-in-object-storage) | Behind feature flag `geo_package_file_replication`, enabled by default. | |[Project designs repository](../../../user/project/issues/design_management.md) | **Yes** (12.7) | [No](https://gitlab.com/gitlab-org/gitlab/-/issues/32467) | N/A | N/A | Designs also require replication of LFS objects and Uploads. | |[Package Registry](../../../user/packages/package_registry/index.md) | **Yes** (13.2) | **Yes** (13.10) | [**Yes** (15.1)](https://gitlab.com/groups/gitlab-org/-/epics/5551) | [No](object_storage.md#verification-of-files-in-object-storage) | Behind feature flag `geo_package_file_replication`, enabled by default. | diff --git a/doc/administration/geo/replication/docker_registry.md b/doc/administration/geo/replication/docker_registry.md index 5e1614b5554..8ab30d18c99 100644 --- a/doc/administration/geo/replication/docker_registry.md +++ b/doc/administration/geo/replication/docker_registry.md @@ -1,159 +1,11 @@ --- -stage: Systems -group: Geo -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 -type: howto +redirect_to: 'container_registry.md' +remove_date: '2022-10-29' --- -# Container Registry for a secondary site **(PREMIUM SELF)** +This document was moved to [another location](container_registry.md). -You can set up a Container Registry on your -**secondary** Geo site that mirrors the one on the **primary** Geo site. - -## Registry support - -Geo supports the following type of container registries: - -- [Docker](https://docs.docker.com/registry/) -- [OCI](https://github.com/opencontainers/distribution-spec/blob/main/spec.md) - -## Storage support - -### Docker - -[Docker Registry](https://docs.docker.com/registry/) currently supports a few types of storage. If you choose a -distributed storage (`azure`, `gcs`, `s3`, `swift`, or `oss`) for your Container -Registry on the **primary** site, you can use the same storage for a **secondary** -Container Registry as well. For more information, read the -[Load balancing considerations](https://docs.docker.com/registry/deploying/#load-balancing-considerations) -when deploying the Registry, and how to set up the storage driver for the GitLab -integrated [Container Registry](../../packages/container_registry.md#use-object-storage). - -### Registries that support OCI artifacts - -The following registries support OCI artifacts: - -- CNCF Distribution - local/offline verification -- Azure Container Registry (ACR) -- Amazon Elastic Container Registry (ECR) -- Google Artifact Registry (GAR) -- GitHub Packages container registry (GHCR) -- Bundle Bar - -For more information, see the [OCI Distribution Specification](https://github.com/opencontainers/distribution-spec). - -## Configure Container Registry replication - -You can enable a storage-agnostic replication so it -can be used for cloud or local storage. Whenever a new image is pushed to the -**primary** site, each **secondary** site pulls it to its own container -repository. - -To configure Container Registry replication: - -1. Configure the [**primary** site](#configure-primary-site). -1. Configure the [**secondary** site](#configure-secondary-site). -1. Verify Container Registry [replication](#verify-replication). - -### Configure **primary** site - -Make sure that you have Container Registry set up and working on -the **primary** site before following the next steps. - -We need to make Container Registry send notification events to the -**primary** site. - -1. SSH into your GitLab **primary** server and login as root: - - ```shell - sudo -i - ``` - -1. Edit `/etc/gitlab/gitlab.rb`: - - ```ruby - registry['notifications'] = [ - { - 'name' => 'geo_event', - 'url' => 'https:///api/v4/container_registry_event/events', - 'timeout' => '500ms', - 'threshold' => 5, - 'backoff' => '1s', - 'headers' => { - 'Authorization' => [''] - } - } - ] - ``` - - NOTE: - Replace `` with the `external_url` defined in your primary site's `/etc/gitlab/gitlab.rb` file, and - replace `` with a case sensitive alphanumeric string - that starts with a letter. You can generate one with `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32 | sed "s/^[0-9]*//"; echo` - - NOTE: - If you use an external Registry (not the one integrated with GitLab), you must add - these settings to its configuration yourself. In this case, you also have to specify - notification secret in `registry.notification_secret` section of - `/etc/gitlab/gitlab.rb` file. - - NOTE: - If you use GitLab HA, you also have to specify - the notification secret in `registry.notification_secret` section of - `/etc/gitlab/gitlab.rb` file for every web node. - -1. Reconfigure the **primary** node for the change to take effect: - - ```shell - gitlab-ctl reconfigure - ``` - -### Configure **secondary** site - -Make sure you have Container Registry set up and working on -the **secondary** site before following the next steps. - -The following steps should be done on each **secondary** site you're -expecting to see the container images replicated. - -Because we need to allow the **secondary** site to communicate securely with -the **primary** site Container Registry, we need to have a single key -pair for all the sites. The **secondary** site uses this key to -generate a short-lived JWT that is pull-only-capable to access the -**primary** site Container Registry. - -For each application and Sidekiq node on the **secondary** site: - -1. SSH into the node and login as the `root` user: - - ```shell - sudo -i - ``` - -1. Copy `/var/opt/gitlab/gitlab-rails/etc/gitlab-registry.key` from the **primary** to the node. - -1. Edit `/etc/gitlab/gitlab.rb` and add: - - ```ruby - gitlab_rails['geo_registry_replication_enabled'] = true - - # Primary registry's hostname and port, it will be used by - # the secondary node to directly communicate to primary registry - gitlab_rails['geo_registry_replication_primary_api_url'] = 'https://primary.example.com:5050/' - ``` - -1. Reconfigure the node for the change to take effect: - - ```shell - gitlab-ctl reconfigure - ``` - -### Verify replication - -To verify Container Registry replication is working, on the **secondary** site: - -1. On the top bar, select **Menu > Admin**. -1. On the left sidebar, select **Geo > Nodes**. - The initial replication, or "backfill", is probably still in progress. - -You can monitor the synchronization process on each Geo site from the **primary** site's **Geo Nodes** dashboard in your browser. + + + + diff --git a/doc/administration/geo/replication/faq.md b/doc/administration/geo/replication/faq.md index 8674875673b..7a67af1cfa2 100644 --- a/doc/administration/geo/replication/faq.md +++ b/doc/administration/geo/replication/faq.md @@ -65,9 +65,9 @@ connectivity between your sites, your hardware, and so on. That's totally fine. We use HTTP(s) to fetch repository changes from the **primary** site to all **secondary** sites. -## Is this possible to set up a Docker Registry for a **secondary** site that mirrors the one on the **primary** site? +## Is this possible to set up a Container Registry for a **secondary** site that mirrors the one on the **primary** site? -Yes. See [Docker Registry for a **secondary** site](docker_registry.md). +Yes. See [Container Registry for a **secondary** site](container_registry.md). ## Can you log in to a secondary site? diff --git a/doc/api/projects.md b/doc/api/projects.md index 126507e413e..39cdd81d045 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -48,7 +48,6 @@ GET /projects | Attribute | Type | Required | Description | |--------------------------------------------|----------|------------------------|-------------| | `archived` | boolean | **{dotted-circle}** No | Limit by archived status. | -| `build_coverage_regex` | string | **{dotted-circle}** No | Test coverage parsing. (`deprecated`, it is [scheduled to be removed](https://gitlab.com/gitlab-org/gitlab/-/issues/357401)) | | `id_after` | integer | **{dotted-circle}** No | Limit results to projects with IDs greater than the specified ID. | | `id_before` | integer | **{dotted-circle}** No | Limit results to projects with IDs less than the specified ID. | | `imported` | boolean | **{dotted-circle}** No | Limit results to projects which were imported from external systems by current user. | @@ -228,7 +227,6 @@ When the user is authenticated and `simple` is not set this returns something li "public_jobs": true, "build_timeout": 3600, "auto_cancel_pending_pipelines": "enabled", - "build_coverage_regex": null, "ci_config_path": "", "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, @@ -2699,7 +2697,6 @@ Example response: "public_jobs": true, "build_timeout": 3600, "auto_cancel_pending_pipelines": "enabled", - "build_coverage_regex": null, // deprecated, it is scheduled to be removed https://gitlab.com/gitlab-org/gitlab/-/issues/357401 "ci_config_path": null, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, diff --git a/doc/architecture/blueprints/container_registry_metadata_database/index.md b/doc/architecture/blueprints/container_registry_metadata_database/index.md index 4d2483f8464..125142964b8 100644 --- a/doc/architecture/blueprints/container_registry_metadata_database/index.md +++ b/doc/architecture/blueprints/container_registry_metadata_database/index.md @@ -78,7 +78,7 @@ The single entrypoint for the registry is the [HTTP API](https://gitlab.com/gitl | Operation | UI | Background | Observations | | ------------------------------------------------------------ | ------------------ | ------------------------ | ------------------------------------------------------------ | | [Check API version](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/spec/api.md#api-version-check) | **{check-circle}** Yes | **{check-circle}** Yes | Used globally to ensure that the registry supports the Docker Distribution V2 API, as well as for identifying whether GitLab Rails is talking to the GitLab Container Registry or a third-party one (used to toggle features only available in the former). | -| [List repository tags](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/spec/api.md#listing-image-tags) | **{check-circle}** Yes | **{check-circle}** Yes | Used to list and show tags in the UI. Used to list tags in the background for [cleanup policies](../../../user/packages/container_registry/reduce_container_registry_storage.md#cleanup-policy) and [Geo replication](../../../administration/geo/replication/docker_registry.md). | +| [List repository tags](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/spec/api.md#listing-image-tags) | **{check-circle}** Yes | **{check-circle}** Yes | Used to list and show tags in the UI. Used to list tags in the background for [cleanup policies](../../../user/packages/container_registry/reduce_container_registry_storage.md#cleanup-policy) and [Geo replication](../../../administration/geo/replication/container_registry.md). | | [Check if manifest exists](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/spec/api.md#existing-manifests) | **{check-circle}** Yes | **{dotted-circle}** No | Used to get the digest of a manifest by tag. This is then used to pull the manifest and show the tag details in the UI. | | [Pull manifest](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/spec/api.md#pulling-an-image-manifest) | **{check-circle}** Yes | **{dotted-circle}** No | Used to show the image size and the manifest digest in the tag details UI. | | [Pull blob](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/spec/api.md#pulling-a-layer) | **{check-circle}** Yes | **{dotted-circle}** No | Used to show the configuration digest and the creation date in the tag details UI. | diff --git a/doc/development/testing_guide/end_to_end/rspec_metadata_tests.md b/doc/development/testing_guide/end_to_end/rspec_metadata_tests.md index 591d03db7b8..322f2412e5b 100644 --- a/doc/development/testing_guide/end_to_end/rspec_metadata_tests.md +++ b/doc/development/testing_guide/end_to_end/rspec_metadata_tests.md @@ -30,6 +30,7 @@ This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec | `:ldap_no_tls` | The test requires a GitLab instance to be configured to use an external LDAP server with TLS not enabled. | | `:ldap_tls` | The test requires a GitLab instance to be configured to use an external LDAP server with TLS enabled. | | `:mattermost` | The test requires a GitLab Mattermost service on the GitLab instance. | +| `:metrics` | The test requires a GitLab instance where [dedicated metrics exporters](../../../administration/monitoring/prometheus/web_exporter.md) are running alongside Puma and Sidekiq. | | `:mixed_env` | The test should only be executed in environments that have a paired canary version available through traffic routing based on the existence of the `gitlab_canary=true` cookie. Tests in this category are switching the cookie mid-test to validate mixed deployment environments. | | `:object_storage` | The test requires a GitLab instance to be configured to use multiple [object storage types](../../../administration/object_storage.md). Uses MinIO as the object storage server. | | `:only` | The test is only to be run in specific execution contexts. See [test execution context selection](execution_context_selection.md) for more information. | diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb index b6d99bb19bd..bdbda5a6477 100644 --- a/lib/api/entities/project.rb +++ b/lib/api/entities/project.rb @@ -111,7 +111,6 @@ module API end expose :build_timeout expose :auto_cancel_pending_pipelines - expose :build_coverage_regex expose :ci_config_path, if: -> (project, options) { Ability.allowed?(options[:current_user], :download_code, project) } expose :shared_with_groups do |project, options| user = options[:current_user] diff --git a/lib/gitlab/import_export/project/import_export.yml b/lib/gitlab/import_export/project/import_export.yml index 1fdc374aa39..4ead49e9c38 100644 --- a/lib/gitlab/import_export/project/import_export.yml +++ b/lib/gitlab/import_export/project/import_export.yml @@ -641,7 +641,6 @@ included_attributes: - :auto_cancel_pending_pipelines - :autoclose_referenced_issues - :build_allow_git_fetch - - :build_coverage_regex - :build_timeout - :delete_error - :description diff --git a/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb b/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb index ac5c907465e..fbc77113875 100644 --- a/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb +++ b/lib/gitlab/performance_bar/redis_adapter_when_peek_enabled.rb @@ -17,7 +17,7 @@ module Gitlab # to a structured log # rubocop:disable Gitlab/ModuleWithInstanceVariables def enqueue_stats_job(request_id) - return unless Feature.enabled?(:performance_bar_stats) + return unless Feature.enabled?(:performance_bar_stats, type: :ops) @client.sadd(GitlabPerformanceBarStatsWorker::STATS_KEY, request_id) diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index 3081202a53e..6c4754ae19f 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -114,6 +114,19 @@ redis_slot: incident_management category: incident_management aggregation: weekly +# Incident management linked resources +- name: incident_management_issuable_resource_link_created + redis_slot: incident_management + category: incident_management + aggregation: weekly +- name: incident_management_issuable_resource_link_deleted + redis_slot: incident_management + category: incident_management + aggregation: weekly +- name: incident_management_issuable_resource_link_visited + redis_slot: incident_management + category: incident_management + aggregation: weekly # Incident management alerts - name: incident_management_alert_create_incident redis_slot: incident_management diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 516a5131c17..3fb1c2b31f7 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -12439,6 +12439,9 @@ msgstr "" msgid "Delete file" msgstr "" +msgid "Delete identity" +msgstr "" + msgid "Delete image" msgstr "" @@ -17095,9 +17098,6 @@ msgstr "" msgid "Geo|In progress" msgstr "" -msgid "Geo|In sync" -msgstr "" - msgid "Geo|Internal URL" msgstr "" @@ -17155,9 +17155,6 @@ msgstr "" msgid "Geo|No available replication slots" msgstr "" -msgid "Geo|Not synced yet" -msgstr "" - msgid "Geo|Nothing found…" msgstr "" @@ -17413,9 +17410,6 @@ msgstr "" msgid "Geo|Unknown" msgstr "" -msgid "Geo|Unknown state" -msgstr "" - msgid "Geo|Updated %{timeAgo}" msgstr "" @@ -19680,6 +19674,9 @@ msgstr "" msgid "IdentityVerification|Your verification code expires after %{expires_in_minutes} minutes." msgstr "" +msgid "Identity|Provider ID" +msgstr "" + msgid "If any indexed field exceeds this limit, it is truncated to this number of characters. The rest of the content is neither indexed nor searchable. This does not apply to repository and wiki indexing. For unlimited characters, set this to 0." msgstr "" diff --git a/qa/qa/scenario/test/integration/metrics.rb b/qa/qa/scenario/test/integration/metrics.rb new file mode 100644 index 00000000000..c1297038a0f --- /dev/null +++ b/qa/qa/scenario/test/integration/metrics.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module QA + module Scenario + module Test + module Integration + class Metrics < Test::Instance::All + tags :metrics + end + end + end + end +end diff --git a/qa/qa/specs/features/api/8_monitor/metrics_spec.rb b/qa/qa/specs/features/api/8_monitor/metrics_spec.rb new file mode 100644 index 00000000000..1235b996958 --- /dev/null +++ b/qa/qa/specs/features/api/8_monitor/metrics_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'GitLab Metrics', :aggregate_failures, :orchestrated, :metrics do + let(:web_uri) { URI.parse(Runtime::Scenario.gitlab_address) } + let(:endpoint) do + "#{web_uri.scheme}://#{web_uri.host}:#{port}#{path}" + end + + let(:response) { RestClient.get(endpoint) } + + describe 'Web metrics' do + describe 'via Rails controller endpoint' do + let(:port) { web_uri.port } + let(:path) { '/-/metrics' } + + it 'returns 200 OK and serves metrics', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/362911' do + # This does not currently work because it requires a special auth token to + # make an internal endpoint request. But we should probably test this, too. + skip + end + end + + describe 'via dedicated server' do + let(:port) { '8083' } + let(:path) { '/metrics' } + + it 'returns 200 OK and serves metrics', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/362912' do + expect(response.code).to be(200) + expect(response.body).to match(/^puma_/) + end + end + end + + describe 'Sidekiq metrics' do + describe 'via dedicated server' do + let(:port) { '8082' } + let(:path) { '/metrics' } + + it 'returns 200 OK and serves metrics', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/362913' do + expect(response.code).to be(200) + expect(response.body).to match(/^sidekiq_/) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb index 6b709a733e6..2c331584cf7 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project transfer between groups' do + describe 'Project transfer between groups', :reliable do let(:source_group) do Resource::Group.fabricate_via_api! do |group| group.path = "source-group-#{SecureRandom.hex(8)}" diff --git a/spec/controllers/admin/identities_controller_spec.rb b/spec/controllers/admin/identities_controller_spec.rb index 6ac5ce13884..e32191e04e7 100644 --- a/spec/controllers/admin/identities_controller_spec.rb +++ b/spec/controllers/admin/identities_controller_spec.rb @@ -9,6 +9,30 @@ RSpec.describe Admin::IdentitiesController do sign_in(admin) end + describe 'GET #index' do + context 'when the user has no identities' do + it 'shows no identities' do + get :index, params: { user_id: admin.username } + + expect(assigns(:user)).to eq(admin) + expect(assigns(:identities)).to be_blank + expect(response).to have_gitlab_http_status(:ok) + end + end + + context 'when the user has identities' do + let(:ldap_user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'ldap-uid') } + + it 'shows identities' do + get :index, params: { user_id: ldap_user.username } + + expect(assigns(:user)).to eq(ldap_user) + expect(assigns(:identities)).to eq(ldap_user.identities) + expect(response).to have_gitlab_http_status(:ok) + end + end + end + describe 'UPDATE identity' do let(:user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'uid=myuser,ou=people,dc=example,dc=com') } diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index e9f0f0c2879..515ad9daf36 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -140,7 +140,7 @@ RSpec.describe Admin::UsersController do it 'displays the rejection message' do subject - expect(response).to redirect_to(admin_users_path) + expect(response).to redirect_to(admin_user_path(user)) expect(flash[:notice]).to eq("You've rejected #{user.name}") end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index a943a5e0205..ed5e32df8ea 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -2036,25 +2036,50 @@ RSpec.describe Projects::MergeRequestsController do end describe 'POST #rebase' do + let(:other_params) { {} } + let(:params) { { namespace_id: project.namespace, project_id: project, id: merge_request }.merge(other_params) } + def post_rebase - post :rebase, params: { namespace_id: project.namespace, project_id: project, id: merge_request } + post :rebase, params: params end before do allow(RebaseWorker).to receive(:with_status).and_return(RebaseWorker) end - def expect_rebase_worker_for(user) - expect(RebaseWorker).to receive(:perform_async).with(merge_request.id, user.id, false) + def expect_rebase_worker_for(user, skip_ci: false) + expect(RebaseWorker).to receive(:perform_async).with(merge_request.id, user.id, skip_ci) end context 'successfully' do - it 'enqeues a RebaseWorker' do - expect_rebase_worker_for(user) + shared_examples 'successful rebase scheduler' do + it 'enqueues a RebaseWorker' do + expect_rebase_worker_for(user, skip_ci: skip_ci) - post_rebase + post_rebase - expect(response).to have_gitlab_http_status(:ok) + expect(response).to have_gitlab_http_status(:ok) + end + end + + context 'with skip_ci not specified' do + let(:skip_ci) { false } + + it_behaves_like 'successful rebase scheduler' + end + + context 'with skip_ci enabled' do + let(:skip_ci) { true } + let(:other_params) { { skip_ci: 'true' } } + + it_behaves_like 'successful rebase scheduler' + end + + context 'with skip_ci disabled' do + let(:skip_ci) { false } + let(:other_params) { { skip_ci: 'false' } } + + it_behaves_like 'successful rebase scheduler' end end diff --git a/spec/frontend/lib/utils/recurrence_spec.js b/spec/frontend/lib/utils/recurrence_spec.js index fc22529dffc..8bf3ea4e25a 100644 --- a/spec/frontend/lib/utils/recurrence_spec.js +++ b/spec/frontend/lib/utils/recurrence_spec.js @@ -211,9 +211,10 @@ describe('recurrence', () => { describe('eject', () => { it('removes the handler assigned to the particular count slot', () => { - recurInstance.handle(1, jest.fn()); + const func = jest.fn(); + recurInstance.handle(1, func); - expect(recurInstance.handlers[1]).toBeTruthy(); + expect(recurInstance.handlers[1]).toStrictEqual(func); recurInstance.eject(1); diff --git a/spec/frontend/lib/utils/sticky_spec.js b/spec/frontend/lib/utils/sticky_spec.js index 01e8fe777af..ec9e746c838 100644 --- a/spec/frontend/lib/utils/sticky_spec.js +++ b/spec/frontend/lib/utils/sticky_spec.js @@ -34,13 +34,13 @@ describe('sticky', () => { isSticky(el, 0, el.offsetTop); isSticky(el, 0, el.offsetTop); - expect(el.classList.contains('is-stuck')).toBeTruthy(); + expect(el.classList.contains('is-stuck')).toBe(true); }); it('adds is-stuck class', () => { isSticky(el, 0, el.offsetTop); - expect(el.classList.contains('is-stuck')).toBeTruthy(); + expect(el.classList.contains('is-stuck')).toBe(true); }); it('inserts placeholder element', () => { @@ -64,7 +64,7 @@ describe('sticky', () => { it('does not add is-stuck class', () => { isSticky(el, 0, 0); - expect(el.classList.contains('is-stuck')).toBeFalsy(); + expect(el.classList.contains('is-stuck')).toBe(false); }); it('removes placeholder', () => { diff --git a/spec/frontend/pipeline_wizard/components/editor_spec.js b/spec/frontend/pipeline_wizard/components/editor_spec.js index 446412a4f02..540a08d2c7f 100644 --- a/spec/frontend/pipeline_wizard/components/editor_spec.js +++ b/spec/frontend/pipeline_wizard/components/editor_spec.js @@ -42,7 +42,7 @@ describe('Pages Yaml Editor wrapper', () => { it('does not cause the touch event to be emitted', () => { wrapper.setProps({ doc }); - expect(wrapper.emitted('touch')).not.toBeTruthy(); + expect(wrapper.emitted('touch')).toBeUndefined(); }); }); @@ -63,7 +63,7 @@ describe('Pages Yaml Editor wrapper', () => { it('emits touch if content is changed in editor', async () => { await wrapper.vm.editor.setValue('foo: boo'); - expect(wrapper.emitted('touch')).toBeTruthy(); + expect(wrapper.emitted('touch')).toEqual([expect.any(Array)]); }); }); }); diff --git a/spec/frontend/projects/commits/components/author_select_spec.js b/spec/frontend/projects/commits/components/author_select_spec.js index 7c5a4f980ee..436262ff461 100644 --- a/spec/frontend/projects/commits/components/author_select_spec.js +++ b/spec/frontend/projects/commits/components/author_select_spec.js @@ -71,7 +71,7 @@ describe('Author Select', () => { wrapper.setData({ hasSearchParam: true }); await nextTick(); - expect(findDropdownContainer().attributes('disabled')).toBeFalsy(); + expect(findDropdownContainer().attributes('disabled')).toBe(undefined); }); it('has correct tooltip message', async () => { @@ -91,13 +91,13 @@ describe('Author Select', () => { wrapper.setData({ hasSearchParam: false }); await nextTick(); - expect(findDropdown().attributes('disabled')).toBeFalsy(); + expect(findDropdown().attributes('disabled')).toBe(undefined); }); it('hasSearchParam if user types a truthy string', () => { wrapper.vm.setSearchParam('false'); - expect(wrapper.vm.hasSearchParam).toBeTruthy(); + expect(wrapper.vm.hasSearchParam).toBe(true); }); }); diff --git a/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js b/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js index 0e1c38437f0..c9aca01083d 100644 --- a/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/states/merge_failed_pipeline_confirmation_dialog_spec.js @@ -50,7 +50,7 @@ describe('MergeFailedPipelineConfirmationDialog', () => { it('should emit the mergeWithFailedPipeline event', () => { findMergeBtn().vm.$emit('click'); - expect(wrapper.emitted('mergeWithFailedPipeline')).toBeTruthy(); + expect(wrapper.emitted('mergeWithFailedPipeline')).toHaveLength(1); }); it('when the cancel button is clicked should emit cancel and call hide', () => { @@ -58,14 +58,14 @@ describe('MergeFailedPipelineConfirmationDialog', () => { findCancelBtn().vm.$emit('click'); - expect(wrapper.emitted('cancel')).toBeTruthy(); + expect(wrapper.emitted('cancel')).toHaveLength(1); expect(findModal().vm.hide).toHaveBeenCalled(); }); it('should emit cancel when the hide event is emitted', () => { findModal().vm.$emit('hide'); - expect(wrapper.emitted('cancel')).toBeTruthy(); + expect(wrapper.emitted('cancel')).toHaveLength(1); }); it('when modal is shown it will focus the cancel button', () => { diff --git a/spec/helpers/admin/identities_helper_spec.rb b/spec/helpers/admin/identities_helper_spec.rb new file mode 100644 index 00000000000..f8e56e4f32d --- /dev/null +++ b/spec/helpers/admin/identities_helper_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Admin::IdentitiesHelper do + let_it_be(:user) { create(:user) } + let_it_be(:identity) { create(:identity, provider: 'ldapmain', extern_uid: 'ldap-uid') } + + describe '#label_for_identity_provider' do + it 'shows label for identity provider' do + expect(helper.label_for_identity_provider(identity)).to eq 'ldap (ldapmain)' + end + end + + describe '#provider_id_cell_testid' do + it 'shows blank provider id for data-testid' do + expect(helper.provider_id_cell_testid(identity)).to eq 'provider_id_blank' + end + end + + describe '#provider_id' do + it 'shows no provider id' do + expect(helper.provider_id(identity)).to eq '-' + end + end + + describe '#saml_group_cell_testid' do + it 'shows blank SAML group for data-testid' do + expect(helper.saml_group_cell_testid(identity)).to eq 'saml_group_blank' + end + end + + describe '#saml_group_link' do + it 'shows no link to SAML group' do + expect(helper.saml_group_link(identity)).to eq '-' + end + end +end diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 3ff830b825b..3ebed1096e3 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -521,7 +521,6 @@ Project: - star_count - ci_id - shared_runners_enabled -- build_coverage_regex - build_allow_git_fetchs - build_timeout - pending_delete diff --git a/spec/requests/api/graphql/ci/instance_variables_spec.rb b/spec/requests/api/graphql/ci/instance_variables_spec.rb index 7acf73a4e7a..c5c88697bf4 100644 --- a/spec/requests/api/graphql/ci/instance_variables_spec.rb +++ b/spec/requests/api/graphql/ci/instance_variables_spec.rb @@ -57,4 +57,16 @@ RSpec.describe 'Query.ciVariables' do expect(graphql_data.dig('ciVariables')).to be_nil end end + + context 'when the user is unauthenticated' do + let_it_be(:user) { nil } + + it 'returns nothing' do + create(:ci_instance_variable, value: 'verysecret', masked: true) + + post_graphql(query, current_user: user) + + expect(graphql_data.dig('ciVariables')).to be_nil + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8d86611407e..1b3ff4bf2b9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -334,6 +334,9 @@ RSpec.configure do |config| # See https://docs.gitlab.com/ee/development/feature_flags/#selectively-disable-by-actor stub_feature_flags(legacy_merge_request_state_check_for_merged_result_pipelines: false) + # Will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/369875 + stub_feature_flags(override_group_level_protected_environment_settings_permission: false) + allow(Gitlab::GitalyClient).to receive(:can_use_disk?).and_return(enable_rugged) else unstub_all_feature_flags diff --git a/spec/views/admin/identities/index.html.haml_spec.rb b/spec/views/admin/identities/index.html.haml_spec.rb new file mode 100644 index 00000000000..3e8def003ae --- /dev/null +++ b/spec/views/admin/identities/index.html.haml_spec.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'admin/identities/index.html.haml', :aggregate_failures do + include Admin::IdentitiesHelper + + let_it_be(:ldap_user) { create(:omniauth_user, provider: 'ldapmain', extern_uid: 'ldap-uid') } + + before do + assign(:user, ldap_user) + view.lookup_context.prefixes = ['admin/identities'] + end + + context 'without identities' do + before do + assign(:identities, []) + end + + it 'shows table headers' do + render + + expect(rendered).to include('').exactly(5) + expect(rendered).to include(_('Provider')) + expect(rendered).to include(s_('Identity|Provider ID')) + expect(rendered).to include(_('Group')) + expect(rendered).to include(_('Identifier')) + expect(rendered).to include(_('Actions')) + end + + it 'shows information text' do + render + + expect(rendered).to include('').exactly(1) + expect(rendered).to include(_('This user has no identities')) + end + end + + context 'with LDAP identities' do + before do + assign(:identities, ldap_user.identities) + end + + it 'shows exactly 5 columns' do + render + + expect(rendered).to include('').exactly(5) + end + + it 'shows identity without provider ID or group' do + render + + # Provider + expect(rendered).to include('ldap (ldapmain)') + # Provider ID + expect(rendered).to include('data-testid="provider_id_blank"') + # Group + expect(rendered).to include('data-testid="saml_group_blank"') + # Identifier + expect(rendered).to include('ldap-uid') + end + + it 'shows edit and delete identity buttons' do + render + + expect(rendered).to include("aria-label=\"#{_('Edit')}\"") + expect(rendered).to include("aria-label=\"#{_('Delete identity')}\"") + end + end +end diff --git a/spec/workers/archive_trace_worker_spec.rb b/spec/workers/archive_trace_worker_spec.rb deleted file mode 100644 index a9f256b1b3b..00000000000 --- a/spec/workers/archive_trace_worker_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe ArchiveTraceWorker do - describe '#perform' do - subject { described_class.new.perform(job&.id) } - - context 'when job is found' do - let(:job) { create(:ci_build, :trace_live) } - - it 'executes service' do - expect_any_instance_of(Ci::ArchiveTraceService) - .to receive(:execute).with(job, anything) - - subject - end - end - - context 'when job is not found' do - let(:job) { nil } - - it 'does not execute service' do - expect_any_instance_of(Ci::ArchiveTraceService) - .not_to receive(:execute) - - subject - end - end - end -end diff --git a/spec/workers/build_finished_worker_spec.rb b/spec/workers/build_finished_worker_spec.rb deleted file mode 100644 index 2ff173c1558..00000000000 --- a/spec/workers/build_finished_worker_spec.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe BuildFinishedWorker do - let(:worker) { described_class.new } - - subject { worker.perform(build.id) } - - describe '#perform' do - context 'when build exists' do - let_it_be(:build) { create(:ci_build, :success, pipeline: create(:ci_pipeline)) } - - before do - expect(Ci::Build).to receive(:find_by).with({ id: build.id }).and_return(build) - end - - it 'calculates coverage and calls hooks', :aggregate_failures do - expect(build).to receive(:update_coverage).ordered - - expect_next_instance_of(Ci::BuildReportResultService) do |build_report_result_service| - expect(build_report_result_service).to receive(:execute).with(build) - end - - expect(BuildHooksWorker).to receive(:perform_async) - expect(ChatNotificationWorker).not_to receive(:perform_async) - expect(Ci::ArchiveTraceWorker).to receive(:perform_in) - - subject - end - - context 'when build is failed' do - before do - build.update!(status: :failed) - end - - it 'adds a todo' do - expect(::Ci::MergeRequests::AddTodoWhenBuildFailsWorker).to receive(:perform_async) - - subject - end - end - - context 'when build has a chat' do - before do - build.pipeline.update!(source: :chat) - end - - it 'schedules a ChatNotification job' do - expect(ChatNotificationWorker).to receive(:perform_async).with(build.id) - - subject - end - end - - context 'when project is deleted' do - before do - allow(build).to receive(:project).and_return(nil) - end - - it 'does no processing' do - expect(worker).not_to receive(:process_build) - - subject - end - end - - context 'when project is pending_delete' do - before do - build.project.update_attribute(:pending_delete, true) - end - - it 'does no processing' do - expect(worker).not_to receive(:process_build) - - subject - end - end - end - - context 'when build does not exist' do - it 'does not raise exception' do - expect { described_class.new.perform(non_existing_record_id) } - .not_to raise_error - end - end - end -end