Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-04-08 12:08:48 +00:00
parent ae6b82598f
commit 88bacc889f
127 changed files with 1396 additions and 370 deletions

View File

@ -11,13 +11,6 @@ Gitlab/PolicyRuleBoolean:
Exclude: Exclude:
- 'ee/app/policies/ee/identity_provider_policy.rb' - 'ee/app/policies/ee/identity_provider_policy.rb'
# Offense count: 170
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented
Layout/MultilineOperationIndentation:
Enabled: false
# Offense count: 754 # Offense count: 754
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle. # Configuration parameters: EnforcedStyle.
@ -25,17 +18,6 @@ Layout/MultilineOperationIndentation:
Layout/SpaceInLambdaLiteral: Layout/SpaceInLambdaLiteral:
Enabled: false Enabled: false
# Offense count: 585
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, no_space
Layout/SpaceInsideParens:
Enabled: false
# Offense count: 84
Lint/ConstantDefinitionInBlock:
Enabled: false
# Offense count: 2 # Offense count: 2
# Configuration parameters: AllowComments. # Configuration parameters: AllowComments.
Lint/EmptyFile: Lint/EmptyFile:

View File

@ -0,0 +1,106 @@
---
# Cop supports --auto-correct.
Layout/MultilineOperationIndentation:
# Offense count: 252
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/controllers/projects/application_controller.rb'
- 'app/controllers/repositories/git_http_client_controller.rb'
- 'app/controllers/sent_notifications_controller.rb'
- 'app/graphql/types/ci/stage_type.rb'
- 'app/helpers/application_settings_helper.rb'
- 'app/helpers/auth_helper.rb'
- 'app/helpers/issuables_helper.rb'
- 'app/helpers/mirror_helper.rb'
- 'app/helpers/packages_helper.rb'
- 'app/helpers/projects_helper.rb'
- 'app/helpers/storage_helper.rb'
- 'app/helpers/visibility_level_helper.rb'
- 'app/helpers/whats_new_helper.rb'
- 'app/models/concerns/admin_changed_password_notifier.rb'
- 'app/models/integrations/prometheus.rb'
- 'app/models/namespaces/traversal/linear_scopes.rb'
- 'app/models/packages/conan/metadatum.rb'
- 'app/models/packages/sem_ver.rb'
- 'app/models/project.rb'
- 'app/models/project_statistics.rb'
- 'app/models/user.rb'
- 'app/services/ci/create_downstream_pipeline_service.rb'
- 'app/services/ci/create_pipeline_service.rb'
- 'app/services/git/branch_hooks_service.rb'
- 'app/services/groups/group_links/create_service.rb'
- 'app/services/groups/transfer_service.rb'
- 'app/services/issues/update_service.rb'
- 'app/services/labels/promote_service.rb'
- 'app/services/labels/transfer_service.rb'
- 'app/services/projects/container_repository/cleanup_tags_service.rb'
- 'app/services/webauthn/authenticate_service.rb'
- 'app/validators/feature_flag_strategies_validator.rb'
- 'app/workers/container_expiration_policies/cleanup_container_repository_worker.rb'
- 'config/initializers/devise_dynamic_password_length_validation.rb'
- 'danger/utility_css/Dangerfile'
- 'ee/app/controllers/smartcard_controller.rb'
- 'ee/app/graphql/resolvers/boards/epic_lists_resolver.rb'
- 'ee/app/helpers/ee/application_settings_helper.rb'
- 'ee/app/helpers/ee/boards_helper.rb'
- 'ee/app/helpers/groups/security_features_helper.rb'
- 'ee/app/helpers/groups/sso_helper.rb'
- 'ee/app/models/ee/namespace.rb'
- 'ee/app/models/ee/namespace/root_storage_size.rb'
- 'ee/app/models/ee/project.rb'
- 'ee/app/models/ee/user.rb'
- 'ee/app/models/vulnerabilities/finding_signature.rb'
- 'ee/app/policies/ee/base_policy.rb'
- 'ee/app/services/analytics/cycle_analytics/value_streams/update_service.rb'
- 'ee/app/services/ee/merge_requests/build_service.rb'
- 'ee/app/services/ee/projects/operations/update_service.rb'
- 'ee/lib/ee/api/entities/group.rb'
- 'ee/lib/ee/api/helpers.rb'
- 'ee/lib/ee/gitlab/middleware/read_only/controller.rb'
- 'ee/lib/ee/gitlab/quick_actions/issue_actions.rb'
- 'ee/lib/ee/sidebars/projects/menus/ci_cd_menu.rb'
- 'ee/lib/ee/sidebars/projects/menus/issues_menu.rb'
- 'ee/lib/elastic/latest/issue_class_proxy.rb'
- 'ee/lib/sidebars/groups/menus/analytics_menu.rb'
- 'ee/lib/sidebars/groups/menus/security_compliance_menu.rb'
- 'ee/spec/services/ci/create_pipeline_service/dast_configuration_spec.rb'
- 'lib/api/maven_packages.rb'
- 'lib/api/users.rb'
- 'lib/api/validations/validators/array_none_any.rb'
- 'lib/gitlab/ci/reports/security/finding_key.rb'
- 'lib/gitlab/database/load_balancing/connection_proxy.rb'
- 'lib/gitlab/database/query_analyzers/prevent_cross_database_modification.rb'
- 'lib/gitlab/elasticsearch/logs/lines.rb'
- 'lib/gitlab/form_builders/gitlab_ui_form_builder.rb'
- 'lib/gitlab/git_access.rb'
- 'lib/gitlab/gl_repository/repo_type.rb'
- 'lib/gitlab/jwt_token.rb'
- 'lib/gitlab/kubernetes/helm/v2/install_command.rb'
- 'lib/gitlab/kubernetes/helm/v2/patch_command.rb'
- 'lib/gitlab/kubernetes/helm/v3/install_command.rb'
- 'lib/gitlab/kubernetes/helm/v3/patch_command.rb'
- 'lib/gitlab/pagination/cursor_based_keyset.rb'
- 'lib/gitlab/quick_actions/issue_and_merge_request_actions.rb'
- 'lib/gitlab/rack_attack/request.rb'
- 'lib/gitlab/x509/signature.rb'
- 'lib/gitlab_edition.rb'
- 'lib/kramdown/converter/commonmark.rb'
- 'lib/sidebars/groups/menus/packages_registries_menu.rb'
- 'lib/sidebars/projects/menus/analytics_menu.rb'
- 'lib/sidebars/projects/menus/deployments_menu.rb'
- 'lib/sidebars/projects/menus/hidden_menu.rb'
- 'lib/sidebars/projects/menus/monitor_menu.rb'
- 'lib/sidebars/projects/menus/settings_menu.rb'
- 'qa/qa/ee/page/group/roadmap.rb'
- 'qa/qa/page/component/snippet.rb'
- 'qa/qa/runtime/api/repository_storage_moves.rb'
- 'rubocop/cop/gitlab/keys_first_and_values_first.rb'
- 'rubocop/cop/migration/hash_index.rb'
- 'rubocop/migration_helpers.rb'
- 'spec/frontend/fixtures/tabs.rb'
- 'spec/lib/gitlab/ci/pipeline/seed/build_spec.rb'
- 'spec/services/ci/create_pipeline_service_spec.rb'
- 'spec/services/projects/import_export/export_service_spec.rb'
- 'spec/support/shared_examples/lib/gitlab/database/background_migration_job_shared_examples.rb'
- 'spec/support/shared_examples/models/with_debian_distributions_shared_examples.rb'

View File

@ -0,0 +1,440 @@
---
# Cop supports --auto-correct.
Layout/SpaceInsideParens:
# Offense count: 701
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/controllers/projects/environments_controller.rb'
- 'app/controllers/projects/pipeline_schedules_controller.rb'
- 'app/graphql/mutations/ci/job/base.rb'
- 'app/helpers/icons_helper.rb'
- 'app/helpers/projects_helper.rb'
- 'app/helpers/reminder_emails_helper.rb'
- 'app/models/alert_management/alert.rb'
- 'app/models/ci/build_metadata.rb'
- 'app/models/concerns/milestoneable.rb'
- 'app/models/concerns/mirror_authentication.rb'
- 'app/models/concerns/protected_ref_access.rb'
- 'app/models/cycle_analytics/project_level_stage_adapter.rb'
- 'app/models/merge_request.rb'
- 'app/models/pages_domain.rb'
- 'app/models/project.rb'
- 'app/services/ci/archive_trace_service.rb'
- 'app/services/jira_import/start_import_service.rb'
- 'app/services/labels/transfer_service.rb'
- 'app/services/packages/debian/create_distribution_service.rb'
- 'app/services/packages/debian/update_distribution_service.rb'
- 'app/services/packages/npm/create_package_service.rb'
- 'app/services/personal_access_tokens/revoke_service.rb'
- 'app/services/snippets/create_service.rb'
- 'app/services/spam/spam_verdict_service.rb'
- 'config/initializers/wikicloth_redos_patch.rb'
- 'db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb'
- 'ee/app/graphql/resolvers/external_issue_resolver.rb'
- 'ee/app/helpers/billing_plans_helper.rb'
- 'ee/app/helpers/ee/boards_helper.rb'
- 'ee/app/models/ee/lfs_object.rb'
- 'ee/app/models/ee/merge_request_diff.rb'
- 'ee/app/models/ee/pages_deployment.rb'
- 'ee/app/models/ee/upload.rb'
- 'ee/app/models/requirements_management/requirement.rb'
- 'ee/app/models/resource_iteration_event.rb'
- 'ee/app/services/compliance_management/frameworks/create_service.rb'
- 'ee/app/services/compliance_management/frameworks/destroy_service.rb'
- 'ee/app/services/compliance_management/frameworks/update_service.rb'
- 'ee/app/services/elastic/cluster_reindexing_service.rb'
- 'ee/app/services/namespaces/check_storage_size_service.rb'
- 'ee/app/services/sitemap/create_service.rb'
- 'ee/lib/ee/gitlab/auth/ldap/access.rb'
- 'ee/lib/gitlab/auth/smartcard/session.rb'
- 'ee/spec/controllers/admin/licenses_controller_spec.rb'
- 'ee/spec/controllers/ee/groups_controller_spec.rb'
- 'ee/spec/controllers/groups/analytics/productivity_analytics_controller_spec.rb'
- 'ee/spec/controllers/projects/issues_controller_spec.rb'
- 'ee/spec/controllers/projects/merge_requests/creations_controller_spec.rb'
- 'ee/spec/controllers/projects/merge_requests_controller_spec.rb'
- 'ee/spec/controllers/projects/security/vulnerabilities_controller_spec.rb'
- 'ee/spec/controllers/projects/settings/operations_controller_spec.rb'
- 'ee/spec/features/account_recovery_regular_check_spec.rb'
- 'ee/spec/features/billings/billing_plans_spec.rb'
- 'ee/spec/features/boards/board_filters_spec.rb'
- 'ee/spec/features/boards/group_boards/board_deletion_spec.rb'
- 'ee/spec/features/boards/user_visits_board_spec.rb'
- 'ee/spec/features/groups/analytics/ci_cd_analytics_spec.rb'
- 'ee/spec/features/groups/issues_spec.rb'
- 'ee/spec/features/groups/iteration_spec.rb'
- 'ee/spec/features/groups/iterations/user_creates_iteration_in_cadence_spec.rb'
- 'ee/spec/features/groups/iterations/user_edits_iteration_cadence_spec.rb'
- 'ee/spec/features/groups/iterations/user_edits_iteration_spec.rb'
- 'ee/spec/features/merge_request/user_edits_multiple_reviewers_mr_spec.rb'
- 'ee/spec/features/merge_requests/user_resets_approvers_spec.rb'
- 'ee/spec/features/merge_requests/user_views_all_merge_requests_spec.rb'
- 'ee/spec/features/merge_trains/two_merge_requests_on_train_spec.rb'
- 'ee/spec/finders/ee/alert_management/alerts_finder_spec.rb'
- 'ee/spec/finders/ee/alert_management/http_integrations_finder_spec.rb'
- 'ee/spec/finders/epics_finder_spec.rb'
- 'ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb'
- 'ee/spec/frontend/fixtures/analytics/devops_reports/devops_adoption/enabled_namespaces.rb'
- 'ee/spec/frontend/fixtures/epic.rb'
- 'ee/spec/frontend/fixtures/projects.rb'
- 'ee/spec/graphql/ee/resolvers/board_lists_resolver_spec.rb'
- 'ee/spec/graphql/mutations/app_sec/fuzzing/coverage/corpus/create_spec.rb'
- 'ee/spec/graphql/mutations/dast/profiles/create_spec.rb'
- 'ee/spec/graphql/resolvers/epics_resolver_spec.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/drop_invalid_remediations_spec.rb'
- 'ee/spec/lib/ee/gitlab/usage_data_spec.rb'
- 'ee/spec/lib/gitlab/auth/group_saml/auth_hash_spec.rb'
- 'ee/spec/lib/gitlab/auth/group_saml/dynamic_settings_spec.rb'
- 'ee/spec/lib/gitlab/auth/group_saml/group_lookup_spec.rb'
- 'ee/spec/lib/gitlab/auth/otp/session_enforcer_spec.rb'
- 'ee/spec/lib/gitlab/auth/smartcard/ldap_certificate_spec.rb'
- 'ee/spec/lib/gitlab/auth_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/cluster_image_scanning_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/coverage_fuzzing_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/dast_api_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/dast_api_latest_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/dast_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/dast_latest_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/dast_runner_validation_gitlab_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/ci/templates/secure_binaries_ci_yaml_spec.rb'
- 'ee/spec/lib/gitlab/geo/git_ssh_proxy_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/event_spec.rb'
- 'ee/spec/lib/gitlab/graphql/aggregations/epics/lazy_epic_aggregate_spec.rb'
- 'ee/spec/lib/gitlab/status_page/storage/s3_client_spec.rb'
- 'ee/spec/mailers/notify_spec.rb'
- 'ee/spec/migrations/add_non_null_constraint_for_escalation_rule_on_pending_alert_escalations_spec.rb'
- 'ee/spec/migrations/drop_invalid_remediations_spec.rb'
- 'ee/spec/models/allowed_email_domain_spec.rb'
- 'ee/spec/models/boards/epic_board_position_spec.rb'
- 'ee/spec/models/dora/change_failure_rate_metric_spec.rb'
- 'ee/spec/models/ee/integrations/jira_spec.rb'
- 'ee/spec/models/ee/iteration_spec.rb'
- 'ee/spec/models/ee/key_spec.rb'
- 'ee/spec/models/ee/system_note_metadata_spec.rb'
- 'ee/spec/models/geo/every_geo_event_spec.rb'
- 'ee/spec/models/incident_management/escalation_rule_spec.rb'
- 'ee/spec/models/ip_restriction_spec.rb'
- 'ee/spec/models/issue_spec.rb'
- 'ee/spec/models/ldap_group_link_spec.rb'
- 'ee/spec/models/license_spec.rb'
- 'ee/spec/models/member_spec.rb'
- 'ee/spec/models/project_spec.rb'
- 'ee/spec/models/release_highlight_spec.rb'
- 'ee/spec/models/security/orchestration_policy_configuration_spec.rb'
- 'ee/spec/models/vulnerabilities/feedback_spec.rb'
- 'ee/spec/requests/api/boards_spec.rb'
- 'ee/spec/requests/api/epics_spec.rb'
- 'ee/spec/requests/api/graphql/group/epics_spec.rb'
- 'ee/spec/requests/api/graphql/mutations/iterations/update_spec.rb'
- 'ee/spec/requests/api/graphql/projects/compliance_frameworks_spec.rb'
- 'ee/spec/requests/api/group_boards_spec.rb'
- 'ee/spec/requests/api/iterations_spec.rb'
- 'ee/spec/requests/api/ldap_group_links_spec.rb'
- 'ee/spec/requests/api/project_milestones_spec.rb'
- 'ee/spec/requests/customers_dot/proxy_controller_spec.rb'
- 'ee/spec/requests/survey_responses_controller_spec.rb'
- 'ee/spec/serializers/member_user_entity_spec.rb'
- 'ee/spec/services/app_sec/dast/profiles/create_service_spec.rb'
- 'ee/spec/services/app_sec/dast/site_profile_secret_variables/create_or_update_service_spec.rb'
- 'ee/spec/services/app_sec/dast/site_validations/runner_service_spec.rb'
- 'ee/spec/services/app_sec/fuzzing/coverage/corpuses/create_service_spec.rb'
- 'ee/spec/services/ci_cd/github_integration_setup_service_spec.rb'
- 'ee/spec/services/ci_cd/github_setup_service_spec.rb'
- 'ee/spec/services/ee/boards/issues/list_service_spec.rb'
- 'ee/spec/services/ee/notification_service_spec.rb'
- 'ee/spec/services/ee/users/update_service_spec.rb'
- 'ee/spec/services/epic_issues/update_service_spec.rb'
- 'ee/spec/services/geo/container_repository_sync_spec.rb'
- 'ee/spec/services/geo/replication_toggle_request_service_spec.rb'
- 'ee/spec/services/gitlab_subscriptions/create_service_spec.rb'
- 'ee/spec/services/projects/update_mirror_service_spec.rb'
- 'ee/spec/services/search/group_service_spec.rb'
- 'ee/spec/services/search/project_service_spec.rb'
- 'ee/spec/services/security/merge_reports_service_spec.rb'
- 'ee/spec/services/vulnerability_exports/exporters/csv_service_spec.rb'
- 'ee/spec/support/shared_examples/services/geo/geo_request_service_shared_examples.rb'
- 'ee/spec/workers/elastic/migration_worker_spec.rb'
- 'ee/spec/workers/geo/container_repository_sync_dispatch_worker_spec.rb'
- 'ee/spec/workers/security/auto_fix_worker_spec.rb'
- 'ee/spec/workers/security/create_orchestration_policy_worker_spec.rb'
- 'lib/backup/files.rb'
- 'lib/gitlab/ci/reports/security/finding.rb'
- 'lib/gitlab/ci/runner_instructions.rb'
- 'lib/gitlab/database/partitioning/single_numeric_list_partition.rb'
- 'lib/gitlab/database/postgres_hll/buckets.rb'
- 'lib/gitlab/diff/parser.rb'
- 'lib/gitlab/diff/rendered/notebook/diff_file.rb'
- 'lib/gitlab/gitaly_client/commit_service.rb'
- 'lib/gitlab/prometheus_client.rb'
- 'lib/gitlab/sidekiq_daemon/memory_killer.rb'
- 'lib/gitlab/tracking/incident_management.rb'
- 'lib/gitlab/visibility_level.rb'
- 'lib/security/ci_configuration/sast_build_action.rb'
- 'qa/qa/page/group/settings/group_deploy_tokens.rb'
- 'qa/qa/page/merge_request/show.rb'
- 'qa/qa/tools/delete_subgroups.rb'
- 'qa/spec/runtime/feature_spec.rb'
- 'qa/spec/scenario/template_spec.rb'
- 'spec/controllers/boards/issues_controller_spec.rb'
- 'spec/controllers/groups/children_controller_spec.rb'
- 'spec/controllers/groups/registry/repositories_controller_spec.rb'
- 'spec/controllers/groups/releases_controller_spec.rb'
- 'spec/controllers/groups/runners_controller_spec.rb'
- 'spec/controllers/groups_controller_spec.rb'
- 'spec/controllers/omniauth_callbacks_controller_spec.rb'
- 'spec/controllers/projects/environments_controller_spec.rb'
- 'spec/controllers/projects/issues_controller_spec.rb'
- 'spec/controllers/projects/registry/repositories_controller_spec.rb'
- 'spec/controllers/projects/runners_controller_spec.rb'
- 'spec/dependencies/omniauth_saml_spec.rb'
- 'spec/factories/usage_data.rb'
- 'spec/features/admin/admin_runners_spec.rb'
- 'spec/features/boards/board_filters_spec.rb'
- 'spec/features/boards/user_visits_board_spec.rb'
- 'spec/features/dashboard/datetime_on_tooltips_spec.rb'
- 'spec/features/graphql_known_operations_spec.rb'
- 'spec/features/groups/activity_spec.rb'
- 'spec/features/groups/board_sidebar_spec.rb'
- 'spec/features/groups/empty_states_spec.rb'
- 'spec/features/groups/issues_spec.rb'
- 'spec/features/groups/milestone_spec.rb'
- 'spec/features/groups/milestones_sorting_spec.rb'
- 'spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb'
- 'spec/features/merge_request/user_edits_assignees_sidebar_spec.rb'
- 'spec/features/profiles/two_factor_auths_spec.rb'
- 'spec/features/projects/branches/user_views_branches_spec.rb'
- 'spec/features/projects/fork_spec.rb'
- 'spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb'
- 'spec/features/projects/jobs_spec.rb'
- 'spec/features/projects/pipeline_schedules_spec.rb'
- 'spec/features/projects/releases/user_views_edit_release_spec.rb'
- 'spec/features/projects/releases/user_views_releases_spec.rb'
- 'spec/finders/alert_management/http_integrations_finder_spec.rb'
- 'spec/finders/events_finder_spec.rb'
- 'spec/finders/labels_finder_spec.rb'
- 'spec/frontend/fixtures/api_merge_requests.rb'
- 'spec/frontend/fixtures/api_projects.rb'
- 'spec/frontend/fixtures/application_settings.rb'
- 'spec/frontend/fixtures/blob.rb'
- 'spec/frontend/fixtures/branches.rb'
- 'spec/frontend/fixtures/clusters.rb'
- 'spec/frontend/fixtures/deploy_keys.rb'
- 'spec/frontend/fixtures/issues.rb'
- 'spec/frontend/fixtures/jobs.rb'
- 'spec/frontend/fixtures/labels.rb'
- 'spec/frontend/fixtures/merge_requests.rb'
- 'spec/frontend/fixtures/merge_requests_diffs.rb'
- 'spec/frontend/fixtures/metrics_dashboard.rb'
- 'spec/frontend/fixtures/pipeline_schedules.rb'
- 'spec/frontend/fixtures/pipelines.rb'
- 'spec/frontend/fixtures/projects.rb'
- 'spec/frontend/fixtures/prometheus_service.rb'
- 'spec/frontend/fixtures/raw.rb'
- 'spec/frontend/fixtures/services.rb'
- 'spec/frontend/fixtures/snippet.rb'
- 'spec/frontend/fixtures/todos.rb'
- 'spec/graphql/mutations/todos/restore_many_spec.rb'
- 'spec/graphql/resolvers/board_list_issues_resolver_spec.rb'
- 'spec/graphql/resolvers/board_lists_resolver_spec.rb'
- 'spec/graphql/resolvers/board_resolver_spec.rb'
- 'spec/graphql/resolvers/boards_resolver_spec.rb'
- 'spec/graphql/resolvers/group_packages_resolver_spec.rb'
- 'spec/graphql/resolvers/projects_resolver_spec.rb'
- 'spec/graphql/resolvers/recent_boards_resolver_spec.rb'
- 'spec/graphql/resolvers/users_resolver_spec.rb'
- 'spec/helpers/badges_helper_spec.rb'
- 'spec/helpers/ci/builds_helper_spec.rb'
- 'spec/helpers/ci/runners_helper_spec.rb'
- 'spec/helpers/dev_ops_report_helper_spec.rb'
- 'spec/helpers/git_helper_spec.rb'
- 'spec/helpers/gitlab_routing_helper_spec.rb'
- 'spec/helpers/gitlab_script_tag_helper_spec.rb'
- 'spec/helpers/tab_helper_spec.rb'
- 'spec/initializers/carrierwave_patch_spec.rb'
- 'spec/initializers/rdoc_segfault_patch_spec.rb'
- 'spec/lib/api/entities/snippet_spec.rb'
- 'spec/lib/banzai/filter/references/alert_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/feature_flag_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/label_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/merge_request_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/references/snippet_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/repository_link_filter_spec.rb'
- 'spec/lib/bitbucket_server/representation/comment_spec.rb'
- 'spec/lib/bulk_imports/common/pipelines/lfs_objects_pipeline_spec.rb'
- 'spec/lib/error_tracking/sentry_client/projects_spec.rb'
- 'spec/lib/error_tracking/sentry_client/repo_spec.rb'
- 'spec/lib/gitlab/app_text_logger_spec.rb'
- 'spec/lib/gitlab/auth/o_auth/auth_hash_spec.rb'
- 'spec/lib/gitlab/auth/o_auth/user_spec.rb'
- 'spec/lib/gitlab/auth/saml/auth_hash_spec.rb'
- 'spec/lib/gitlab/ci/build/image_spec.rb'
- 'spec/lib/gitlab/ci/config/entry/reports_spec.rb'
- 'spec/lib/gitlab/ci/config/entry/trigger_spec.rb'
- 'spec/lib/gitlab/ci/parsers_spec.rb'
- 'spec/lib/gitlab/ci/pipeline/seed/build_spec.rb'
- 'spec/lib/gitlab/ci/reports/security/vulnerability_reports_comparer_spec.rb'
- 'spec/lib/gitlab/ci/reports/test_suite_spec.rb'
- 'spec/lib/gitlab/ci/templates/5_minute_production_app_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/AWS/deploy_ecs_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/Terraform/base_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/Terraform/base_latest_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/flutter_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/kaniko_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/npm_spec.rb'
- 'spec/lib/gitlab/ci/templates/terraform_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb'
- 'spec/lib/gitlab/database/background_migration/batched_job_spec.rb'
- 'spec/lib/gitlab/database/migrations/runner_spec.rb'
- 'spec/lib/gitlab/database/reindexing/reindex_concurrently_spec.rb'
- 'spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb'
- 'spec/lib/gitlab/database_spec.rb'
- 'spec/lib/gitlab/diff/highlight_cache_spec.rb'
- 'spec/lib/gitlab/exclusive_lease_helpers_spec.rb'
- 'spec/lib/gitlab/git/blob_spec.rb'
- 'spec/lib/gitlab/git/commit_spec.rb'
- 'spec/lib/gitlab/git/diff_spec.rb'
- 'spec/lib/gitlab/git/repository_spec.rb'
- 'spec/lib/gitlab/grape_logging/loggers/queue_duration_logger_spec.rb'
- 'spec/lib/gitlab/graphql/lazy_spec.rb'
- 'spec/lib/gitlab/graphql/markdown_field_spec.rb'
- 'spec/lib/gitlab/health_checks/simple_check_shared.rb'
- 'spec/lib/gitlab/highlight_spec.rb'
- 'spec/lib/gitlab/import_export/attributes_permitter_spec.rb'
- 'spec/lib/gitlab/import_export/file_importer_spec.rb'
- 'spec/lib/gitlab/import_export/json/streaming_serializer_spec.rb'
- 'spec/lib/gitlab/import_export/project/export_task_spec.rb'
- 'spec/lib/gitlab/import_export/project/tree_saver_spec.rb'
- 'spec/lib/gitlab/issuables_count_for_state_spec.rb'
- 'spec/lib/gitlab/kubernetes/rollout_status_spec.rb'
- 'spec/lib/gitlab/metrics/dashboard/processor_spec.rb'
- 'spec/lib/gitlab/middleware/same_site_cookies_spec.rb'
- 'spec/lib/gitlab/puma_logging/json_formatter_spec.rb'
- 'spec/lib/gitlab/rack_attack/instrumented_cache_store_spec.rb'
- 'spec/lib/gitlab/redis/cache_spec.rb'
- 'spec/lib/gitlab/redis/queues_spec.rb'
- 'spec/lib/gitlab/redis/shared_state_spec.rb'
- 'spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executed_spec.rb'
- 'spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing_spec.rb'
- 'spec/lib/gitlab/usage/metric_definition_spec.rb'
- 'spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb'
- 'spec/lib/gitlab/usage/metrics/name_suggestion_spec.rb'
- 'spec/lib/gitlab/usage_data_spec.rb'
- 'spec/lib/gitlab/utils/delegator_override/validator_spec.rb'
- 'spec/lib/gitlab/utils/usage_data_spec.rb'
- 'spec/lib/security/ci_configuration/container_scanning_build_action_spec.rb'
- 'spec/lib/security/ci_configuration/sast_build_action_spec.rb'
- 'spec/lib/security/ci_configuration/sast_iac_build_action_spec.rb'
- 'spec/lib/security/ci_configuration/secret_detection_build_action_spec.rb'
- 'spec/mailers/emails/profile_spec.rb'
- 'spec/migrations/20211130165043_backfill_sequence_column_for_sprints_table_spec.rb'
- 'spec/migrations/backfill_issues_upvotes_count_spec.rb'
- 'spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb'
- 'spec/models/ci/build_spec.rb'
- 'spec/models/ci/build_trace_spec.rb'
- 'spec/models/ci/pipeline_spec.rb'
- 'spec/models/ci/trigger_request_spec.rb'
- 'spec/models/clusters/applications/prometheus_spec.rb'
- 'spec/models/deploy_token_spec.rb'
- 'spec/models/environment_spec.rb'
- 'spec/models/environment_status_spec.rb'
- 'spec/models/experiment_spec.rb'
- 'spec/models/exported_protected_branch_spec.rb'
- 'spec/models/group_spec.rb'
- 'spec/models/integrations/jira_spec.rb'
- 'spec/models/member_spec.rb'
- 'spec/models/metrics/dashboard/annotation_spec.rb'
- 'spec/models/namespace_setting_spec.rb'
- 'spec/models/namespace_spec.rb'
- 'spec/models/network/graph_spec.rb'
- 'spec/models/packages/package_spec.rb'
- 'spec/models/project_spec.rb'
- 'spec/models/repository_spec.rb'
- 'spec/models/users/calloutable_spec.rb'
- 'spec/policies/clusters/agent_policy_spec.rb'
- 'spec/presenters/ci/build_presenter_spec.rb'
- 'spec/presenters/packages/conan/package_presenter_spec.rb'
- 'spec/requests/api/boards_spec.rb'
- 'spec/requests/api/ci/runner/jobs_artifacts_spec.rb'
- 'spec/requests/api/ci/runner/jobs_request_post_spec.rb'
- 'spec/requests/api/ci/runners_reset_registration_token_spec.rb'
- 'spec/requests/api/ci/runners_spec.rb'
- 'spec/requests/api/dependency_proxy_spec.rb'
- 'spec/requests/api/deployments_spec.rb'
- 'spec/requests/api/files_spec.rb'
- 'spec/requests/api/go_proxy_spec.rb'
- 'spec/requests/api/graphql/boards/board_list_issues_query_spec.rb'
- 'spec/requests/api/graphql/ci/jobs_spec.rb'
- 'spec/requests/api/graphql/ci/pipelines_spec.rb'
- 'spec/requests/api/graphql/mutations/award_emojis/remove_spec.rb'
- 'spec/requests/api/graphql/mutations/award_emojis/toggle_spec.rb'
- 'spec/requests/api/graphql/mutations/ci/runners_registration_token/reset_spec.rb'
- 'spec/requests/api/group_boards_spec.rb'
- 'spec/requests/api/issues/issues_spec.rb'
- 'spec/requests/api/issues/post_projects_issues_spec.rb'
- 'spec/requests/api/labels_spec.rb'
- 'spec/requests/api/merge_requests_spec.rb'
- 'spec/requests/api/pages/pages_spec.rb'
- 'spec/requests/api/project_milestones_spec.rb'
- 'spec/requests/api/project_snippets_spec.rb'
- 'spec/requests/api/snippets_spec.rb'
- 'spec/requests/api/submodules_spec.rb'
- 'spec/requests/jwt_controller_spec.rb'
- 'spec/requests/projects/merge_requests/diffs_spec.rb'
- 'spec/requests/projects/merge_requests_spec.rb'
- 'spec/requests/projects/releases_controller_spec.rb'
- 'spec/requests/search_controller_spec.rb'
- 'spec/serializers/analytics_build_entity_spec.rb'
- 'spec/serializers/merge_request_user_entity_spec.rb'
- 'spec/services/authorized_project_update/project_create_service_spec.rb'
- 'spec/services/authorized_project_update/project_group_link_create_service_spec.rb'
- 'spec/services/boards/issues/list_service_spec.rb'
- 'spec/services/ci/compare_test_reports_service_spec.rb'
- 'spec/services/ci/pipeline_processing/atomic_processing_service/status_collection_spec.rb'
- 'spec/services/ci/retry_job_service_spec.rb'
- 'spec/services/clusters/gcp/provision_service_spec.rb'
- 'spec/services/clusters/gcp/verify_provision_status_service_spec.rb'
- 'spec/services/groups/destroy_service_spec.rb'
- 'spec/services/groups/update_shared_runners_service_spec.rb'
- 'spec/services/import/gitlab_projects/file_acquisition_strategies/file_upload_spec.rb'
- 'spec/services/issues/export_csv_service_spec.rb'
- 'spec/services/labels/promote_service_spec.rb'
- 'spec/services/members/invite_service_spec.rb'
- 'spec/services/notes/update_service_spec.rb'
- 'spec/services/packages/composer/composer_json_service_spec.rb'
- 'spec/services/packages/npm/create_package_service_spec.rb'
- 'spec/services/projects/lfs_pointers/lfs_download_service_spec.rb'
- 'spec/services/search/group_service_spec.rb'
- 'spec/services/security/merge_reports_service_spec.rb'
- 'spec/services/suggestions/apply_service_spec.rb'
- 'spec/services/system_notes/issuables_service_spec.rb'
- 'spec/services/users/destroy_service_spec.rb'
- 'spec/services/x509_certificate_revoke_service_spec.rb'
- 'spec/support/helpers/database/partitioning_helpers.rb'
- 'spec/support/helpers/dependency_proxy_helpers.rb'
- 'spec/support/helpers/javascript_fixtures_helpers.rb'
- 'spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb'
- 'spec/support/shared_examples/ci/badge_template_shared_examples.rb'
- 'spec/support/shared_examples/controllers/destroy_hook_shared_examples.rb'
- 'spec/support/shared_examples/features/project_features_apply_to_issuables_shared_examples.rb'
- 'spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb'
- 'spec/support/shared_examples/finders/packages/debian/distributions_finder_shared_examples.rb'
- 'spec/support/shared_examples/lib/gitlab/position_formatters_shared_examples.rb'
- 'spec/support/shared_examples/lib/gitlab/sidekiq_middleware/strategy_shared_examples.rb'
- 'spec/support/shared_examples/mailers/notify_shared_examples.rb'
- 'spec/support/shared_examples/models/concerns/integrations/slack_mattermost_notifier_shared_examples.rb'
- 'spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/composer_packages_shared_examples.rb'
- 'spec/support/shared_examples/requests/releases_shared_examples.rb'
- 'spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb'
- 'spec/tasks/gitlab/backup_rake_spec.rb'
- 'spec/tasks/gitlab/db_rake_spec.rb'
- 'spec/validators/devise_email_validator_spec.rb'
- 'spec/views/shared/runners/_runner_details.html.haml_spec.rb'
- 'spec/workers/gitlab/jira_import/stage/import_labels_worker_spec.rb'
- 'spec/workers/pipeline_schedule_worker_spec.rb'
- 'spec/workers/purge_dependency_proxy_cache_worker_spec.rb'
- 'spec/workers/releases/manage_evidence_worker_spec.rb'
- 'spec/workers/run_pipeline_schedule_worker_spec.rb'

View File

@ -0,0 +1,53 @@
---
Lint/ConstantDefinitionInBlock:
# Offense count: 105
# Temporarily disabled due to too many offenses
Enabled: false
Exclude:
- 'app/models/concerns/ignorable_columns.rb'
- 'app/models/concerns/partitioned_table.rb'
- 'app/workers/concerns/worker_context.rb'
- 'config/application.rb'
- 'config/initializers/direct_upload_support.rb'
- 'config/initializers/elastic_client_setup.rb'
- 'ee/app/models/concerns/ee/issuable_link.rb'
- 'ee/app/models/ee/application_setting.rb'
- 'ee/app/models/ee/ci/job_artifact.rb'
- 'ee/app/models/ee/ci/pipeline.rb'
- 'ee/app/models/ee/epic.rb'
- 'ee/app/models/ee/issue.rb'
- 'ee/app/models/ee/merge_request_diff.rb'
- 'ee/app/models/ee/plan.rb'
- 'ee/app/models/ee/project_import_state.rb'
- 'ee/app/models/ee/user.rb'
- 'ee/app/models/ee/vulnerability.rb'
- 'ee/app/presenters/ee/commit_status_presenter.rb'
- 'ee/app/services/ee/notes/quick_actions_service.rb'
- 'ee/lib/ee/api/search.rb'
- 'ee/lib/ee/gitlab/ci/status/build/failed.rb'
- 'ee/lib/gitlab/subscription_portal/clients/rest.rb'
- 'ee/lib/tasks/geo.rake'
- 'ee/spec/db/schema_support.rb'
- 'ee/spec/support/matchers/locked_schema.rb'
- 'lib/api/search.rb'
- 'lib/gitlab/quick_actions/issue_actions.rb'
- 'lib/tasks/cache.rake'
- 'lib/tasks/dev.rake'
- 'lib/tasks/gitlab/docs/compile_deprecations.rake'
- 'lib/tasks/gitlab/graphql.rake'
- 'lib/tasks/gitlab/refresh_project_statistics_build_artifacts_size.rake'
- 'lib/tasks/gitlab/snippets.rake'
- 'lib/tasks/gitlab/tw/codeowners.rake'
- 'lib/tasks/gitlab/update_templates.rake'
- 'lib/tasks/tanuki_emoji.rake'
- 'spec/db/schema_spec.rb'
- 'spec/lib/gitlab/quick_actions/dsl_spec.rb'
- 'spec/lib/marginalia_spec.rb'
- 'spec/mailers/notify_spec.rb'
- 'spec/models/concerns/batch_destroy_dependent_associations_spec.rb'
- 'spec/models/concerns/bulk_insert_safe_spec.rb'
- 'spec/models/concerns/bulk_insertable_associations_spec.rb'
- 'spec/models/concerns/triggerable_hooks_spec.rb'
- 'spec/models/repository_spec.rb'
- 'spec/services/clusters/applications/check_installation_progress_service_spec.rb'
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'

View File

@ -24,7 +24,7 @@ $.fn.renderGFM = function renderGFM() {
const mrPopoverElements = this.find('.gfm-merge_request').get(); const mrPopoverElements = this.find('.gfm-merge_request').get();
if (mrPopoverElements.length) { if (mrPopoverElements.length) {
import(/* webpackChunkName: 'MrPopoverBundle' */ '../../mr_popover') import(/* webpackChunkName: 'MrPopoverBundle' */ '~/mr_popover')
.then(({ default: initMRPopovers }) => { .then(({ default: initMRPopovers }) => {
initMRPopovers(mrPopoverElements); initMRPopovers(mrPopoverElements);
}) })

View File

@ -4,7 +4,7 @@ import { clickCopyToClipboardButton } from '~/behaviors/copy_to_clipboard';
import { getSelectedFragment } from '~/lib/utils/common_utils'; import { getSelectedFragment } from '~/lib/utils/common_utils';
import { isElementVisible } from '~/lib/utils/dom_utils'; import { isElementVisible } from '~/lib/utils/dom_utils';
import { DEBOUNCE_DROPDOWN_DELAY } from '~/vue_shared/components/sidebar/labels_select_widget/constants'; import { DEBOUNCE_DROPDOWN_DELAY } from '~/vue_shared/components/sidebar/labels_select_widget/constants';
import Sidebar from '../../right_sidebar'; import Sidebar from '~/right_sidebar';
import { CopyAsGFM } from '../markdown/copy_as_gfm'; import { CopyAsGFM } from '../markdown/copy_as_gfm';
import { import {
keysFor, keysFor,

View File

@ -1,6 +1,6 @@
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import PdfLab from '../../pdf/index.vue'; import PdfLab from '~/pdf/index.vue';
export default { export default {
components: { components: {

View File

@ -13,7 +13,7 @@ import boardCardInner from 'ee_else_ce/boards/mixins/board_card_inner';
import { isScopedLabel } from '~/lib/utils/common_utils'; import { isScopedLabel } from '~/lib/utils/common_utils';
import { sprintf, __, n__ } from '~/locale'; import { sprintf, __, n__ } from '~/locale';
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue';
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import { ListType } from '../constants'; import { ListType } from '../constants';
import BoardBlockedIcon from './board_blocked_icon.vue'; import BoardBlockedIcon from './board_blocked_icon.vue';
import IssueDueDate from './issue_due_date.vue'; import IssueDueDate from './issue_due_date.vue';

View File

@ -1,6 +1,6 @@
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import eventHub from '../../notes/event_hub'; import eventHub from '~/notes/event_hub';
import Popover from './popover.vue'; import Popover from './popover.vue';
export default { export default {

View File

@ -21,7 +21,7 @@ import MrWidgetHowToMergeModal from '~/vue_merge_request_widget/components/mr_wi
import PanelResizer from '~/vue_shared/components/panel_resizer.vue'; import PanelResizer from '~/vue_shared/components/panel_resizer.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import notesEventHub from '../../notes/event_hub'; import notesEventHub from '~/notes/event_hub';
import { import {
TREE_LIST_WIDTH_STORAGE_KEY, TREE_LIST_WIDTH_STORAGE_KEY,
INITIAL_TREE_WIDTH, INITIAL_TREE_WIDTH,

View File

@ -9,9 +9,9 @@ import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form';
import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue';
import NoPreviewViewer from '~/vue_shared/components/diff_viewer/viewers/no_preview.vue'; import NoPreviewViewer from '~/vue_shared/components/diff_viewer/viewers/no_preview.vue';
import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_diffable.vue'; import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_diffable.vue';
import NoteForm from '../../notes/components/note_form.vue'; import NoteForm from '~/notes/components/note_form.vue';
import eventHub from '../../notes/event_hub'; import eventHub from '~/notes/event_hub';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import { IMAGE_DIFF_POSITION_TYPE } from '../constants'; import { IMAGE_DIFF_POSITION_TYPE } from '../constants';
import { getDiffMode } from '../store/utils'; import { getDiffMode } from '../store/utils';
import DiffDiscussions from './diff_discussions.vue'; import DiffDiscussions from './diff_discussions.vue';

View File

@ -2,7 +2,7 @@
import { GlIcon } from '@gitlab/ui'; import { GlIcon } from '@gitlab/ui';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue'; import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue';
import noteableDiscussion from '../../notes/components/noteable_discussion.vue'; import noteableDiscussion from '~/notes/components/noteable_discussion.vue';
export default { export default {
components: { components: {

View File

@ -17,7 +17,7 @@ import { diffViewerErrors } from '~/ide/constants';
import { scrollToElement } from '~/lib/utils/common_utils'; import { scrollToElement } from '~/lib/utils/common_utils';
import { sprintf } from '~/locale'; import { sprintf } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import notesEventHub from '../../notes/event_hub'; import notesEventHub from '~/notes/event_hub';
import { import {
DIFF_FILE_AUTOMATIC_COLLAPSE, DIFF_FILE_AUTOMATIC_COLLAPSE,

View File

@ -4,13 +4,10 @@ import { s__ } from '~/locale';
import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form';
import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import MultilineCommentForm from '../../notes/components/multiline_comment_form.vue'; import MultilineCommentForm from '~/notes/components/multiline_comment_form.vue';
import { import { commentLineOptions, formatLineRange } from '~/notes/components/multiline_comment_utils';
commentLineOptions, import noteForm from '~/notes/components/note_form.vue';
formatLineRange, import autosave from '~/notes/mixins/autosave';
} from '../../notes/components/multiline_comment_utils';
import noteForm from '../../notes/components/note_form.vue';
import autosave from '../../notes/mixins/autosave';
import { import {
DIFF_NOTE_TYPE, DIFF_NOTE_TYPE,
INLINE_DIFF_LINES_KEY, INLINE_DIFF_LINES_KEY,

View File

@ -13,7 +13,7 @@ import httpStatusCodes from '~/lib/utils/http_status';
import Poll from '~/lib/utils/poll'; import Poll from '~/lib/utils/poll';
import { mergeUrlParams, getLocationHash } from '~/lib/utils/url_utility'; import { mergeUrlParams, getLocationHash } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import notesEventHub from '../../notes/event_hub'; import notesEventHub from '~/notes/event_hub';
import { import {
PARALLEL_DIFF_VIEW_TYPE, PARALLEL_DIFF_VIEW_TYPE,
INLINE_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE,

View File

@ -7,7 +7,7 @@ import {
MR_DIFFS_MARK_DIFF_FILES_END, MR_DIFFS_MARK_DIFF_FILES_END,
MR_DIFFS_MEASURE_FILE_TREE_DONE, MR_DIFFS_MEASURE_FILE_TREE_DONE,
MR_DIFFS_MEASURE_DIFF_FILES_DONE, MR_DIFFS_MEASURE_DIFF_FILES_DONE,
} from '../../performance/constants'; } from '~/performance/constants';
import { import {
EVT_PERF_MARK_FILE_TREE_START, EVT_PERF_MARK_FILE_TREE_START,

View File

@ -1,7 +1,7 @@
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import Translate from '../../vue_shared/translate'; import Translate from '~/vue_shared/translate';
import environmentsFolderApp from './environments_folder_view.vue'; import environmentsFolderApp from './environments_folder_view.vue';
Vue.use(Translate); Vue.use(Translate);

View File

@ -3,8 +3,8 @@
import { GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import timeAgoMixin from '~/vue_shared/mixins/timeago'; import timeAgoMixin from '~/vue_shared/mixins/timeago';
import CiIcon from '../../vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue'; import userAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue';
import { rightSidebarViews } from '../constants'; import { rightSidebarViews } from '../constants';
import IdeStatusList from './ide_status_list.vue'; import IdeStatusList from './ide_status_list.vue';
import IdeStatusMr from './ide_status_mr.vue'; import IdeStatusMr from './ide_status_mr.vue';

View File

@ -1,4 +1,4 @@
import ImageFile from '../../commit/image_file'; import ImageFile from '~/commit/image_file';
import ImageDiff from '../image_diff'; import ImageDiff from '../image_diff';
import ReplacedImageDiff from '../replaced_image_diff'; import ReplacedImageDiff from '../replaced_image_diff';

View File

@ -1,4 +1,4 @@
import '../../webpack'; import '~/webpack';
import setConfigs from '@gitlab/ui/dist/config'; import setConfigs from '@gitlab/ui/dist/config';
import Vue from 'vue'; import Vue from 'vue';

View File

@ -1,8 +1,8 @@
<script> <script>
/* eslint-disable @gitlab/vue-require-i18n-strings */ /* eslint-disable @gitlab/vue-require-i18n-strings */
import { GlPopover, GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui'; import { GlPopover, GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui';
import CiIcon from '../../vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
import timeagoMixin from '../../vue_shared/mixins/timeago'; import timeagoMixin from '~/vue_shared/mixins/timeago';
import { mrStates, humanMRStates } from '../constants'; import { mrStates, humanMRStates } from '../constants';
import query from '../queries/merge_request.query.graphql'; import query from '../queries/merge_request.query.graphql';

View File

@ -6,7 +6,7 @@ import { mapActions } from 'vuex';
import { truncateSha } from '~/lib/utils/text_utility'; import { truncateSha } from '~/lib/utils/text_utility';
import { s__, __, sprintf } from '~/locale'; import { s__, __, sprintf } from '~/locale';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import noteEditedText from './note_edited_text.vue'; import noteEditedText from './note_edited_text.vue';
import noteHeader from './note_header.vue'; import noteHeader from './note_header.vue';

View File

@ -9,7 +9,7 @@ import ImageDiffOverlay from '~/diffs/components/image_diff_overlay.vue';
import { getDiffMode } from '~/diffs/store/utils'; import { getDiffMode } from '~/diffs/store/utils';
import { diffViewerModes } from '~/ide/constants'; import { diffViewerModes } from '~/ide/constants';
import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue';
import { isCollapsed } from '../../diffs/utils/diff_file'; import { isCollapsed } from '~/diffs/utils/diff_file';
const FIRST_CHAR_REGEX = /^(\+|-| )/; const FIRST_CHAR_REGEX = /^(\+|-| )/;

View File

@ -1,6 +1,6 @@
<script> <script>
/* eslint-disable @gitlab/vue-require-i18n-strings */ /* eslint-disable @gitlab/vue-require-i18n-strings */
import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue'; import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
export default { export default {
name: 'EditedNoteText', name: 'EditedNoteText',

View File

@ -8,7 +8,7 @@ import {
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import UserNameWithStatus from '../../sidebar/components/assignees/user_name_with_status.vue'; import UserNameWithStatus from '~/sidebar/components/assignees/user_name_with_status.vue';
import { NOTEABLE_TYPE_MAPPING } from '../constants'; import { NOTEABLE_TYPE_MAPPING } from '../constants';

View File

@ -10,7 +10,7 @@ import { ignoreWhilePending } from '~/lib/utils/ignore_while_pending';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import noteable from '../mixins/noteable'; import noteable from '../mixins/noteable';
import resolvable from '../mixins/resolvable'; import resolvable from '../mixins/resolvable';

View File

@ -1,6 +1,6 @@
import initGitlabVersionCheck from '~/gitlab_version_check'; import initGitlabVersionCheck from '~/gitlab_version_check';
import initAdminStatisticsPanel from '../../admin/statistics_panel/index'; import initAdminStatisticsPanel from '~/admin/statistics_panel/index';
import initVueAlerts from '../../vue_alerts'; import initVueAlerts from '~/vue_alerts';
import initAdmin from './admin'; import initAdmin from './admin';
initVueAlerts(); initVueAlerts();

View File

@ -1,5 +1,5 @@
import ShortcutsNavigation from '../../behaviors/shortcuts/shortcuts_navigation'; import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import initTerraformNotification from '../../projects/terraform_notification'; import initTerraformNotification from '~/projects/terraform_notification';
import { initSidebarTracking } from '../shared/nav/sidebar_tracking'; import { initSidebarTracking } from '../shared/nav/sidebar_tracking';
import Project from './project'; import Project from './project';

View File

@ -9,7 +9,7 @@ import axios from '~/lib/utils/axios_utils';
import { serializeForm } from '~/lib/utils/forms'; import { serializeForm } from '~/lib/utils/forms';
import { mergeUrlParams } from '~/lib/utils/url_utility'; import { mergeUrlParams } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
import projectSelect from '../../project_select'; import projectSelect from '~/project_select';
export default class Project { export default class Project {
constructor() { constructor() {

View File

@ -10,10 +10,10 @@ import {
import defaultAvatarUrl from 'images/no_avatar.png'; import defaultAvatarUrl from 'images/no_avatar.png';
import pathLastCommitQuery from 'shared_queries/repository/path_last_commit.query.graphql'; import pathLastCommitQuery from 'shared_queries/repository/path_last_commit.query.graphql';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import CiIcon from '../../vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
import ClipboardButton from '../../vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import TimeagoTooltip from '../../vue_shared/components/time_ago_tooltip.vue'; import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import getRefMixin from '../mixins/get_ref'; import getRefMixin from '../mixins/get_ref';
import projectPathQuery from '../queries/project_path.query.graphql'; import projectPathQuery from '../queries/project_path.query.graphql';

View File

@ -1,5 +1,5 @@
<script> <script>
import ClipboardButton from '../../vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
export default { export default {
components: { components: {

View File

@ -1,5 +1,5 @@
<script> <script>
import CopyableField from '../../vue_shared/components/sidebar/copyable_field.vue'; import CopyableField from '~/vue_shared/components/sidebar/copyable_field.vue';
export default { export default {
components: { components: {

View File

@ -1,7 +1,7 @@
<script> <script>
import { GlButton, GlLoadingIcon } from '@gitlab/ui'; import { GlButton, GlLoadingIcon } from '@gitlab/ui';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import ciIcon from '../../vue_shared/components/ci_icon.vue'; import ciIcon from '~/vue_shared/components/ci_icon.vue';
export default { export default {
components: { components: {

View File

@ -4,7 +4,7 @@ import { groupBy } from 'lodash';
import EmojiPicker from '~/emoji/components/picker.vue'; import EmojiPicker from '~/emoji/components/picker.vue';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { glEmojiTag } from '../../emoji'; import { glEmojiTag } from '~/emoji';
// Internal constant, specific to this component, used when no `currentUserId` is given // Internal constant, specific to this component, used when no `currentUserId` is given
const NO_USER_ID = -1; const NO_USER_ID = -1;

View File

@ -17,8 +17,10 @@ module Groups
def releases def releases
if Feature.enabled?(:group_releases_finder_inoperator) if Feature.enabled?(:group_releases_finder_inoperator)
Releases::GroupReleasesFinder Releases::GroupReleasesFinder
.new(@group, current_user, { include_subgroups: true, page: params[:page], per: 30 }) .new(@group, current_user)
.execute(preload: false) .execute(preload: false)
.page(params[:page])
.per(30)
else else
ReleasesFinder ReleasesFinder
.new(@group, current_user, { include_subgroups: true }) .new(@group, current_user, { include_subgroups: true })

View File

@ -15,10 +15,7 @@ module Releases
@current_user = current_user @current_user = current_user
@params = params @params = params
params[:order_by] ||= 'released_at'
params[:sort] ||= 'desc' params[:sort] ||= 'desc'
params[:page] ||= 0
params[:per] ||= 30
end end
def execute(preload: true) def execute(preload: true)
@ -26,7 +23,7 @@ module Releases
releases = get_releases releases = get_releases
releases.preloaded if preload releases.preloaded if preload
paginate_releases(releases) releases
end end
private private
@ -46,9 +43,6 @@ module Releases
Release.sort_by_attribute("released_at_#{params[:sort]}").order(id: params[:sort]) Release.sort_by_attribute("released_at_#{params[:sort]}").order(id: params[:sort])
end end
def paginate_releases(releases)
releases.page(params[:page].to_i).per(params[:per])
end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
end end
end end

View File

@ -139,6 +139,10 @@ module WikiHelper
api_v4_projects_wikis_path(wiki_page_render_api_endpoint_params(page)) api_v4_projects_wikis_path(wiki_page_render_api_endpoint_params(page))
end end
def wiki_markup_hash_by_name_id
Wiki::VALID_USER_MARKUPS.map { |key, value| { value[:name] => key } }.reduce({}, :merge)
end
private private
def wiki_page_render_api_endpoint_params(page) def wiki_page_render_api_endpoint_params(page)

View File

@ -4,6 +4,8 @@ module Ci
# This model represents a record in a shadow table of the main database's namespaces table. # This model represents a record in a shadow table of the main database's namespaces table.
# It allows us to navigate the namespace hierarchy on the ci database without resorting to a JOIN. # It allows us to navigate the namespace hierarchy on the ci database without resorting to a JOIN.
class NamespaceMirror < ApplicationRecord class NamespaceMirror < ApplicationRecord
include FromUnion
belongs_to :namespace belongs_to :namespace
scope :by_group_and_descendants, -> (id) do scope :by_group_and_descendants, -> (id) do
@ -14,6 +16,24 @@ module Ci
where('traversal_ids && ARRAY[?]::int[]', ids) where('traversal_ids && ARRAY[?]::int[]', ids)
end end
scope :contains_traversal_ids, -> (traversal_ids) do
mirrors = []
traversal_ids.group_by(&:count).each do |columns_count, traversal_ids_group|
columns = Array.new(columns_count) { |i| "(traversal_ids[#{i + 1}])" }
pairs = traversal_ids_group.map do |ids|
ids = ids.map { |id| Arel::Nodes.build_quoted(id).to_sql }
"(#{ids.join(",")})"
end
# Create condition in format:
# ((traversal_ids[1]),(traversal_ids[2])) IN ((1,2),(2,3))
mirrors << Ci::NamespaceMirror.where("(#{columns.join(",")}) IN (#{pairs.join(",")})") # rubocop:disable GitlabSecurity/SqlInjection
end
self.from_union(mirrors)
end
scope :by_namespace_id, -> (namespace_id) { where(namespace_id: namespace_id) } scope :by_namespace_id, -> (namespace_id) { where(namespace_id: namespace_id) }
class << self class << self

View File

@ -16,6 +16,7 @@ module Ci
validates :file, presence: true, file_size: { maximum: FILE_SIZE_LIMIT } validates :file, presence: true, file_size: { maximum: FILE_SIZE_LIMIT }
validates :checksum, :file_store, :name, :permissions, :project_id, presence: true validates :checksum, :file_store, :name, :permissions, :project_id, presence: true
after_initialize :generate_key_data
before_validation :assign_checksum before_validation :assign_checksum
enum permissions: { read_only: 0, read_write: 1, execute: 2 } enum permissions: { read_only: 0, read_write: 1, execute: 2 }
@ -33,5 +34,11 @@ module Ci
def assign_checksum def assign_checksum
self.checksum = file.checksum if file.present? && file_changed? self.checksum = file.checksum if file.present? && file_changed?
end end
def generate_key_data
return if key_data.present?
self.key_data = SecureRandom.hex(64)
end
end end
end end

View File

@ -11,7 +11,12 @@ module FromSetOperator
raise "Trying to redefine method '#{method(method_name)}'" if methods.include?(method_name) raise "Trying to redefine method '#{method(method_name)}'" if methods.include?(method_name)
define_method(method_name) do |members, remove_duplicates: true, remove_order: true, alias_as: table_name| define_method(method_name) do |members, remove_duplicates: true, remove_order: true, alias_as: table_name|
operator_sql = operator.new(members, remove_duplicates: remove_duplicates, remove_order: remove_order).to_sql operator_sql =
if members.any?
operator.new(members, remove_duplicates: remove_duplicates, remove_order: remove_order).to_sql
else
where("1=0").to_sql
end
from(Arel.sql("(#{operator_sql}) #{alias_as}")) from(Arel.sql("(#{operator_sql}) #{alias_as}"))
end end

View File

@ -2286,17 +2286,20 @@ class User < ApplicationRecord
# to avoid querying descendants since they are already covered # to avoid querying descendants since they are already covered
# by ancestor namespaces. If the FF is not available fallback to # by ancestor namespaces. If the FF is not available fallback to
# inefficient search: https://gitlab.com/gitlab-org/gitlab/-/issues/336436 # inefficient search: https://gitlab.com/gitlab-org/gitlab/-/issues/336436
namespace_ids = unless Feature.enabled?(:use_traversal_ids, default_enabled: :yaml)
if Feature.enabled?(:use_traversal_ids, default_enabled: :yaml) return Ci::NamespaceMirror.contains_any_of_namespaces(search_members.pluck(:source_id))
Group.joins(:all_group_members) end
.merge(search_members)
.shortest_traversal_ids_prefixes
.map(&:last)
else
search_members.pluck(:source_id)
end
Ci::NamespaceMirror.contains_any_of_namespaces(namespace_ids) traversal_ids = Group.joins(:all_group_members)
.merge(search_members)
.shortest_traversal_ids_prefixes
# Use efficient btree index to perform search
if Feature.enabled?(:ci_owned_runners_unnest_index, self, default_enabled: :yaml)
Ci::NamespaceMirror.contains_traversal_ids(traversal_ids)
else
Ci::NamespaceMirror.contains_any_of_namespaces(traversal_ids.map(&:last))
end
end end
end end

View File

@ -10,18 +10,45 @@ class Wiki
extend ActiveModel::Naming extend ActiveModel::Naming
MARKUPS = { # rubocop:disable Style/MultilineIfModifier MARKUPS = { # rubocop:disable Style/MultilineIfModifier
'Markdown' => :markdown, markdown: {
'RDoc' => :rdoc, name: 'Markdown',
'AsciiDoc' => :asciidoc, default_extension: :md,
'Org' => :org created_by_user: true
},
rdoc: {
name: 'RDoc',
default_extension: :rdoc,
created_by_user: true
},
asciidoc: {
name: 'AsciiDoc',
default_extension: :asciidoc,
created_by_user: true
},
org: {
name: 'Org',
default_extension: :org,
created_by_user: true
},
textile: {
name: 'Textile',
default_extension: :textile
},
creole: {
name: 'Creole',
default_extension: :creole
},
rest: {
name: 'reStructuredText',
default_extension: :rst
},
mediawiki: {
name: 'MediaWiki',
default_extension: :mediawiki
}
}.freeze unless defined?(MARKUPS) }.freeze unless defined?(MARKUPS)
DEFAULT_MARKUP_EXTENSIONS = { # rubocop:disable Style/MultilineIfModifier VALID_USER_MARKUPS = MARKUPS.select { |_, v| v[:created_by_user] }.freeze unless defined?(VALID_USER_MARKUPS)
markdown: 'md',
rdoc: 'rdoc',
asciidoc: 'asciidoc',
org: 'org'
}.freeze unless defined?(DEFAULT_MARKUP_EXTENSIONS)
CouldNotCreateWikiError = Class.new(StandardError) CouldNotCreateWikiError = Class.new(StandardError)
@ -355,13 +382,15 @@ class Wiki
end end
def with_valid_format(format, &block) def with_valid_format(format, &block)
unless Wiki::MARKUPS.value?(format.to_sym) default_extension = Wiki::VALID_USER_MARKUPS.dig(format.to_sym, :default_extension).to_s
if default_extension.blank?
@error_message = _('Invalid format selected') @error_message = _('Invalid format selected')
return false return false
end end
yield Wiki::DEFAULT_MARKUP_EXTENSIONS[format.to_sym] yield default_extension
end end
def sluggified_full_path(title, extension) def sluggified_full_path(title, extension)

View File

@ -185,7 +185,7 @@ class WikiPage
# :content - The raw markup content. # :content - The raw markup content.
# :format - Optional symbol representing the # :format - Optional symbol representing the
# content format. Can be any type # content format. Can be any type
# listed in the Wiki::MARKUPS # listed in the Wiki::VALID_USER_MARKUPS
# Hash. # Hash.
# :message - Optional commit message to set on # :message - Optional commit message to set on
# the new page. # the new page.
@ -205,7 +205,7 @@ class WikiPage
# attrs - Hash of attributes to be updated on the page. # attrs - Hash of attributes to be updated on the page.
# :content - The raw markup content to replace the existing. # :content - The raw markup content to replace the existing.
# :format - Optional symbol representing the content format. # :format - Optional symbol representing the content format.
# See Wiki::MARKUPS Hash for available formats. # See Wiki::VALID_USER_MARKUPS Hash for available formats.
# :message - Optional commit message to set on the new version. # :message - Optional commit message to set on the new version.
# :last_commit_sha - Optional last commit sha to validate the page unchanged. # :last_commit_sha - Optional last commit sha to validate the page unchanged.
# :title - The Title (optionally including dir) to replace existing title # :title - The Title (optionally including dir) to replace existing title

View File

@ -184,8 +184,9 @@ class EventCreateService
track_event(event_action: :pushed, event_target: Project, author_id: current_user.id) track_event(event_action: :pushed, event_target: Project, author_id: current_user.id)
if Feature.enabled?(:route_hll_to_snowplow, project, default_enabled: :yaml) namespace = project.namespace
Gitlab::Tracking.event(self.class.to_s, 'action_active_users_project_repo', namespace: project, user: current_user) if Feature.enabled?(:route_hll_to_snowplow, namespace, default_enabled: :yaml)
Gitlab::Tracking.event(self.class.to_s, 'action_active_users_project_repo', namespace: namespace, user: current_user, project: project)
end end
Users::LastPushEventService.new(current_user) Users::LastPushEventService.new(current_user)

View File

@ -10,7 +10,7 @@ module Ci
encrypt(key: :key) encrypt(key: :key)
def key def key
OpenSSL::HMAC.digest('SHA256', Gitlab::Application.secrets.db_key_base, model.project_id.to_s) Digest::SHA256.digest model.key_data
end end
def checksum def checksum

View File

@ -4,8 +4,8 @@
= link_to s_('Nav|Home'), root_path = link_to s_('Nav|Home'), root_path
%li %li
- if current_user - if current_user
= link_to s_('Nav|Sign out and sign in with a different account'), '#', id: 'sign_out_link' = link_to s_('Nav|Sign out and sign in with a different account'), '#', class: 'js-sign-out-link'
%form{ action: destroy_user_session_path, method: :post, id: 'sign_out_form' } %form.js-sign-out-form{ action: destroy_user_session_path, method: :post }
- else - else
= link_to s_('Nav|Sign In / Register'), new_session_path(:user, redirect_to_referer: 'yes') = link_to s_('Nav|Sign In / Register'), new_session_path(:user, redirect_to_referer: 'yes')
%li %li

View File

@ -22,8 +22,8 @@
} }
// We do not have rails_ujs here, so we're manually making a link trigger a form submit. // We do not have rails_ujs here, so we're manually making a link trigger a form submit.
document.getElementById('sign_out_link').addEventListener('click', function(e) { document.querySelector('.js-sign-out-link')?.addEventListener('click', (e) => {
e.preventDefault(); e.preventDefault();
document.getElementById('sign_out_form').submit(); document.querySelector('.js-sign-out-form')?.submit();
}); });
}()); }());

View File

@ -1,5 +1,7 @@
- sort_value = @sort || sort_value_recently_created - sort_value = @sort || sort_value_recently_created
- sort_title = forks_sort_options_hash[sort_value] - excluded_filters = [:state, :scope, :label_name, :milestone_id, :assignee_id, :author_id]
- created_at = { value: sort_value_created_date, text: sort_title_created_date, href: page_filter_path(sort: sort_value_recently_created, without: excluded_filters) }
- activity = { value: sort_value_latest_activity, text: sort_title_latest_activity, href: page_filter_path(sort: sort_value_latest_activity, without: excluded_filters) }
.top-area .top-area
.nav-text .nav-text
@ -14,14 +16,7 @@
.dropdown.gl-display-inline.gl-md-ml-3.issue-sort-dropdown.gl-mt-3.gl-md-mt-0 .dropdown.gl-display-inline.gl-md-ml-3.issue-sort-dropdown.gl-mt-3.gl-md-mt-0
.btn-group{ role: 'group' } .btn-group{ role: 'group' }
.btn-group{ role: 'group' } .btn-group{ role: 'group' }
%button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'gl-button btn btn-default' } = gl_redirect_listbox_tag [created_at, activity], @sort
= sort_title
= sprite_icon('chevron-down', css_class: "dropdown-menu-toggle-icon gl-top-3")
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li
- excluded_filters = [:state, :scope, :label_name, :milestone_id, :assignee_id, :author_id]
= sortable_item(sort_title_created_date, page_filter_path(sort: sort_value_recently_created, without: excluded_filters), sort_title)
= sortable_item(sort_title_latest_activity, page_filter_path(sort: sort_value_latest_activity, without: excluded_filters), sort_title)
= forks_sort_direction_button(sort_value) = forks_sort_direction_button(sort_value)
- if current_user && can?(current_user, :fork_project, @project) - if current_user && can?(current_user, :fork_project, @project)

View File

@ -3,4 +3,4 @@
.gl-mt-3 .gl-mt-3
= form_errors(@page, truncate: :title) = form_errors(@page, truncate: :title)
#js-wiki-form{ data: { page_info: page_info.to_json, format_options: Wiki::MARKUPS.to_json } } #js-wiki-form{ data: { page_info: page_info.to_json, format_options: wiki_markup_hash_by_name_id.to_json } }

View File

@ -0,0 +1,8 @@
---
name: ci_owned_runners_unnest_index
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83843
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/357869
milestone: '14.10'
type: development
group: group::sharding
default_enabled: false

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddKeyDataToSecureFiles < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
unless column_exists? :ci_secure_files, :key_data
add_column :ci_secure_files, :key_data, :text
end
add_text_limit :ci_secure_files, :key_data, 128
end
def down
remove_column :ci_secure_files, :key_data
end
end

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
class AddCiNamespaceMirrorsUnnestIndexOnTraversalIds < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
INDEX_NAME = 'index_ci_namespace_mirrors_on_traversal_ids_unnest'
def up
return if index_exists_by_name?(:ci_namespace_mirrors, INDEX_NAME)
# We add only 4-levels since on average it is not expected that namespaces
# will be so granular beyond this point
disable_statement_timeout do
execute <<-SQL
CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON ci_namespace_mirrors
USING btree ((traversal_ids[1]), (traversal_ids[2]), (traversal_ids[3]), (traversal_ids[4]))
INCLUDE (traversal_ids, namespace_id)
SQL
end
end
def down
remove_concurrent_index_by_name(:ci_namespace_mirrors, INDEX_NAME)
end
end

View File

@ -0,0 +1 @@
8f423af68f25fb58374321eb38ff830fc47237005a23a66f61d5b794d519ef58

View File

@ -0,0 +1 @@
47664025bee8b3728411bde53aa597cb962d859402b0504a1962a3e4f117782f

View File

@ -13038,8 +13038,10 @@ CREATE TABLE ci_secure_files (
name text NOT NULL, name text NOT NULL,
file text NOT NULL, file text NOT NULL,
checksum bytea NOT NULL, checksum bytea NOT NULL,
key_data text,
CONSTRAINT check_320790634d CHECK ((char_length(file) <= 255)), CONSTRAINT check_320790634d CHECK ((char_length(file) <= 255)),
CONSTRAINT check_402c7b4a56 CHECK ((char_length(name) <= 255)) CONSTRAINT check_402c7b4a56 CHECK ((char_length(name) <= 255)),
CONSTRAINT check_7279b4e293 CHECK ((char_length(key_data) <= 128))
); );
CREATE SEQUENCE ci_secure_files_id_seq CREATE SEQUENCE ci_secure_files_id_seq
@ -27033,6 +27035,8 @@ CREATE INDEX index_ci_minutes_additional_packs_on_namespace_id_purchase_xid ON c
CREATE UNIQUE INDEX index_ci_namespace_mirrors_on_namespace_id ON ci_namespace_mirrors USING btree (namespace_id); CREATE UNIQUE INDEX index_ci_namespace_mirrors_on_namespace_id ON ci_namespace_mirrors USING btree (namespace_id);
CREATE INDEX index_ci_namespace_mirrors_on_traversal_ids_unnest ON ci_namespace_mirrors USING btree ((traversal_ids[1]), (traversal_ids[2]), (traversal_ids[3]), (traversal_ids[4])) INCLUDE (traversal_ids, namespace_id);
CREATE UNIQUE INDEX index_ci_namespace_monthly_usages_on_namespace_id_and_date ON ci_namespace_monthly_usages USING btree (namespace_id, date); CREATE UNIQUE INDEX index_ci_namespace_monthly_usages_on_namespace_id_and_date ON ci_namespace_monthly_usages USING btree (namespace_id, date);
CREATE INDEX index_ci_pending_builds_id_on_protected_partial ON ci_pending_builds USING btree (id) WHERE (protected = true); CREATE INDEX index_ci_pending_builds_id_on_protected_partial ON ci_pending_builds USING btree (id) WHERE (protected = true);

View File

@ -24,7 +24,7 @@ full list of reference architectures, see
| Consul<sup>1</sup> | 3 | 2 vCPU, 1.8 GB memory | `n1-highcpu-2` | `c5.large` | `F2s v2` | | Consul<sup>1</sup> | 3 | 2 vCPU, 1.8 GB memory | `n1-highcpu-2` | `c5.large` | `F2s v2` |
| PostgreSQL<sup>1</sup> | 3 | 16 vCPU, 60 GB memory | `n1-standard-16` | `m5.4xlarge` | `D16s v3` | | PostgreSQL<sup>1</sup> | 3 | 16 vCPU, 60 GB memory | `n1-standard-16` | `m5.4xlarge` | `D16s v3` |
| PgBouncer<sup>1</sup> | 3 | 2 vCPU, 1.8 GB memory | `n1-highcpu-2` | `c5.large` | `F2s v2` | | PgBouncer<sup>1</sup> | 3 | 2 vCPU, 1.8 GB memory | `n1-highcpu-2` | `c5.large` | `F2s v2` |
| Internal load balancing node<sup>3</sup> | 1 | 4 vCPU, 3.6GB memory | `n1-highcpu-4` | `c5.large` | `F2s v2` | | Internal load balancing node<sup>3</sup> | 1 | 4 vCPU, 3.6GB memory | `n1-highcpu-4` | `c5.xlarge` | `F4s v2` |
| Redis/Sentinel - Cache<sup>2</sup> | 3 | 4 vCPU, 15 GB memory | `n1-standard-4` | `m5.xlarge` | `D4s v3` | | Redis/Sentinel - Cache<sup>2</sup> | 3 | 4 vCPU, 15 GB memory | `n1-standard-4` | `m5.xlarge` | `D4s v3` |
| Redis/Sentinel - Persistent<sup>2</sup> | 3 | 4 vCPU, 15 GB memory | `n1-standard-4` | `m5.xlarge` | `D4s v3` | | Redis/Sentinel - Persistent<sup>2</sup> | 3 | 4 vCPU, 15 GB memory | `n1-standard-4` | `m5.xlarge` | `D4s v3` |
| Gitaly<sup>5</sup> | 3 | 32 vCPU, 120 GB memory | `n1-standard-32` | `m5.8xlarge` | `D32s v3` | | Gitaly<sup>5</sup> | 3 | 32 vCPU, 120 GB memory | `n1-standard-32` | `m5.8xlarge` | `D32s v3` |

View File

@ -236,57 +236,57 @@ table.test-coverage th {
<th scope="row">1k</th> <th scope="row">1k</th>
<td><a href="https://cloud.google.com/products/calculator#id=a6d6a94a-c7dc-4c22-85c4-7c5747f272ed">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator#id=a6d6a94a-c7dc-4c22-85c4-7c5747f272ed">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=b51f178f4403b69a63f6eb33ea425f82de3bf249">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/1adf30bef7e34ceba9efa97c4470417b">Calculated cost</a></td>
<td></td>
</tr> </tr>
<tr> <tr>
<th scope="row">2k</th> <th scope="row">2k</th>
<td><a href="https://cloud.google.com/products/calculator#id=84d11491-d72a-493c-a16e-650931faa658">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator#id=84d11491-d72a-493c-a16e-650931faa658">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=dce36b5cb6ab25211f74e47233d77f58fefb54e2">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/72764902f3854f798407fb03c3de4b6f">Calculated cost</a></td>
<td></td>
</tr> </tr>
<tr> <tr>
<th scope="row">3k</th> <th scope="row">3k</th>
<td><a href="https://cloud.google.com/products/calculator/#id=ac4838e6-9c40-4a36-ac43-6d1bc1843e08">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator/#id=ac4838e6-9c40-4a36-ac43-6d1bc1843e08">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=b1c5b4e32e990eaeb035a148255132bd28988760">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/0dbfc575051943b9970e5d8ace03680d">Calculated cost</a></td>
<td></td>
</tr> </tr>
<tr> <tr>
<th scope="row">5k</th> <th scope="row">5k</th>
<td><a href="https://cloud.google.com/products/calculator/#id=8742e8ea-c08f-4e0a-b058-02f3a1c38a2f">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator/#id=8742e8ea-c08f-4e0a-b058-02f3a1c38a2f">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=2bf1af883096e6f4c6efddb4f3c35febead7fec2">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/8f618711ffec4b039f1581871ca6a7c9">Calculated cost</a></td>
<td></td>
</tr> </tr>
<tr> <tr>
<th scope="row">10k</th> <th scope="row">10k</th>
<td><a href="https://cloud.google.com/products/calculator#id=e77713f6-dc0b-4bb3-bcef-cea904ac8efd">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator#id=e77713f6-dc0b-4bb3-bcef-cea904ac8efd">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=1d374df13c0f2088d332ab0134f5b1d0f717259e">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/de3da8286dda4d4db1362932bc75410b">Calculated cost</a></td>
<td></td>
</tr> </tr>
<tr> <tr>
<th scope="row">25k</th> <th scope="row">25k</th>
<td><a href="https://cloud.google.com/products/calculator#id=925386e1-c01c-4c0a-8d7d-ebde1824b7b0">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator#id=925386e1-c01c-4c0a-8d7d-ebde1824b7b0">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=46fe6a6e9256d9b7779fae59fbbfa7e836942b7d">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/69724ebd82914a60857da6a3ace05a64">Calculate cost</a></td>
<td></td>
</tr> </tr>
<tr> <tr>
<th scope="row">50k</th> <th scope="row">50k</th>
<td><a href="https://cloud.google.com/products/calculator/#id=8006396b-88ee-40cd-a1c8-77cdefa4d3c8">Calculated cost</a></td> <td><a href="https://cloud.google.com/products/calculator/#id=8006396b-88ee-40cd-a1c8-77cdefa4d3c8">Calculated cost</a></td>
<td></td> <td></td>
<td><a href="https://calculator.aws/#/estimate?id=e15926b1a3c7139e4faf390a3875ff807d2ab91c">Calculated cost</a></td>
<td></td> <td></td>
<td></td> <td><a href="https://azure.com/e/3f973040ebc14023933d35f576c89846">Calculated cost</a></td>
<td></td>
</tr> </tr>
</table> </table>

View File

@ -114,6 +114,7 @@ The following API resources are available in the group context:
| [Group labels](group_labels.md) | `/groups/:id/labels` | | [Group labels](group_labels.md) | `/groups/:id/labels` |
| [Group-level variables](group_level_variables.md) | `/groups/:id/variables` | | [Group-level variables](group_level_variables.md) | `/groups/:id/variables` |
| [Group milestones](group_milestones.md) | `/groups/:id/milestones` | | [Group milestones](group_milestones.md) | `/groups/:id/milestones` |
| [Group releases](group_releases.md) | `/groups/:id/releases`|
| [Group wikis](group_wikis.md) **(PREMIUM)** | `/groups/:id/wikis` | | [Group wikis](group_wikis.md) **(PREMIUM)** | `/groups/:id/wikis` |
| [Invitations](invitations.md) | `/groups/:id/invitations` (also available for projects) | | [Invitations](invitations.md) | `/groups/:id/invitations` (also available for projects) |
| [Issues](issues.md) | `/groups/:id/issues` (also available for projects and standalone) | | [Issues](issues.md) | `/groups/:id/issues` (also available for projects and standalone) |

77
doc/api/group_releases.md Normal file
View File

@ -0,0 +1,77 @@
---
stage: Release
group: Release
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
---
# Group releases API **(FREE)**
Review your groups' [releases](../user/project/releases/index.md) with the REST API.
NOTE:
For information about the project releases API, visit the [Releases API](releases/index.md) page.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](../administration/feature_flags.md) named `group_releases_finder_inoperator`.
## List group releases
Returns a list of group releases.
```plaintext
GET /groups/:id/releases
GET /groups/:id/releases?simple=true
```
Parameters:
| Attribute | Type | Required | Description |
|---------------------|----------------|----------|---------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) owned by the authenticated user. |
| `sort` | string | no | The direction of the order. Either `desc` (default) for descending order or `asc` for ascending order. |
| `simple` | boolean | no | Return only limited fields for each release. |
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/5/releases"
```
Example response:
```json
[
{
"name": "standard release",
"tag_name": "releasetag",
"description": "",
"created_at": "2022-01-10T15:23:15.529Z",
"released_at": "2022-01-10T15:23:15.529Z",
"author": {
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "https://gitlab.com/root"
},
"commit": {
"id": "e8cbb845ae5a53a2fef2938cf63cf82efc10d993",
"short_id": "e8cbb845",
"created_at": "2022-01-10T15:20:29.000+00:00",
"parent_ids": [],
"title": "Update test",
"message": "Update test",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2022-01-10T15:20:29.000+00:00",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2022-01-10T15:20:29.000+00:00",
"trailers": {},
"web_url": "https://gitlab.com/groups/gitlab-org/-/commit/e8cbb845ae5a53a2fef2938cf63cf82efc10d993"
},
"upcoming_release": false,
"commit_path": "/testgroup/test/-/commit/e8cbb845ae5a53a2fef2938cf63cf82efc10d993",
"tag_path": "/testgroup/test/-/tags/testtag"
}
]
```

View File

@ -241,10 +241,10 @@ Get a Release for the given tag.
GET /projects/:id/releases/:tag_name GET /projects/:id/releases/:tag_name
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
| ------------- | -------------- | -------- | ----------------------------------------------------------------------------------- | |----------------------------| -------------- | -------- | ----------------------------------------------------------------------------------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../index.md#namespaced-path-encoding). | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](../index.md#namespaced-path-encoding). |
| `tag_name` | string | yes | The Git tag the release is associated with. | | `tag_name` | string | yes | The Git tag the release is associated with. |
| `include_html_description` | boolean | no | If `true`, a response includes HTML rendered Markdown of the release description. | | `include_html_description` | boolean | no | If `true`, a response includes HTML rendered Markdown of the release description. |
Example request: Example request:

View File

@ -150,7 +150,7 @@ Following the GitLab [Go standards and style guidelines](../../../development/go
The design and development of the registry database adhere to the GitLab [database guidelines](../../../development/database/). Being a Go application, the required tooling to support the database will have to be developed, such as for running database migrations. The design and development of the registry database adhere to the GitLab [database guidelines](../../../development/database/). Being a Go application, the required tooling to support the database will have to be developed, such as for running database migrations.
Running *online* and [*post deployment*](../../../development/post_deployment_migrations.md) migrations is already supported by the registry CLI, as described in the [documentation](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs-gitlab/database-migrations.md). Running *online* and [*post deployment*](../../../development/database/post_deployment_migrations.md) migrations is already supported by the registry CLI, as described in the [documentation](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs-gitlab/database-migrations.md).
#### Partitioning #### Partitioning

View File

@ -615,9 +615,9 @@ Enterprise Edition instance. This has some implications:
migration on the staging environment if you aren't sure. migration on the staging environment if you aren't sure.
1. Categorized correctly: 1. Categorized correctly:
- Regular migrations run before the new code is running on the instance. - Regular migrations run before the new code is running on the instance.
- [Post-deployment migrations](post_deployment_migrations.md) run _after_ - [Post-deployment migrations](database/post_deployment_migrations.md) run _after_
the new code is deployed, when the instance is configured to do that. the new code is deployed, when the instance is configured to do that.
- [Background migrations](background_migrations.md) run in Sidekiq, and - [Background migrations](database/background_migrations.md) run in Sidekiq, and
should only be done for migrations that would take an extreme amount of should only be done for migrations that would take an extreme amount of
time at GitLab.com scale. time at GitLab.com scale.
1. **Sidekiq workers** [cannot change in a backwards-incompatible way](sidekiq/compatibility_across_updates.md): 1. **Sidekiq workers** [cannot change in a backwards-incompatible way](sidekiq/compatibility_across_updates.md):

View File

@ -123,7 +123,7 @@ end
Validating the foreign key scans the whole table and makes sure that each relation is correct. Validating the foreign key scans the whole table and makes sure that each relation is correct.
NOTE: NOTE:
When using [background migrations](../background_migrations.md), foreign key validation should happen in the next GitLab release. When using [background migrations](background_migrations.md), foreign key validation should happen in the next GitLab release.
Migration file for validating the foreign key: Migration file for validating the foreign key:

View File

@ -151,9 +151,9 @@ the whole column type.
You can check the following guides for each specific use case: You can check the following guides for each specific use case:
- [Adding foreign-key constraints](migration_style_guide.md#adding-foreign-key-constraints) - [Adding foreign-key constraints](../migration_style_guide.md#adding-foreign-key-constraints)
- [Adding `NOT NULL` constraints](database/not_null_constraints.md) - [Adding `NOT NULL` constraints](not_null_constraints.md)
- [Adding limits to text columns](database/strings_and_the_text_data_type.md) - [Adding limits to text columns](strings_and_the_text_data_type.md)
## Changing Column Types ## Changing Column Types
@ -240,7 +240,7 @@ migrations](background_migrations.md#cleaning-up).
Adding indexes does not require downtime when `add_concurrent_index` Adding indexes does not require downtime when `add_concurrent_index`
is used. is used.
See also [Migration Style Guide](migration_style_guide.md#adding-indexes) See also [Migration Style Guide](../migration_style_guide.md#adding-indexes)
for more information. for more information.
## Dropping Indexes ## Dropping Indexes
@ -265,7 +265,7 @@ If the table and the ActiveRecord model is not in use yet, removing the old
table and creating a new one is the preferred way to "rename" the table. table and creating a new one is the preferred way to "rename" the table.
Renaming a table is possible without downtime by following our multi-release Renaming a table is possible without downtime by following our multi-release
[rename table process](database/rename_database_tables.md#rename-table-without-downtime). [rename table process](rename_database_tables.md#rename-table-without-downtime).
## Adding Foreign Keys ## Adding Foreign Keys
@ -355,7 +355,7 @@ Check how the migration is performing while it's running. Multiple ways to do th
#### High-level status of batched background migrations #### High-level status of batched background migrations
See how to [check the status of batched background migrations](../update/index.md#checking-for-background-migrations-before-upgrading). See how to [check the status of batched background migrations](../../update/index.md#checking-for-background-migrations-before-upgrading).
#### Query the database #### Query the database

View File

@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Background migrations # Background migrations
Background migrations should be used to perform data migrations whenever a Background migrations should be used to perform data migrations whenever a
migration exceeds [the time limits in our guidelines](migration_style_guide.md#how-long-a-migration-should-take). For example, you can use background migration exceeds [the time limits in our guidelines](../migration_style_guide.md#how-long-a-migration-should-take). For example, you can use background
migrations to migrate data that's stored in a single JSON column migrations to migrate data that's stored in a single JSON column
to a separate table instead. to a separate table instead.
@ -17,9 +17,9 @@ migrations automatically reschedule themselves for a later point in time.
## When To Use Background Migrations ## When To Use Background Migrations
You should use a background migration when you migrate _data_ in tables that have You should use a background migration when you migrate _data_ in tables that have
so many rows that the process would exceed [the time limits in our guidelines](migration_style_guide.md#how-long-a-migration-should-take) if performed using a regular Rails migration. so many rows that the process would exceed [the time limits in our guidelines](../migration_style_guide.md#how-long-a-migration-should-take) if performed using a regular Rails migration.
- Background migrations should be used when migrating data in [high-traffic tables](migration_style_guide.md#high-traffic-tables). - Background migrations should be used when migrating data in [high-traffic tables](../migration_style_guide.md#high-traffic-tables).
- Background migrations may also be used when executing numerous single-row queries - Background migrations may also be used when executing numerous single-row queries
for every item on a large dataset. Typically, for single-record patterns, runtime is for every item on a large dataset. Typically, for single-record patterns, runtime is
largely dependent on the size of the dataset, hence it should be split accordingly largely dependent on the size of the dataset, hence it should be split accordingly
@ -63,7 +63,7 @@ integrity is guaranteed.
All the background migration classes for EE-only features should be present in GitLab CE. All the background migration classes for EE-only features should be present in GitLab CE.
For this purpose, an empty class can be created for GitLab CE, and it can be extended for GitLab EE For this purpose, an empty class can be created for GitLab CE, and it can be extended for GitLab EE
as explained in the [guidelines for implementing Enterprise Edition features](ee_features.md#code-in-libgitlabbackground_migration). as explained in the [guidelines for implementing Enterprise Edition features](../ee_features.md#code-in-libgitlabbackground_migration).
## How It Works ## How It Works
@ -168,7 +168,7 @@ roughly be as follows:
the `delete_tracking_jobs: false` parameter. the `delete_tracking_jobs: false` parameter.
1. Remove the old column. 1. Remove the old column.
This may also require a bump to the [import/export version](../user/project/settings/import_export.md), if This may also require a bump to the [import/export version](../../user/project/settings/import_export.md), if
importing a project from a prior version of GitLab requires the data to be in importing a project from a prior version of GitLab requires the data to be in
the new format. the new format.
@ -298,7 +298,7 @@ It is required to write tests for:
The `:migration` and `schema: :latest` RSpec tags are automatically set for The `:migration` and `schema: :latest` RSpec tags are automatically set for
background migration specs. background migration specs.
See the See the
[Testing Rails migrations](testing_guide/testing_migrations_guide.md#testing-a-non-activerecordmigration-class) [Testing Rails migrations](../testing_guide/testing_migrations_guide.md#testing-a-non-activerecordmigration-class)
style guide. style guide.
Keep in mind that `before` and `after` RSpec hooks are going Keep in mind that `before` and `after` RSpec hooks are going
@ -359,9 +359,9 @@ A strategy to make the migration run faster is to schedule larger batches, and t
within the background migration to perform multiple statements. within the background migration to perform multiple statements.
The background migration helpers that queue multiple jobs such as The background migration helpers that queue multiple jobs such as
`queue_background_migration_jobs_by_range_at_intervals` use [`EachBatch`](iterating_tables_in_batches.md). `queue_background_migration_jobs_by_range_at_intervals` use [`EachBatch`](../iterating_tables_in_batches.md).
The example above has batches of 1000, where each queued job takes two seconds. If the query has been optimized The example above has batches of 1000, where each queued job takes two seconds. If the query has been optimized
to make the time for the delete statement within the [query performance guidelines](query_performance.md), to make the time for the delete statement within the [query performance guidelines](../query_performance.md),
1000 may be the largest number of records that can be deleted in a reasonable amount of time. 1000 may be the largest number of records that can be deleted in a reasonable amount of time.
The minimum and most common interval for delaying jobs is two minutes. This results in two seconds The minimum and most common interval for delaying jobs is two minutes. This results in two seconds

View File

@ -70,7 +70,7 @@ Finally, you can find various guides in the [Database guides](index.md) page tha
topics and use cases. The most frequently required during database reviewing are the following: topics and use cases. The most frequently required during database reviewing are the following:
- [Migrations style guide](../migration_style_guide.md) for creating safe SQL migrations. - [Migrations style guide](../migration_style_guide.md) for creating safe SQL migrations.
- [Avoiding downtime in migrations](../avoiding_downtime_in_migrations.md). - [Avoiding downtime in migrations](avoiding_downtime_in_migrations.md).
- [SQL guidelines](../sql.md) for working with SQL queries. - [SQL guidelines](../sql.md) for working with SQL queries.
- [Guidelines for JiHu contributions with database migrations](https://about.gitlab.com/handbook/ceo/chief-of-staff-team/jihu-support/jihu-database-change-process.html) - [Guidelines for JiHu contributions with database migrations](https://about.gitlab.com/handbook/ceo/chief-of-staff-team/jihu-support/jihu-database-change-process.html)

View File

@ -23,14 +23,14 @@ info: To determine the technical writer assigned to the Stage/Group associated w
## Migrations ## Migrations
- [Avoiding downtime in migrations](../avoiding_downtime_in_migrations.md) - [Avoiding downtime in migrations](avoiding_downtime_in_migrations.md)
- [SQL guidelines](../sql.md) for working with SQL queries - [SQL guidelines](../sql.md) for working with SQL queries
- [Migrations style guide](../migration_style_guide.md) for creating safe SQL migrations - [Migrations style guide](../migration_style_guide.md) for creating safe SQL migrations
- [Testing Rails migrations](../testing_guide/testing_migrations_guide.md) guide - [Testing Rails migrations](../testing_guide/testing_migrations_guide.md) guide
- [Post deployment migrations](../post_deployment_migrations.md) - [Post deployment migrations](post_deployment_migrations.md)
- [Background migrations](../background_migrations.md) - [Background migrations](background_migrations.md)
- [Swapping tables](../swapping_tables.md) - [Swapping tables](../swapping_tables.md)
- [Deleting migrations](../deleting_migrations.md) - [Deleting migrations](deleting_migrations.md)
- [Partitioning tables](table_partitioning.md) - [Partitioning tables](table_partitioning.md)
## Debugging ## Debugging

View File

@ -191,7 +191,7 @@ ci_pipelines:
### Track record changes ### Track record changes
To know about deletions in the `projects` table, configure a `DELETE` trigger To know about deletions in the `projects` table, configure a `DELETE` trigger
using a [post-deployment migration](../post_deployment_migrations.md). The using a [post-deployment migration](post_deployment_migrations.md). The
trigger needs to be configured only once. If the model already has at least one trigger needs to be configured only once. If the model already has at least one
`loose_foreign_key` definition, then this step can be skipped: `loose_foreign_key` definition, then this step can be skipped:
@ -226,7 +226,7 @@ ON DELETE CASCADE;
The migration must run after the `DELETE` trigger is installed and the loose The migration must run after the `DELETE` trigger is installed and the loose
foreign key definition is deployed. As such, it must be a [post-deployment foreign key definition is deployed. As such, it must be a [post-deployment
migration](../post_deployment_migrations.md) dated after the migration for the migration](post_deployment_migrations.md) dated after the migration for the
trigger. If the foreign key is deleted earlier, there is a good chance of trigger. If the foreign key is deleted earlier, there is a good chance of
introducing data inconsistency which needs manual cleanup: introducing data inconsistency which needs manual cleanup:

View File

@ -197,7 +197,7 @@ end
If you have to clean up a nullable column for a [high-traffic table](../migration_style_guide.md#high-traffic-tables) If you have to clean up a nullable column for a [high-traffic table](../migration_style_guide.md#high-traffic-tables)
(for example, the `artifacts` in `ci_builds`), your background migration will go on for a while and (for example, the `artifacts` in `ci_builds`), your background migration will go on for a while and
it will need an additional [background migration cleaning up](../background_migrations.md#cleaning-up) it will need an additional [background migration cleaning up](background_migrations.md#cleaning-up)
in the release after adding the data migration. in the release after adding the data migration.
In that rare case you will need 3 releases end-to-end: In that rare case you will need 3 releases end-to-end:

View File

@ -82,7 +82,7 @@ when naming indexes, so there is a possibility that not all indexes are properly
the migration locally, check if there are inconsistently named indexes (`db/structure.sql`). Those can be the migration locally, check if there are inconsistently named indexes (`db/structure.sql`). Those can be
renamed manually in a separate migration, which can be also part of the release M.N+1. renamed manually in a separate migration, which can be also part of the release M.N+1.
- Foreign key columns might still contain the old table name. For smaller tables, follow our [standard column - Foreign key columns might still contain the old table name. For smaller tables, follow our [standard column
rename process](../avoiding_downtime_in_migrations.md#renaming-columns) rename process](avoiding_downtime_in_migrations.md#renaming-columns)
- Avoid renaming database tables which are using with triggers. - Avoid renaming database tables which are using with triggers.
- Table modifications (add or remove columns) are not allowed during the rename process, please make sure that all changes to the table happen before the rename migration is started (or in the next release). - Table modifications (add or remove columns) are not allowed during the rename process, please make sure that all changes to the table happen before the rename migration is started (or in the next release).
- As the index names might change, verify that the model does not use bulk insert - As the index names might change, verify that the model does not use bulk insert

View File

@ -229,7 +229,7 @@ end
To keep this guide short, we skipped the definition of the background migration and only To keep this guide short, we skipped the definition of the background migration and only
provided a high level example of the post-deployment migration that is used to schedule the batches. provided a high level example of the post-deployment migration that is used to schedule the batches.
You can find more information on the guide about [background migrations](../background_migrations.md) You can find more information on the guide about [background migrations](background_migrations.md)
#### Validate the text limit (next release) #### Validate the text limit (next release)
@ -277,7 +277,7 @@ end
If you have to clean up a text column for a really [large table](https://gitlab.com/gitlab-org/gitlab/-/blob/master/rubocop/rubocop-migrations.yml#L3) If you have to clean up a text column for a really [large table](https://gitlab.com/gitlab-org/gitlab/-/blob/master/rubocop/rubocop-migrations.yml#L3)
(for example, the `artifacts` in `ci_builds`), your background migration will go on for a while and (for example, the `artifacts` in `ci_builds`), your background migration will go on for a while and
it will need an additional [background migration cleaning up](../background_migrations.md#cleaning-up) it will need an additional [background migration cleaning up](background_migrations.md#cleaning-up)
in the release after adding the data migration. in the release after adding the data migration.
In that rare case you will need 3 releases end-to-end: In that rare case you will need 3 releases end-to-end:

View File

@ -214,7 +214,7 @@ end
``` ```
This step uses the same mechanism as any background migration, so you This step uses the same mechanism as any background migration, so you
may want to read the [Background Migration](../background_migrations.md) may want to read the [Background Migration](background_migrations.md)
guide for details on that process. Background jobs are scheduled every guide for details on that process. Background jobs are scheduled every
2 minutes and copy `50_000` records at a time, which can be used to 2 minutes and copy `50_000` records at a time, which can be used to
estimate the timing of the background migration portion of the estimate the timing of the background migration portion of the

View File

@ -125,7 +125,7 @@ the following preparations into account.
test its execution using `CREATE INDEX CONCURRENTLY` in the `#database-lab` Slack channel and add the execution time to the MR description: test its execution using `CREATE INDEX CONCURRENTLY` in the `#database-lab` Slack channel and add the execution time to the MR description:
- Execution time largely varies between `#database-lab` and GitLab.com, but an elevated execution time from `#database-lab` - Execution time largely varies between `#database-lab` and GitLab.com, but an elevated execution time from `#database-lab`
can give a hint that the execution on GitLab.com will also be considerably high. can give a hint that the execution on GitLab.com will also be considerably high.
- If the execution from `#database-lab` is longer than `1h`, the index should be moved to a [post-migration](post_deployment_migrations.md). - If the execution from `#database-lab` is longer than `1h`, the index should be moved to a [post-migration](database/post_deployment_migrations.md).
Keep in mind that in this case you may need to split the migration and the application changes in separate releases to ensure the index Keep in mind that in this case you may need to split the migration and the application changes in separate releases to ensure the index
will be in place when the code that needs it will be deployed. will be in place when the code that needs it will be deployed.
- Manually trigger the [database testing](database/database_migration_pipeline.md) job (`db:gitlabcom-database-testing`) in the `test` stage. - Manually trigger the [database testing](database/database_migration_pipeline.md) job (`db:gitlabcom-database-testing`) in the `test` stage.
@ -212,7 +212,7 @@ Include in the MR description:
#### Preparation when removing columns, tables, indexes, or other structures #### Preparation when removing columns, tables, indexes, or other structures
- Follow the [guidelines on dropping columns](avoiding_downtime_in_migrations.md#dropping-columns). - Follow the [guidelines on dropping columns](database/avoiding_downtime_in_migrations.md#dropping-columns).
- Generally it's best practice (but not a hard rule) to remove indexes and foreign keys in a post-deployment migration. - Generally it's best practice (but not a hard rule) to remove indexes and foreign keys in a post-deployment migration.
- Exceptions include removing indexes and foreign keys for small tables. - Exceptions include removing indexes and foreign keys for small tables.
- If you're adding a composite index, another index might become redundant, so remove that in the same migration. - If you're adding a composite index, another index might become redundant, so remove that in the same migration.
@ -236,8 +236,8 @@ Include in the MR description:
- Check that the relevant version files under `db/schema_migrations` were added or removed. - Check that the relevant version files under `db/schema_migrations` were added or removed.
- Check queries timing (If any): In a single transaction, cumulative query time executed in a migration - Check queries timing (If any): In a single transaction, cumulative query time executed in a migration
needs to fit comfortably within `15s` - preferably much less than that - on GitLab.com. needs to fit comfortably within `15s` - preferably much less than that - on GitLab.com.
- For column removals, make sure the column has been [ignored in a previous release](avoiding_downtime_in_migrations.md#dropping-columns) - For column removals, make sure the column has been [ignored in a previous release](database/avoiding_downtime_in_migrations.md#dropping-columns)
- Check [background migrations](background_migrations.md): - Check [background migrations](database/background_migrations.md):
- Establish a time estimate for execution on GitLab.com. For historical purposes, - Establish a time estimate for execution on GitLab.com. For historical purposes,
it's highly recommended to include this estimation on the merge request description. it's highly recommended to include this estimation on the merge request description.
- If a single `update` is below than `1s` the query can be placed - If a single `update` is below than `1s` the query can be placed
@ -250,7 +250,7 @@ Include in the MR description:
it's suggested to treat background migrations as post migrations: it's suggested to treat background migrations as post migrations:
place them in `db/post_migrate` instead of `db/migrate`. Keep in mind place them in `db/post_migrate` instead of `db/migrate`. Keep in mind
that post migrations are executed post-deployment in production. that post migrations are executed post-deployment in production.
- If a migration [has tracking enabled](background_migrations.md#background-jobs-tracking), - If a migration [has tracking enabled](database/background_migrations.md#background-jobs-tracking),
ensure `mark_all_as_succeeded` is called even if no work is done. ensure `mark_all_as_succeeded` is called even if no work is done.
- Check [timing guidelines for migrations](migration_style_guide.md#how-long-a-migration-should-take) - Check [timing guidelines for migrations](migration_style_guide.md#how-long-a-migration-should-take)
- Check migrations are reversible and implement a `#down` method - Check migrations are reversible and implement a `#down` method

View File

@ -93,7 +93,7 @@ falling into an endless loop as described in following
When dealing with data migrations the preferred way to iterate over a large volume of data is using When dealing with data migrations the preferred way to iterate over a large volume of data is using
`EachBatch`. `EachBatch`.
A special case of data migration is a [background migration](background_migrations.md#scheduling) A special case of data migration is a [background migration](database/background_migrations.md#scheduling)
where the actual data modification is executed in a background job. The migration code that where the actual data modification is executed in a background job. The migration code that
determines the data ranges (slices) and schedules the background jobs uses `each_batch`. determines the data ranges (slices) and schedules the background jobs uses `each_batch`.

View File

@ -16,7 +16,7 @@ with and agreed upon by backend maintainers and performance specialists.
It's also highly recommended that you read the following guides: It's also highly recommended that you read the following guides:
- [Performance Guidelines](performance.md) - [Performance Guidelines](performance.md)
- [Avoiding downtime in migrations](avoiding_downtime_in_migrations.md) - [Avoiding downtime in migrations](database/avoiding_downtime_in_migrations.md)
## Definition ## Definition

View File

@ -45,14 +45,14 @@ work it needs to perform and how long it takes to complete:
One exception is a migration that takes longer but is absolutely critical for the application to operate correctly. One exception is a migration that takes longer but is absolutely critical for the application to operate correctly.
For example, you might have indices that enforce unique tuples, or that are needed for query performance in critical parts of the application. In cases where the migration would be unacceptably slow, however, a better option might be to guard the feature with a [feature flag](feature_flags/index.md) For example, you might have indices that enforce unique tuples, or that are needed for query performance in critical parts of the application. In cases where the migration would be unacceptably slow, however, a better option might be to guard the feature with a [feature flag](feature_flags/index.md)
and perform a post-deployment migration instead. The feature can then be turned on after the migration finishes. and perform a post-deployment migration instead. The feature can then be turned on after the migration finishes.
1. [**Post-deployment migrations.**](post_deployment_migrations.md) These are Rails migrations in `db/post_migrate` and 1. [**Post-deployment migrations.**](database/post_deployment_migrations.md) These are Rails migrations in `db/post_migrate` and
run _after_ new application code has been deployed (for GitLab.com after the production deployment has finished). run _after_ new application code has been deployed (for GitLab.com after the production deployment has finished).
They can be used for schema changes that aren't critical for the application to operate, or data migrations that take at most a few minutes. They can be used for schema changes that aren't critical for the application to operate, or data migrations that take at most a few minutes.
Common examples for schema changes that should run post-deploy include: Common examples for schema changes that should run post-deploy include:
- Clean-ups, like removing unused columns. - Clean-ups, like removing unused columns.
- Adding non-critical indices on high-traffic tables. - Adding non-critical indices on high-traffic tables.
- Adding non-critical indices that take a long time to create. - Adding non-critical indices that take a long time to create.
1. [**Background migrations.**](background_migrations.md) These aren't regular Rails migrations, but application code that is 1. [**Background migrations.**](database/background_migrations.md) These aren't regular Rails migrations, but application code that is
executed via Sidekiq jobs, although a post-deployment migration is used to schedule them. Use them only for data migrations that executed via Sidekiq jobs, although a post-deployment migration is used to schedule them. Use them only for data migrations that
exceed the timing guidelines for post-deploy migrations. Background migrations should _not_ change the schema. exceed the timing guidelines for post-deploy migrations. Background migrations should _not_ change the schema.
@ -129,13 +129,13 @@ TARGET=12-9-stable-ee scripts/regenerate-schema
## Avoiding downtime ## Avoiding downtime
The document ["Avoiding downtime in migrations"](avoiding_downtime_in_migrations.md) specifies The document ["Avoiding downtime in migrations"](database/avoiding_downtime_in_migrations.md) specifies
various database operations, such as: various database operations, such as:
- [dropping and renaming columns](avoiding_downtime_in_migrations.md#dropping-columns) - [dropping and renaming columns](database/avoiding_downtime_in_migrations.md#dropping-columns)
- [changing column constraints and types](avoiding_downtime_in_migrations.md#changing-column-constraints) - [changing column constraints and types](database/avoiding_downtime_in_migrations.md#changing-column-constraints)
- [adding and dropping indexes, tables, and foreign keys](avoiding_downtime_in_migrations.md#adding-indexes) - [adding and dropping indexes, tables, and foreign keys](database/avoiding_downtime_in_migrations.md#adding-indexes)
- [migrating `integer` primary keys to `bigint`](avoiding_downtime_in_migrations.md#migrating-integer-primary-keys-to-bigint) - [migrating `integer` primary keys to `bigint`](database/avoiding_downtime_in_migrations.md#migrating-integer-primary-keys-to-bigint)
and explains how to perform them without requiring downtime. and explains how to perform them without requiring downtime.
@ -219,7 +219,7 @@ in that limit. Singular query timings should fit within the [standard limit](que
In case you need to insert, update, or delete a significant amount of data, you: In case you need to insert, update, or delete a significant amount of data, you:
- Must disable the single transaction with `disable_ddl_transaction!`. - Must disable the single transaction with `disable_ddl_transaction!`.
- Should consider doing it in a [Background Migration](background_migrations.md). - Should consider doing it in a [Background Migration](database/background_migrations.md).
## Migration helpers and versioning ## Migration helpers and versioning
@ -1114,7 +1114,7 @@ by an integer. For example: `users` would turn into `users0`
## Using models in migrations (discouraged) ## Using models in migrations (discouraged)
The use of models in migrations is generally discouraged. As such models are The use of models in migrations is generally discouraged. As such models are
[contraindicated for background migrations](background_migrations.md#isolation), [contraindicated for background migrations](database/background_migrations.md#isolation),
the model needs to be declared in the migration. the model needs to be declared in the migration.
If using a model in the migrations, you should first If using a model in the migrations, you should first

View File

@ -36,7 +36,7 @@ application starts, Rails queries the database schema, caching the tables and
column types for the data requested. Because of this schema cache, dropping a column types for the data requested. Because of this schema cache, dropping a
column or table while the application is running can produce 500 errors to the column or table while the application is running can produce 500 errors to the
user. This is why we have a [process for dropping columns and other user. This is why we have a [process for dropping columns and other
no-downtime changes](avoiding_downtime_in_migrations.md). no-downtime changes](database/avoiding_downtime_in_migrations.md).
#### Multi-tenancy #### Multi-tenancy

View File

@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Metrics Dictionary Guide # Metrics Dictionary Guide
[Service Ping](index.md) metrics are defined in individual YAML files definitions from which the [Service Ping](index.md) metrics are defined in individual YAML files definitions from which the
[Metrics Dictionary](https://metrics.gitlab.com/) is built. [Metrics Dictionary](https://metrics.gitlab.com/) is built. Currently, the metrics dictionary is built automatically once a day. When a change to a metric is made in a YAML file, you can see the change in the dictionary within 24 hours.
This guide describes the dictionary and how it's implemented. This guide describes the dictionary and how it's implemented.
## Metrics Definition and validation ## Metrics Definition and validation

View File

@ -60,6 +60,8 @@ The correct approach is to add a new metric for GitLab 12.6 release with updated
and update existing business analysis artefacts to use `example_metric_without_archived` instead of `example_metric` and update existing business analysis artefacts to use `example_metric_without_archived` instead of `example_metric`
Currently, the [Metrics Dictionary](https://metrics.gitlab.com/) is built automatically once a day. When a change to a metric is made in a YAML file, you can see the change in the dictionary within 24 hours.
## Remove a metric ## Remove a metric
WARNING: WARNING:

View File

@ -156,4 +156,4 @@ end
You must rename the queue in a post-deployment migration not in a normal You must rename the queue in a post-deployment migration not in a normal
migration. Otherwise, it runs too early, before all the workers that migration. Otherwise, it runs too early, before all the workers that
schedule these jobs have stopped running. See also [other examples](../post_deployment_migrations.md#use-cases). schedule these jobs have stopped running. See also [other examples](../database/post_deployment_migrations.md#use-cases).

View File

@ -1417,7 +1417,7 @@ To prepare the new server:
1. Flush the Redis database to disk, and stop GitLab other than the services needed for migration: 1. Flush the Redis database to disk, and stop GitLab other than the services needed for migration:
```shell ```shell
sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket save && sudo gitlab-ctl stop && sudo gitlab-ctl start postgresql sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket save && sudo gitlab-ctl stop && sudo gitlab-ctl start postgresql && sudo gitlab-ctl start gitaly
``` ```
1. Create a GitLab backup: 1. Create a GitLab backup:

View File

@ -18,7 +18,7 @@ For each snippet:
- A file is created in the repository, using the snippet filename. - A file is created in the repository, using the snippet filename.
- The snippet is committed to the repository. - The snippet is committed to the repository.
GitLab performs this migration through a [Background Migration](../development/background_migrations.md) GitLab performs this migration through a [Background Migration](../development/database/background_migrations.md)
when the GitLab instance is upgraded to 13.0 or a higher version. when the GitLab instance is upgraded to 13.0 or a higher version.
However, if the migration fails for any of the snippets, they must be migrated individually. However, if the migration fails for any of the snippets, they must be migrated individually.
The following Rake tasks help with that process. The following Rake tasks help with that process.

View File

@ -13,7 +13,7 @@ there are the following requirements:
- You can only upgrade one minor release at a time. So from 13.1 to 13.2, not to - You can only upgrade one minor release at a time. So from 13.1 to 13.2, not to
13.3. If you skip releases, database modifications may be run in the wrong 13.3. If you skip releases, database modifications may be run in the wrong
sequence [and leave the database schema in a broken state](https://gitlab.com/gitlab-org/gitlab/-/issues/321542). sequence [and leave the database schema in a broken state](https://gitlab.com/gitlab-org/gitlab/-/issues/321542).
- You have to use [post-deployment migrations](../development/post_deployment_migrations.md). - You have to use [post-deployment migrations](../development/database/post_deployment_migrations.md).
- You are using PostgreSQL. Starting from GitLab 12.1, MySQL is not supported. - You are using PostgreSQL. Starting from GitLab 12.1, MySQL is not supported.
- Multi-node GitLab instance. Single-node instances may experience brief interruptions - Multi-node GitLab instance. Single-node instances may experience brief interruptions
[as services restart (Puma in particular)](#single-node-deployment). [as services restart (Puma in particular)](#single-node-deployment).

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
module API
module Entities
class BasicReleaseDetails < Grape::Entity
include ::API::Helpers::Presentable
expose :name
expose :tag, as: :tag_name
expose :description
expose :created_at
expose :released_at
expose :upcoming_release?, as: :upcoming_release
end
end
end

View File

@ -2,20 +2,14 @@
module API module API
module Entities module Entities
class Release < Grape::Entity class Release < BasicReleaseDetails
include ::API::Helpers::Presentable include ::API::Helpers::Presentable
expose :name
expose :tag, as: :tag_name, if: ->(_, _) { can_download_code? }
expose :description
expose :description_html, if: -> (_, options) { options[:include_html_description] } do |entity| expose :description_html, if: -> (_, options) { options[:include_html_description] } do |entity|
MarkupHelper.markdown_field(entity, :description, current_user: options[:current_user]) MarkupHelper.markdown_field(entity, :description, current_user: options[:current_user])
end end
expose :created_at
expose :released_at
expose :author, using: Entities::UserBasic, if: -> (release, _) { release.author.present? } expose :author, using: Entities::UserBasic, if: -> (release, _) { release.author.present? }
expose :commit, using: Entities::Commit, if: ->(_, _) { can_download_code? } expose :commit, using: Entities::Commit, if: ->(_, _) { can_download_code? }
expose :upcoming_release?, as: :upcoming_release
expose :milestones, expose :milestones,
using: Entities::MilestoneWithStats, using: Entities::MilestoneWithStats,
if: -> (release, _) { release.milestones.present? && can_read_milestone? } do |release, _| if: -> (release, _) { release.milestones.present? && can_read_milestone? } do |release, _|

View File

@ -8,16 +8,48 @@ module API
.merge(tag_name: API::NO_SLASH_URL_PART_REGEX) .merge(tag_name: API::NO_SLASH_URL_PART_REGEX)
RELEASE_CLI_USER_AGENT = 'GitLab-release-cli' RELEASE_CLI_USER_AGENT = 'GitLab-release-cli'
before { authorize_read_releases! }
after { track_release_event }
feature_category :release_orchestration feature_category :release_orchestration
params do
requires :id, type: String, desc: 'The ID of a group'
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before { authorize_read_group_releases! }
desc 'Get a list of releases for projects in this group.' do
success Entities::Release
end
params do
requires :id, type: Integer, desc: 'The ID of the group to get releases for'
optional :sort, type: String, values: %w[asc desc], default: 'desc',
desc: 'Return projects sorted in ascending and descending order by released_at'
optional :simple, type: Boolean, default: false,
desc: 'Return only the ID, URL, name, and path of each project'
use :pagination
end
get ":id/releases" do
not_found! unless Feature.enabled?(:group_releases_finder_inoperator)
finder_options = {
sort: params[:sort]
}
strict_params = declared_params(include_missing: false)
releases = find_group_releases(finder_options)
present_group_releases(strict_params, releases)
end
end
params do params do
requires :id, type: String, desc: 'The ID of a project' requires :id, type: String, desc: 'The ID of a project'
end end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before { authorize_read_releases! }
after { track_release_event }
desc 'Get a project releases' do desc 'Get a project releases' do
detail 'This feature was introduced in GitLab 11.7.' detail 'This feature was introduced in GitLab 11.7.'
named 'get_releases' named 'get_releases'
@ -162,6 +194,10 @@ module API
end end
helpers do helpers do
def authorize_read_group_releases!
authorize! :read_release, user_group
end
def authorize_create_release! def authorize_create_release!
authorize! :create_release, user_project authorize! :create_release, user_project
end end
@ -220,6 +256,22 @@ module API
Gitlab::Tracking.event(options[:for].name, options[:route_options][:named], Gitlab::Tracking.event(options[:for].name, options[:route_options][:named],
project: user_project, user: current_user, **event_context) project: user_project, user: current_user, **event_context)
end end
def find_group_releases(finder_options)
::Releases::GroupReleasesFinder
.new(user_group, current_user, finder_options)
.execute(preload: true)
end
def present_group_releases(params, releases)
options = {
with: params[:simple] ? Entities::BasicReleaseDetails : Entities::Release,
current_user: current_user
}
# GroupReleasesFinder has already ordered the data for us
present paginate(releases, skip_default_order: true), options
end
end end
end end
end end

View File

@ -12,7 +12,7 @@ module API
params :common_wiki_page_params do params :common_wiki_page_params do
optional :format, optional :format,
type: String, type: String,
values: Wiki::MARKUPS.values.map(&:to_s), values: Wiki::VALID_USER_MARKUPS.keys.map(&:to_s),
default: 'markdown', default: 'markdown',
desc: 'Format of a wiki page. Available formats are markdown, rdoc, asciidoc and org' desc: 'Format of a wiki page. Available formats are markdown, rdoc, asciidoc and org'
end end

View File

@ -19,7 +19,7 @@ module Gitlab
def track_event(template) def track_event(template)
Gitlab::UsageDataCounters::CiTemplateUniqueCounter Gitlab::UsageDataCounters::CiTemplateUniqueCounter
.track_unique_project_event(project_id: pipeline.project_id, template: template, config_source: pipeline.config_source) .track_unique_project_event(project: pipeline.project, template: template, config_source: pipeline.config_source, user: current_user)
end end
def included_templates def included_templates

View File

@ -11,8 +11,8 @@ module Gitlab
@request_context = request_context @request_context = request_context
end end
def paginate(relation, exclude_total_headers: false) def paginate(relation, exclude_total_headers: false, skip_default_order: false)
paginate_with_limit_optimization(add_default_order(relation)).tap do |data| paginate_with_limit_optimization(add_default_order(relation, skip_default_order: skip_default_order)).tap do |data|
add_pagination_headers(data, exclude_total_headers) add_pagination_headers(data, exclude_total_headers)
end end
end end
@ -46,7 +46,9 @@ module Gitlab
false false
end end
def add_default_order(relation) def add_default_order(relation, skip_default_order: false)
return relation if skip_default_order
if relation.is_a?(ActiveRecord::Relation) && relation.order_values.empty? if relation.is_a?(ActiveRecord::Relation) && relation.order_values.empty?
relation = relation.order(:id) # rubocop: disable CodeReuse/ActiveRecord relation = relation.order(:id) # rubocop: disable CodeReuse/ActiveRecord
end end

View File

@ -6,13 +6,18 @@ module Gitlab::UsageDataCounters
KNOWN_EVENTS_FILE_PATH = File.expand_path('known_events/ci_templates.yml', __dir__) KNOWN_EVENTS_FILE_PATH = File.expand_path('known_events/ci_templates.yml', __dir__)
class << self class << self
def track_unique_project_event(project_id:, template:, config_source:) def track_unique_project_event(project:, template:, config_source:, user:)
expanded_template_name = expand_template_name(template) expanded_template_name = expand_template_name(template)
return unless expanded_template_name return unless expanded_template_name
Gitlab::UsageDataCounters::HLLRedisCounter.track_event( Gitlab::UsageDataCounters::HLLRedisCounter.track_event(
ci_template_event_name(expanded_template_name, config_source), values: project_id ci_template_event_name(expanded_template_name, config_source), values: project.id
) )
namespace = project.namespace
if Feature.enabled?(:route_hll_to_snowplow, namespace, default_enabled: :yaml)
Gitlab::Tracking.event(name, 'ci_templates_unique', namespace: namespace, user: user, project: project)
end
end end
def ci_templates(relative_base = 'lib/gitlab/ci/templates') def ci_templates(relative_base = 'lib/gitlab/ci/templates')

View File

@ -6,8 +6,9 @@ module QA
describe "Gitlab migration" do describe "Gitlab migration" do
let(:logger) { Runtime::Logger.logger } let(:logger) { Runtime::Logger.logger }
let(:differ) { RSpec::Support::Differ.new(color: true) } let(:differ) { RSpec::Support::Differ.new(color: true) }
let(:gitlab_group) { 'gitlab-migration' } let(:gitlab_group) { ENV['QA_LARGE_IMPORT_GROUP'] || 'gitlab-migration' }
let(:gitlab_source_address) { "https://staging.gitlab.com" } let(:gitlab_project) { ENV['QA_LARGE_IMPORT_REPO'] || 'dri' }
let(:gitlab_source_address) { 'https://staging.gitlab.com' }
let(:import_wait_duration) do let(:import_wait_duration) do
{ {
@ -65,7 +66,7 @@ module QA
end end
end end
let(:source_project) { source_group.projects.find { |project| project.name.include?("dri") }.reload! } let(:source_project) { source_group.projects.find { |project| project.name.include?(gitlab_project) }.reload! }
let(:source_branches) { source_project.repository_branches(auto_paginate: true).map { |b| b[:name] } } let(:source_branches) { source_project.repository_branches(auto_paginate: true).map { |b| b[:name] } }
let(:source_commits) { source_project.commits(auto_paginate: true).map { |c| c[:id] } } let(:source_commits) { source_project.commits(auto_paginate: true).map { |c| c[:id] } }
let(:source_labels) { source_project.labels(auto_paginate: true).map { |l| l.except(:id) } } let(:source_labels) { source_project.labels(auto_paginate: true).map { |l| l.except(:id) } }
@ -86,7 +87,7 @@ module QA
end end
end end
let(:imported_project) { imported_group.projects.find { |project| project.name.include?("dri") }.reload! } let(:imported_project) { imported_group.projects.find { |project| project.name.include?(gitlab_project) }.reload! }
let(:branches) { imported_project.repository_branches(auto_paginate: true).map { |b| b[:name] } } let(:branches) { imported_project.repository_branches(auto_paginate: true).map { |b| b[:name] } }
let(:commits) { imported_project.commits(auto_paginate: true).map { |c| c[:id] } } let(:commits) { imported_project.commits(auto_paginate: true).map { |c| c[:id] } }
let(:labels) { imported_project.labels(auto_paginate: true).map { |l| l.except(:id) } } let(:labels) { imported_project.labels(auto_paginate: true).map { |l| l.except(:id) } }
@ -280,11 +281,16 @@ module QA
# #
expected_body = expected_item[:body] expected_body = expected_item[:body]
actual_body = actual_item[:body] actual_body = actual_item[:body]
body_msg = <<~MSG body_msg = "#{msg} same description. diff:\n#{differ.diff(expected_body, actual_body)}"
#{msg} same description. diff:\n#{differ.diff(expected_body, actual_body)}
MSG
expect(actual_body).to eq(expected_body), body_msg expect(actual_body).to eq(expected_body), body_msg
# Print difference in state
#
expected_state = expected_item[:state]
actual_state = actual_item[:state]
state_msg = "#{msg} same state. Source: #{expected_state}, Target: #{actual_state}"
expect(actual_state).to eq(expected_state), state_msg
# Print amount difference first # Print amount difference first
# #
expected_comments = expected_item[:comments] expected_comments = expected_item[:comments]
@ -330,6 +336,7 @@ module QA
url: mr[:web_url], url: mr[:web_url],
title: mr[:title], title: mr[:title],
body: sanitize_description(mr[:description]) || '', body: sanitize_description(mr[:description]) || '',
state: mr[:state],
comments: resource comments: resource
.comments(auto_paginate: true, attempts: 2) .comments(auto_paginate: true, attempts: 2)
.map { |c| sanitize_comment(c[:body]) } .map { |c| sanitize_comment(c[:body]) }
@ -355,6 +362,7 @@ module QA
[issue[:iid], { [issue[:iid], {
url: issue[:web_url], url: issue[:web_url],
title: issue[:title], title: issue[:title],
state: issue[:state],
body: sanitize_description(issue[:description]) || '', body: sanitize_description(issue[:description]) || '',
comments: resource comments: resource
.comments(auto_paginate: true, attempts: 2) .comments(auto_paginate: true, attempts: 2)

View File

@ -10,7 +10,7 @@ FactoryBot.define do
options do options do
{ {
image: 'ruby:2.7', image: 'image:1.0',
services: ['postgres'], services: ['postgres'],
script: ['ls -a'] script: ['ls -a']
} }
@ -493,7 +493,7 @@ FactoryBot.define do
trait :extended_options do trait :extended_options do
options do options do
{ {
image: { name: 'ruby:2.7', entrypoint: '/bin/sh' }, image: { name: 'image:1.0', entrypoint: '/bin/sh' },
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }], services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }],
script: %w(echo), script: %w(echo),
after_script: %w(ls date), after_script: %w(ls date),

View File

@ -5,6 +5,7 @@
"name": { "type": "string" }, "name": { "type": "string" },
"description": { "type": "string" }, "description": { "type": "string" },
"description_html": { "type": "string" }, "description_html": { "type": "string" },
"tag_name": { "type": "string"},
"created_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" },
"released_at": { "type": "string", "format": "date-time" }, "released_at": { "type": "string", "format": "date-time" },
"upcoming_release": { "type": "boolean" }, "upcoming_release": { "type": "boolean" },

View File

@ -9,7 +9,7 @@ RSpec.describe Gitlab::Ci::Build::Image do
subject { described_class.from_image(job) } subject { described_class.from_image(job) }
context 'when image is defined in job' do context 'when image is defined in job' do
let(:image_name) { 'ruby:2.7' } let(:image_name) { 'image:1.0' }
let(:job) { create(:ci_build, options: { image: image_name } ) } let(:job) { create(:ci_build, options: { image: image_name } ) }
context 'when image is defined as string' do context 'when image is defined as string' do

View File

@ -6,11 +6,11 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
let(:entry) { described_class.new(config) } let(:entry) { described_class.new(config) }
context 'when configuration is a string' do context 'when configuration is a string' do
let(:config) { 'ruby:2.7' } let(:config) { 'image:1.0' }
describe '#value' do describe '#value' do
it 'returns image hash' do it 'returns image hash' do
expect(entry.value).to eq({ name: 'ruby:2.7' }) expect(entry.value).to eq({ name: 'image:1.0' })
end end
end end
@ -28,7 +28,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
describe '#image' do describe '#image' do
it "returns image's name" do it "returns image's name" do
expect(entry.name).to eq 'ruby:2.7' expect(entry.name).to eq 'image:1.0'
end end
end end
@ -46,7 +46,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
end end
context 'when configuration is a hash' do context 'when configuration is a hash' do
let(:config) { { name: 'ruby:2.7', entrypoint: %w(/bin/sh run) } } let(:config) { { name: 'image:1.0', entrypoint: %w(/bin/sh run) } }
describe '#value' do describe '#value' do
it 'returns image hash' do it 'returns image hash' do
@ -68,7 +68,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
describe '#image' do describe '#image' do
it "returns image's name" do it "returns image's name" do
expect(entry.name).to eq 'ruby:2.7' expect(entry.name).to eq 'image:1.0'
end end
end end
@ -80,7 +80,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
context 'when configuration has ports' do context 'when configuration has ports' do
let(:ports) { [{ number: 80, protocol: 'http', name: 'foobar' }] } let(:ports) { [{ number: 80, protocol: 'http', name: 'foobar' }] }
let(:config) { { name: 'ruby:2.7', entrypoint: %w(/bin/sh run), ports: ports } } let(:config) { { name: 'image:1.0', entrypoint: %w(/bin/sh run), ports: ports } }
let(:entry) { described_class.new(config, with_image_ports: image_ports) } let(:entry) { described_class.new(config, with_image_ports: image_ports) }
let(:image_ports) { false } let(:image_ports) { false }
@ -112,7 +112,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
end end
context 'when entry value is not correct' do context 'when entry value is not correct' do
let(:config) { ['ruby:2.7'] } let(:config) { ['image:1.0'] }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
@ -129,7 +129,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
end end
context 'when unexpected key is specified' do context 'when unexpected key is specified' do
let(:config) { { name: 'ruby:2.7', non_existing: 'test' } } let(:config) { { name: 'image:1.0', non_existing: 'test' } }
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do

View File

@ -31,7 +31,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
let(:hash) do let(:hash) do
{ {
before_script: %w(ls pwd), before_script: %w(ls pwd),
image: 'ruby:2.7', image: 'image:1.0',
default: {}, default: {},
services: ['postgres:9.1', 'mysql:5.5'], services: ['postgres:9.1', 'mysql:5.5'],
variables: { VAR: 'root', VAR2: { value: 'val 2', description: 'this is var 2' } }, variables: { VAR: 'root', VAR2: { value: 'val 2', description: 'this is var 2' } },
@ -154,7 +154,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
{ name: :rspec, { name: :rspec,
script: %w[rspec ls], script: %w[rspec ls],
before_script: %w(ls pwd), before_script: %w(ls pwd),
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
@ -169,7 +169,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
{ name: :spinach, { name: :spinach,
before_script: [], before_script: [],
script: %w[spinach], script: %w[spinach],
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
@ -186,7 +186,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
before_script: [], before_script: [],
script: ["make changelog | tee release_changelog.txt"], script: ["make changelog | tee release_changelog.txt"],
release: { name: "Release $CI_TAG_NAME", tag_name: 'v0.06', description: "./release_changelog.txt" }, release: { name: "Release $CI_TAG_NAME", tag_name: 'v0.06', description: "./release_changelog.txt" },
image: { name: "ruby:2.7" }, image: { name: "image:1.0" },
services: [{ name: "postgres:9.1" }, { name: "mysql:5.5" }], services: [{ name: "postgres:9.1" }, { name: "mysql:5.5" }],
cache: [{ key: "k", untracked: true, paths: ["public/"], policy: "pull-push", when: 'on_success' }], cache: [{ key: "k", untracked: true, paths: ["public/"], policy: "pull-push", when: 'on_success' }],
only: { refs: %w(branches tags) }, only: { refs: %w(branches tags) },
@ -206,7 +206,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
{ before_script: %w(ls pwd), { before_script: %w(ls pwd),
after_script: ['make clean'], after_script: ['make clean'],
default: { default: {
image: 'ruby:2.7', image: 'image:1.0',
services: ['postgres:9.1', 'mysql:5.5'] services: ['postgres:9.1', 'mysql:5.5']
}, },
variables: { VAR: 'root' }, variables: { VAR: 'root' },
@ -233,7 +233,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
rspec: { name: :rspec, rspec: { name: :rspec,
script: %w[rspec ls], script: %w[rspec ls],
before_script: %w(ls pwd), before_script: %w(ls pwd),
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],
@ -246,7 +246,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
spinach: { name: :spinach, spinach: { name: :spinach,
before_script: [], before_script: [],
script: %w[spinach], script: %w[spinach],
image: { name: 'ruby:2.7' }, image: { name: 'image:1.0' },
services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }], services: [{ name: 'postgres:9.1' }, { name: 'mysql:5.5' }],
stage: 'test', stage: 'test',
cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }], cache: [{ key: 'k', untracked: true, paths: ['public/'], policy: 'pull-push', when: 'on_success' }],

View File

@ -79,7 +79,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do
let(:root_ref_sha) { project.repository.root_ref_sha } let(:root_ref_sha) { project.repository.root_ref_sha }
before do before do
stub_project_blob(root_ref_sha, '/file.yml') { 'image: ruby:2.7' } stub_project_blob(root_ref_sha, '/file.yml') { 'image: image:1.0' }
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
@ -102,7 +102,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Project do
let(:ref_sha) { project.commit('master').sha } let(:ref_sha) { project.commit('master').sha }
before do before do
stub_project_blob(ref_sha, '/file.yml') { 'image: ruby:2.7' } stub_project_blob(ref_sha, '/file.yml') { 'image: image:1.0' }
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }

View File

@ -17,7 +17,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
let(:file_content) do let(:file_content) do
<<~HEREDOC <<~HEREDOC
image: 'ruby:2.7' image: 'image:1.0'
HEREDOC HEREDOC
end end
@ -36,7 +36,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the string is a local file' do context 'when the string is a local file' do
let(:values) do let(:values) do
{ include: local_file, { include: local_file,
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
@ -48,7 +48,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the key is a local file hash' do context 'when the key is a local file hash' do
let(:values) do let(:values) do
{ include: { 'local' => local_file }, { include: { 'local' => local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
@ -59,7 +59,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the string is a remote file' do context 'when the string is a remote file' do
let(:values) do let(:values) do
{ include: remote_url, image: 'ruby:2.7' } { include: remote_url, image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
@ -71,7 +71,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the key is a remote file hash' do context 'when the key is a remote file hash' do
let(:values) do let(:values) do
{ include: { 'remote' => remote_url }, { include: { 'remote' => remote_url },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
@ -83,7 +83,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when the key is a template file hash' do context 'when the key is a template file hash' do
let(:values) do let(:values) do
{ include: { 'template' => template_file }, { include: { 'template' => template_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
@ -98,7 +98,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
let(:remote_url) { 'https://gitlab.com/secret-file.yml' } let(:remote_url) { 'https://gitlab.com/secret-file.yml' }
let(:values) do let(:values) do
{ include: { 'local' => local_file, 'remote' => remote_url }, { include: { 'local' => local_file, 'remote' => remote_url },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns ambigious specification error' do it 'returns ambigious specification error' do
@ -109,7 +109,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when the key is a project's file" do context "when the key is a project's file" do
let(:values) do let(:values) do
{ include: { project: project.full_path, file: local_file }, { include: { project: project.full_path, file: local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns File instances' do it 'returns File instances' do
@ -121,7 +121,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when the key is project's files" do context "when the key is project's files" do
let(:values) do let(:values) do
{ include: { project: project.full_path, file: [local_file, 'another_file_path.yml'] }, { include: { project: project.full_path, file: [local_file, 'another_file_path.yml'] },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns two File instances' do it 'returns two File instances' do
@ -135,7 +135,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when 'include' is defined as an array" do context "when 'include' is defined as an array" do
let(:values) do let(:values) do
{ include: [remote_url, local_file], { include: [remote_url, local_file],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns Files instances' do it 'returns Files instances' do
@ -147,7 +147,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when 'include' is defined as an array of hashes" do context "when 'include' is defined as an array of hashes" do
let(:values) do let(:values) do
{ include: [{ remote: remote_url }, { local: local_file }], { include: [{ remote: remote_url }, { local: local_file }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns Files instances' do it 'returns Files instances' do
@ -158,7 +158,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when it has ambigious match' do context 'when it has ambigious match' do
let(:values) do let(:values) do
{ include: [{ remote: remote_url, local: local_file }], { include: [{ remote: remote_url, local: local_file }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'returns ambigious specification error' do it 'returns ambigious specification error' do
@ -170,7 +170,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context "when 'include' is not defined" do context "when 'include' is not defined" do
let(:values) do let(:values) do
{ {
image: 'ruby:2.7' image: 'image:1.0'
} }
end end
@ -185,7 +185,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
{ 'local' => local_file }, { 'local' => local_file },
{ 'local' => local_file } { 'local' => local_file }
], ],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'does not raise an exception' do it 'does not raise an exception' do
@ -199,7 +199,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
{ 'local' => local_file }, { 'local' => local_file },
{ 'remote' => remote_url } { 'remote' => remote_url }
], ],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
before do before do
@ -217,7 +217,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
{ 'local' => local_file }, { 'local' => local_file },
{ 'remote' => remote_url } { 'remote' => remote_url }
], ],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
before do before do
@ -269,7 +269,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'defined as an array' do context 'defined as an array' do
let(:values) do let(:values) do
{ include: [full_local_file_path, remote_url], { include: [full_local_file_path, remote_url],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable' do it 'expands the variable' do
@ -281,7 +281,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'defined as an array of hashes' do context 'defined as an array of hashes' do
let(:values) do let(:values) do
{ include: [{ local: full_local_file_path }, { remote: remote_url }], { include: [{ local: full_local_file_path }, { remote: remote_url }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable' do it 'expands the variable' do
@ -303,7 +303,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'project name' do context 'project name' do
let(:values) do let(:values) do
{ include: { project: '$CI_PROJECT_PATH', file: local_file }, { include: { project: '$CI_PROJECT_PATH', file: local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable', :aggregate_failures do it 'expands the variable', :aggregate_failures do
@ -315,7 +315,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'with multiple files' do context 'with multiple files' do
let(:values) do let(:values) do
{ include: { project: project.full_path, file: [full_local_file_path, 'another_file_path.yml'] }, { include: { project: project.full_path, file: [full_local_file_path, 'another_file_path.yml'] },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'expands the variable' do it 'expands the variable' do
@ -327,7 +327,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
context 'when include variable has an unsupported type for variable expansion' do context 'when include variable has an unsupported type for variable expansion' do
let(:values) do let(:values) do
{ include: { project: project.id, file: local_file }, { include: { project: project.id, file: local_file },
image: 'ruby:2.7' } image: 'image:1.0' }
end end
it 'does not invoke expansion for the variable', :aggregate_failures do it 'does not invoke expansion for the variable', :aggregate_failures do
@ -365,7 +365,7 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper do
let(:values) do let(:values) do
{ include: [{ remote: remote_url }, { include: [{ remote: remote_url },
{ local: local_file, rules: [{ if: "$CI_PROJECT_ID == '#{project_id}'" }] }], { local: local_file, rules: [{ if: "$CI_PROJECT_ID == '#{project_id}'" }] }],
image: 'ruby:2.7' } image: 'image:1.0' }
end end
context 'when the rules matches' do context 'when the rules matches' do

Some files were not shown because too many files have changed in this diff Show More