From 5b72415235c4a056380758c5d23bff3a738158e7 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 2 Sep 2022 00:11:46 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo/layout/line_length.yml | 9 -- .rubocop_todo/rspec/context_wording.yml | 4 - .rubocop_todo/rspec/expect_change.yml | 3 - .rubocop_todo/rspec/expect_in_hook.yml | 4 - .../style/class_and_module_children.yml | 3 - .../javascripts/google_tag_manager/index.js | 11 -- .../components/visibility_level_dropdown.vue | 48 ------ .../javascripts/groups/visibility_level.js | 24 --- .../combined_registration_experiment.rb | 16 -- app/services/projects/create_service.rb | 2 +- .../shared/groups/_visibility_level.html.haml | 3 - .../markdown_corrected_blockquote.yml} | 12 +- config/routes.rb | 7 +- .../geo/disaster_recovery/index.md | 4 +- .../runbooks/planned_failover_multi_node.md | 2 +- .../runbooks/planned_failover_single_node.md | 2 +- .../geo/replication/troubleshooting.md | 148 +++++++++--------- doc/administration/gitaly/index.md | 3 +- doc/user/markdown.md | 4 +- lib/banzai/filter/blockquote_fence_filter.rb | 39 ++++- lib/gitlab/shell.rb | 4 +- locale/gitlab.pot | 45 ------ qa/qa/resource/base.rb | 2 + qa/spec/resource/base_spec.rb | 22 +++ spec/fixtures/blockquote_fence_after.md | 24 +++ spec/fixtures/blockquote_fence_before.md | 24 +++ .../frontend/google_tag_manager/index_spec.js | 16 +- .../visibility_level_dropdown_spec.js | 70 --------- .../filter/blockquote_fence_filter_spec.rb | 12 ++ .../pipeline/pre_process_pipeline_spec.rb | 17 ++ spec/lib/gitlab/shell_spec.rb | 53 ++++++- spec/services/issues/build_service_spec.rb | 2 + spec/services/projects/create_service_spec.rb | 6 +- spec/support/rspec_order_todo.yml | 1 - .../lib/omniauth/strategies/cas3.rb | 11 +- .../spec/omniauth/strategies/cas3_spec.rb | 20 ++- 36 files changed, 319 insertions(+), 358 deletions(-) delete mode 100644 app/assets/javascripts/groups/components/visibility_level_dropdown.vue delete mode 100644 app/assets/javascripts/groups/visibility_level.js delete mode 100644 app/experiments/combined_registration_experiment.rb delete mode 100644 app/views/shared/groups/_visibility_level.html.haml rename config/feature_flags/{experiment/combined_registration.yml => development/markdown_corrected_blockquote.yml} (54%) delete mode 100644 spec/frontend/groups/components/visibility_level_dropdown_spec.js diff --git a/.rubocop_todo/layout/line_length.yml b/.rubocop_todo/layout/line_length.yml index 80c0f986552..7424ab7ea26 100644 --- a/.rubocop_todo/layout/line_length.yml +++ b/.rubocop_todo/layout/line_length.yml @@ -1123,7 +1123,6 @@ Layout/LineLength: - 'ee/app/controllers/concerns/ee/issuable_collections.rb' - 'ee/app/controllers/concerns/group_invite_members.rb' - 'ee/app/controllers/concerns/insights_actions.rb' - - 'ee/app/controllers/concerns/registrations/create_project.rb' - 'ee/app/controllers/ee/admin/dev_ops_report_controller.rb' - 'ee/app/controllers/ee/admin/users_controller.rb' - 'ee/app/controllers/ee/application_controller.rb' @@ -1160,8 +1159,6 @@ Layout/LineLength: - 'ee/app/controllers/projects/requirements_management/requirements_controller.rb' - 'ee/app/controllers/projects/security/policies_controller.rb' - 'ee/app/controllers/projects/security/vulnerabilities/notes_controller.rb' - - 'ee/app/controllers/registrations/groups_controller.rb' - - 'ee/app/controllers/registrations/groups_projects_controller.rb' - 'ee/app/controllers/subscriptions_controller.rb' - 'ee/app/controllers/trial_registrations_controller.rb' - 'ee/app/controllers/trials_controller.rb' @@ -1862,8 +1859,6 @@ Layout/LineLength: - 'ee/spec/controllers/projects/subscriptions_controller_spec.rb' - 'ee/spec/controllers/projects/vulnerability_feedback_controller_spec.rb' - 'ee/spec/controllers/projects_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_projects_controller_spec.rb' - 'ee/spec/controllers/registrations/welcome_controller_spec.rb' - 'ee/spec/controllers/subscriptions/groups_controller_spec.rb' - 'ee/spec/controllers/subscriptions_controller_spec.rb' @@ -1979,7 +1974,6 @@ Layout/LineLength: - 'ee/spec/features/projects_spec.rb' - 'ee/spec/features/promotion_spec.rb' - 'ee/spec/features/read_only_spec.rb' - - 'ee/spec/features/registrations/combined_registration_spec.rb' - 'ee/spec/features/search/elastic/global_search_spec.rb' - 'ee/spec/features/search/elastic/project_search_spec.rb' - 'ee/spec/features/search/elastic/snippet_search_spec.rb' @@ -2960,8 +2954,6 @@ Layout/LineLength: - 'ee/spec/support/shared_examples/controllers/analytics/cycle_analytics/shared_stage_shared_examples.rb' - 'ee/spec/support/shared_examples/controllers/concerns/description_diff_actions_shared_examples.rb' - 'ee/spec/support/shared_examples/controllers/projects/license_scanning_report_comparison_shared_examples.rb' - - 'ee/spec/support/shared_examples/controllers/registrations/groups_controller_shared_examples.rb' - - 'ee/spec/support/shared_examples/controllers/registrations/projects_controller_shared_examples.rb' - 'ee/spec/support/shared_examples/features/epics_filtered_search_shared_examples.rb' - 'ee/spec/support/shared_examples/features/over_free_user_limit_shared_examples.rb' - 'ee/spec/support/shared_examples/features/protected_branches_access_control_shared_examples.rb' @@ -3017,7 +3009,6 @@ Layout/LineLength: - 'ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb' - 'ee/spec/views/operations/environments.html.haml_spec.rb' - 'ee/spec/views/projects/security/discover/show.html.haml_spec.rb' - - 'ee/spec/views/registrations/groups_projects/new.html.haml_spec.rb' - 'ee/spec/views/registrations/welcome/show.html.haml_spec.rb' - 'ee/spec/views/shared/_mirror_status.html.haml_spec.rb' - 'ee/spec/views/shared/_namespace_user_cap_reached_alert.html.haml_spec.rb' diff --git a/.rubocop_todo/rspec/context_wording.yml b/.rubocop_todo/rspec/context_wording.yml index 163533621a6..98fd3c52fd9 100644 --- a/.rubocop_todo/rspec/context_wording.yml +++ b/.rubocop_todo/rspec/context_wording.yml @@ -64,7 +64,6 @@ RSpec/ContextWording: - 'ee/spec/controllers/projects/settings/repository_controller_spec.rb' - 'ee/spec/controllers/projects/vulnerability_feedback_controller_spec.rb' - 'ee/spec/controllers/projects_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_projects_controller_spec.rb' - 'ee/spec/controllers/registrations/welcome_controller_spec.rb' - 'ee/spec/controllers/repositories/git_http_controller_spec.rb' - 'ee/spec/controllers/security/dashboard_controller_spec.rb' @@ -921,8 +920,6 @@ RSpec/ContextWording: - 'ee/spec/support/shared_examples/controllers/boards_actions_shared_examples.rb' - 'ee/spec/support/shared_examples/controllers/cluster_metrics_shared_examples.rb' - 'ee/spec/support/shared_examples/controllers/concerns/description_diff_actions_shared_examples.rb' - - 'ee/spec/support/shared_examples/controllers/registrations/groups_controller_shared_examples.rb' - - 'ee/spec/support/shared_examples/controllers/registrations/projects_controller_shared_examples.rb' - 'ee/spec/support/shared_examples/features/insights_shared_examples.rb' - 'ee/spec/support/shared_examples/features/password_complexity_shared_examples.rb' - 'ee/spec/support/shared_examples/features/protected_branches_access_control_shared_examples.rb' @@ -968,7 +965,6 @@ RSpec/ContextWording: - 'ee/spec/views/profiles/preferences/show.html.haml_spec.rb' - 'ee/spec/views/projects/edit.html.haml_spec.rb' - 'ee/spec/views/projects/security/discover/show.html.haml_spec.rb' - - 'ee/spec/views/registrations/groups/new.html.haml_spec.rb' - 'ee/spec/views/registrations/welcome/show.html.haml_spec.rb' - 'ee/spec/views/search/_category.html.haml_spec.rb' - 'ee/spec/views/shared/_clone_panel.html.haml_spec.rb' diff --git a/.rubocop_todo/rspec/expect_change.yml b/.rubocop_todo/rspec/expect_change.yml index 03066626883..3d771b0ecef 100644 --- a/.rubocop_todo/rspec/expect_change.yml +++ b/.rubocop_todo/rspec/expect_change.yml @@ -22,8 +22,6 @@ RSpec/ExpectChange: - 'ee/spec/controllers/projects/repositories_controller_spec.rb' - 'ee/spec/controllers/projects/security/vulnerabilities/notes_controller_spec.rb' - 'ee/spec/controllers/projects_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_projects_controller_spec.rb' - 'ee/spec/controllers/trials_controller_spec.rb' - 'ee/spec/elastic/migrate/20220119120500_populate_commit_permissions_in_main_index_spec.rb' - 'ee/spec/features/groups/group_settings_spec.rb' @@ -245,7 +243,6 @@ RSpec/ExpectChange: - 'ee/spec/services/vulnerability_feedback/create_service_spec.rb' - 'ee/spec/services/vulnerability_feedback/destroy_service_spec.rb' - 'ee/spec/support/shared_contexts/audit_event_not_licensed_shared_context.rb' - - 'ee/spec/support/shared_examples/controllers/registrations/projects_controller_shared_examples.rb' - 'ee/spec/support/shared_examples/graphql/mutations/update_health_status_shared_examples.rb' - 'ee/spec/support/shared_examples/models/concerns/replicable_model_with_separate_table_shared_examples.rb' - 'ee/spec/support/shared_examples/models/geo_verifiable_registry_shared_examples.rb' diff --git a/.rubocop_todo/rspec/expect_in_hook.yml b/.rubocop_todo/rspec/expect_in_hook.yml index d138ea806f8..8ab50ede1ba 100644 --- a/.rubocop_todo/rspec/expect_in_hook.yml +++ b/.rubocop_todo/rspec/expect_in_hook.yml @@ -6,8 +6,6 @@ RSpec/ExpectInHook: - 'ee/spec/controllers/groups/seat_usage_controller_spec.rb' - 'ee/spec/controllers/projects/boards_controller_spec.rb' - 'ee/spec/controllers/projects/settings/slacks_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_controller_spec.rb' - - 'ee/spec/controllers/registrations/groups_projects_controller_spec.rb' - 'ee/spec/controllers/subscriptions_controller_spec.rb' - 'ee/spec/controllers/trials_controller_spec.rb' - 'ee/spec/elastic/migrate/20220118150500_delete_orphaned_commits_spec.rb' @@ -17,7 +15,6 @@ RSpec/ExpectInHook: - 'ee/spec/features/projects/feature_flags/user_creates_feature_flag_spec.rb' - 'ee/spec/features/projects/feature_flags/user_deletes_feature_flag_spec.rb' - 'ee/spec/features/projects/settings/ee/service_desk_setting_spec.rb' - - 'ee/spec/features/registrations/combined_registration_spec.rb' - 'ee/spec/features/registrations/saas_user_registration_spec.rb' - 'ee/spec/features/registrations/trial_during_signup_flow_spec.rb' - 'ee/spec/features/signup_spec.rb' @@ -103,7 +100,6 @@ RSpec/ExpectInHook: - 'ee/spec/services/projects/update_mirror_service_spec.rb' - 'ee/spec/services/security/findings/cleanup_service_spec.rb' - 'ee/spec/services/upcoming_reconciliations/update_service_spec.rb' - - 'ee/spec/support/shared_examples/controllers/registrations/projects_controller_shared_examples.rb' - 'ee/spec/support/shared_examples/lib/gitlab/graphql/issuables_lazy_links_aggregate_shared_examples.rb' - 'ee/spec/support/shared_examples/models/concerns/elastic/cannot_read_cross_project_shared_examples.rb' - 'ee/spec/support/shared_examples/models/concerns/verifiable_replicator_shared_examples.rb' diff --git a/.rubocop_todo/style/class_and_module_children.yml b/.rubocop_todo/style/class_and_module_children.yml index e0747f232a1..2674902c7ee 100644 --- a/.rubocop_todo/style/class_and_module_children.yml +++ b/.rubocop_todo/style/class_and_module_children.yml @@ -384,9 +384,6 @@ Style/ClassAndModuleChildren: - 'ee/app/controllers/admin/push_rules_controller.rb' - 'ee/app/controllers/admin/subscriptions_controller.rb' - 'ee/app/controllers/admin/user_permission_exports_controller.rb' - - 'ee/app/controllers/concerns/registrations/apply_trial.rb' - - 'ee/app/controllers/concerns/registrations/create_group.rb' - - 'ee/app/controllers/concerns/registrations/create_project.rb' - 'ee/app/controllers/concerns/registrations/verification.rb' - 'ee/app/controllers/ee/profiles/accounts_controller.rb' - 'ee/app/controllers/ee/profiles/preferences_controller.rb' diff --git a/app/assets/javascripts/google_tag_manager/index.js b/app/assets/javascripts/google_tag_manager/index.js index ca5a1b29b6d..5b0bcfa963b 100644 --- a/app/assets/javascripts/google_tag_manager/index.js +++ b/app/assets/javascripts/google_tag_manager/index.js @@ -140,17 +140,6 @@ export const trackSaasTrialGroup = () => { }); }; -export const trackSaasTrialProject = () => { - if (!isSupported()) { - return; - } - - const form = document.getElementById('new_project'); - form.addEventListener('submit', () => { - pushEvent('saasTrialProject'); - }); -}; - export const trackProjectImport = () => { if (!isSupported()) { return; diff --git a/app/assets/javascripts/groups/components/visibility_level_dropdown.vue b/app/assets/javascripts/groups/components/visibility_level_dropdown.vue deleted file mode 100644 index 0933045fc38..00000000000 --- a/app/assets/javascripts/groups/components/visibility_level_dropdown.vue +++ /dev/null @@ -1,48 +0,0 @@ - - diff --git a/app/assets/javascripts/groups/visibility_level.js b/app/assets/javascripts/groups/visibility_level.js deleted file mode 100644 index d570b5e65ac..00000000000 --- a/app/assets/javascripts/groups/visibility_level.js +++ /dev/null @@ -1,24 +0,0 @@ -import Vue from 'vue'; -import VisibilityLevelDropdown from './components/visibility_level_dropdown.vue'; - -export default () => { - const el = document.querySelector('.js-visibility-level-dropdown'); - - if (!el) { - return null; - } - - const { visibilityLevelOptions, defaultLevel } = el.dataset; - - return new Vue({ - el, - render(createElement) { - return createElement(VisibilityLevelDropdown, { - props: { - visibilityLevelOptions: JSON.parse(visibilityLevelOptions), - defaultLevel: Number(defaultLevel), - }, - }); - }, - }); -}; diff --git a/app/experiments/combined_registration_experiment.rb b/app/experiments/combined_registration_experiment.rb deleted file mode 100644 index 38295cec0d3..00000000000 --- a/app/experiments/combined_registration_experiment.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class CombinedRegistrationExperiment < ApplicationExperiment - include Rails.application.routes.url_helpers - - control { new_users_sign_up_group_path } - candidate { new_users_sign_up_groups_project_path } - - def key_for(source, _ = nil) - super(source, 'force_company_trial') - end - - def redirect_path - run - end -end diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 6381ee67ce7..9f52dd89ff2 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -96,7 +96,7 @@ module Projects log_info("#{current_user.name} created a new project \"#{@project.full_name}\"") if @project.import? - experiment(:combined_registration, user: current_user).track(:import_project) + Gitlab::Tracking.event(self.class.name, 'import_project', user: current_user) else # Skip writing the config for project imports/forks because it # will always fail since the Git directory doesn't exist until diff --git a/app/views/shared/groups/_visibility_level.html.haml b/app/views/shared/groups/_visibility_level.html.haml deleted file mode 100644 index 1a13de9b76a..00000000000 --- a/app/views/shared/groups/_visibility_level.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= f.label :visibility_level, class: 'label-bold' do - = _('Visibility level') -.js-visibility-level-dropdown{ data: { visibility_level_options: visibility_level_options(@group).to_json, default_level: f.object.visibility_level } } diff --git a/config/feature_flags/experiment/combined_registration.yml b/config/feature_flags/development/markdown_corrected_blockquote.yml similarity index 54% rename from config/feature_flags/experiment/combined_registration.yml rename to config/feature_flags/development/markdown_corrected_blockquote.yml index 0b867353946..8b02ef6ec0a 100644 --- a/config/feature_flags/experiment/combined_registration.yml +++ b/config/feature_flags/development/markdown_corrected_blockquote.yml @@ -1,8 +1,8 @@ --- -name: combined_registration -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67614 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/285533 -milestone: '14.3' -type: experiment -group: group::acquisition +name: markdown_corrected_blockquote +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95967 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372089 +milestone: '15.4' +type: development +group: group::project management default_enabled: false diff --git a/config/routes.rb b/config/routes.rb index ddc7b77460c..704405bbcbd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,8 +70,11 @@ InitializerConnections.with_disabled_database_connections do Gitlab.ee do resource :company, only: [:new, :create], controller: 'company' - resources :groups, only: [:new, :create] - resources :projects, only: [:new, :create] + + # legacy - to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/371996 + get 'groups/new', to: redirect('users/sign_up/groups_projects/new') + get 'projects/new', to: redirect('users/sign_up/groups_projects/new') + resources :groups_projects, only: [:new, :create] do collection do post :import diff --git a/doc/administration/geo/disaster_recovery/index.md b/doc/administration/geo/disaster_recovery/index.md index 0cae94fcec1..e82c130ba01 100644 --- a/doc/administration/geo/disaster_recovery/index.md +++ b/doc/administration/geo/disaster_recovery/index.md @@ -93,7 +93,7 @@ Note the following when promoting a secondary: the **secondary** to the **primary**. - If you encounter an `ActiveRecord::RecordInvalid: Validation failed: Name has already been taken` error message during this process, for more information, see this - [troubleshooting advice](../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-node). + [troubleshooting advice](../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-site). - If you run into errors when using `--force` or `--skip-preflight-checks` before 13.5 during this process, for more information, see this [troubleshooting advice](../replication/troubleshooting.md#errors-when-using---skip-preflight-checks-or---force). @@ -774,4 +774,4 @@ If you are running GitLab 14.4 and earlier: ## Troubleshooting -This section was moved to [another location](../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-node). +This section was moved to [another location](../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-site). diff --git a/doc/administration/geo/disaster_recovery/runbooks/planned_failover_multi_node.md b/doc/administration/geo/disaster_recovery/runbooks/planned_failover_multi_node.md index 46b2ccddefd..709b7359223 100644 --- a/doc/administration/geo/disaster_recovery/runbooks/planned_failover_multi_node.md +++ b/doc/administration/geo/disaster_recovery/runbooks/planned_failover_multi_node.md @@ -274,7 +274,7 @@ the **secondary** to the **primary**. WARNING: If you encounter an `ActiveRecord::RecordInvalid: Validation failed: Name has already been taken` error during this process, read -[the troubleshooting advice](../../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-node). +[the troubleshooting advice](../../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-site). The `gitlab-ctl promote-to-primary-node` command cannot be used yet in conjunction with multiple servers, as it can only diff --git a/doc/administration/geo/disaster_recovery/runbooks/planned_failover_single_node.md b/doc/administration/geo/disaster_recovery/runbooks/planned_failover_single_node.md index da26023e4f9..2334cc03bcc 100644 --- a/doc/administration/geo/disaster_recovery/runbooks/planned_failover_single_node.md +++ b/doc/administration/geo/disaster_recovery/runbooks/planned_failover_single_node.md @@ -220,7 +220,7 @@ Note the following when promoting a secondary: the **secondary** to the **primary**. - If you encounter an `ActiveRecord::RecordInvalid: Validation failed: Name has already been taken` error during this process, read - [the troubleshooting advice](../../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-node). + [the troubleshooting advice](../../replication/troubleshooting.md#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-site). To promote the secondary site running GitLab 14.5 and later: diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index d44aa49805b..82107db79da 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -19,24 +19,24 @@ Here is a list of steps you should take to attempt to fix problem: Before attempting more advanced troubleshooting: -- Check [the health of the **secondary** node](#check-the-health-of-the-secondary-node). +- Check [the health of the **secondary** site](#check-the-health-of-the-secondary-site). - Check [if PostgreSQL replication is working](#check-if-postgresql-replication-is-working). -### Check the health of the **secondary** node +### Check the health of the **secondary** site -On the **primary** node: +On the **primary** site: 1. On the top bar, select **Menu > Admin**. -1. On the left sidebar, select **Geo > Nodes**. +1. On the left sidebar, select **Geo > Sites**. -We perform the following health checks on each **secondary** node +We perform the following health checks on each **secondary** site to help identify if something is wrong: -- Is the node running? -- Is the node's secondary database configured for streaming replication? -- Is the node's secondary tracking database configured? -- Is the node's secondary tracking database connected? -- Is the node's secondary tracking database up-to-date? +- Is the site running? +- Is the secondary site's database configured for streaming replication? +- Is the secondary site's tracking database configured? +- Is the secondary site's tracking database connected? +- Is the secondary site's tracking database up-to-date? ![Geo health check](img/geo_site_health_v14_0.png) @@ -48,8 +48,8 @@ health check manually to get this information and a few more details. #### Health check Rake task -This Rake task can be run on an app node in the **primary** or **secondary** -Geo nodes: +This Rake task can be run on a **Rails** node in the **primary** or **secondary** +Geo sites: ```shell sudo gitlab-rake gitlab:geo:check @@ -275,11 +275,11 @@ sudo gitlab-rake gitlab:geo:check Checking Geo ... Finished ``` - Ensure you have added the secondary node in the Admin Area of the **primary** node. + Ensure you have added the secondary site in the **Menu > Admin > Geo > Sites** on the web interface for the **primary** site. Also ensure you entered the `gitlab_rails['geo_node_name']` - when adding the secondary node in the Admin Area of the **primary** node. - In GitLab 12.3 and earlier, edit the secondary node in the Admin Area of the **primary** - node and ensure that there is a trailing `/` in the `Name` field. + when adding the secondary site in the Admin Area of the **primary** site. + In GitLab 12.3 and earlier, edit the secondary site in the Admin Area of the **primary** + site and ensure that there is a trailing `/` in the `Name` field. - Check returns `Exception: PG::UndefinedTable: ERROR: relation "geo_nodes" does not exist`. @@ -321,7 +321,7 @@ error messages (indicated by `Database replication working? ... no` in the This means that the `max_replication_slots` PostgreSQL variable needs to be set on the **primary** database. This setting defaults to 1. You may need to -increase this value if you have more **secondary** nodes. +increase this value if you have more **secondary** sites. Be sure to restart PostgreSQL for this to take effect. See the [PostgreSQL replication setup](../setup/database.md#postgresql-replication) guide for more details. @@ -329,13 +329,13 @@ Be sure to restart PostgreSQL for this to take effect. See the ### Message: `FATAL: could not start WAL streaming: ERROR: replication slot "geo_secondary_my_domain_com" does not exist`? This occurs when PostgreSQL does not have a replication slot for the -**secondary** node by that name. +**secondary** site by that name. -You may want to rerun the [replication process](../setup/database.md) on the **secondary** node . +You may want to rerun the [replication process](../setup/database.md) on the **secondary** site . ### Message: "Command exceeded allowed execution time" when setting up replication? -This may happen while [initiating the replication process](../setup/database.md#step-3-initiate-the-replication-process) on the **secondary** node, +This may happen while [initiating the replication process](../setup/database.md#step-3-initiate-the-replication-process) on the **secondary** site, and indicates your initial dataset is too large to be replicated in the default timeout (30 minutes). Re-run `gitlab-ctl replicate-geo-database`, but include a larger value for @@ -374,8 +374,8 @@ log data to build up in `pg_xlog`. Removing the unused slots can reduce the amou Slots where `active` is `f` are not active. -- When this slot should be active, because you have a **secondary** node configured using that slot, - sign in to that **secondary** node and check the [PostgreSQL logs](../../logs/index.md#postgresql-logs) +- When this slot should be active, because you have a **secondary** site configured using that slot, + sign in on the web interface for the **secondary** site and check the [PostgreSQL logs](../../logs/index.md#postgresql-logs) to view why the replication is not running. - If you are no longer using the slot (for example, you no longer have Geo enabled), you can remove it with in the @@ -398,12 +398,12 @@ These long-running queries are [planned to be removed in the future](https://gitlab.com/gitlab-org/gitlab/-/issues/34269), but as a workaround, we recommend enabling [`hot_standby_feedback`](https://www.postgresql.org/docs/10/hot-standby.html#HOT-STANDBY-CONFLICT). -This increases the likelihood of bloat on the **primary** node as it prevents +This increases the likelihood of bloat on the **primary** site as it prevents `VACUUM` from removing recently-dead rows. However, it has been used successfully in production on GitLab.com. To enable `hot_standby_feedback`, add the following to `/etc/gitlab/gitlab.rb` -on the **secondary** node: +on the **secondary** site: ```ruby postgresql['hot_standby_feedback'] = 'on' @@ -463,14 +463,14 @@ This happens if data is detected in the `projects` table. When one or more proje is aborted to prevent accidental data loss. To bypass this message, pass the `--force` option to the command. In GitLab 13.4, a seed project is added when GitLab is first installed. This makes it necessary to pass `--force` even -on a new Geo secondary node. There is an [issue to account for seed projects](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5618) +on a new Geo secondary site. There is an [issue to account for seed projects](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5618) when checking the database. ### Message: `Synchronization failed - Error syncing repository` WARNING: If large repositories are affected by this problem, -their resync may take a long time and cause significant load on your Geo nodes, +their resync may take a long time and cause significant load on your Geo sites, storage and network systems. If you see the error message `Synchronization failed - Error syncing repository` along with `fatal: fsck error in packed object`, this indicates @@ -483,7 +483,7 @@ it's possible to override the consistency checks instead. To do that, follow [the instructions in the Gitaly docs](../../gitaly/configure_gitaly.md#repository-consistency-checks). You can also get the error message `Synchronization failed - Error syncing repository` along with the following log messages, this indicates that the expected `geo` remote is not present in the `.git/config` file -of a repository on the secondary Geo node's file system: +of a repository on the secondary Geo site's file system: ```json { @@ -505,7 +505,7 @@ of a repository on the secondary Geo node's file system: To solve this: -1. Sign in to the secondary Geo node. +1. Sign in on the web interface for the secondary Geo site. 1. Back up [the `.git` folder](../../repository_storage_types.md#translate-hashed-storage-paths). @@ -538,7 +538,7 @@ To solve this: end ``` -### Very large repositories never successfully synchronize on the **secondary** node +### Very large repositories never successfully synchronize on the **secondary** site GitLab places a timeout on all repository clones, including project imports and Geo synchronization operations. If a fresh `git clone` of a repository @@ -546,7 +546,8 @@ on the **primary** takes more than the default three hours, you may be affected To increase the timeout: -1. On the **secondary** node, add the following line to `/etc/gitlab/gitlab.rb`: +1. On the **Sidekiq nodes on your secondary** site, +add the following line to `/etc/gitlab/gitlab.rb`: ```ruby gitlab_rails['gitlab_shell_git_timeout'] = 14400 @@ -563,9 +564,9 @@ long enough to accommodate a full clone of your largest repositories. ### New LFS objects are never replicated -If new LFS objects are never replicated to secondary Geo nodes, check the version of +If new LFS objects are never replicated to secondary Geo sites, check the version of GitLab you are running. GitLab versions 11.11.x or 12.0.x are affected by -[a bug that results in new LFS objects not being replicated to Geo secondary nodes](https://gitlab.com/gitlab-org/gitlab/-/issues/32696). +[a bug that results in new LFS objects not being replicated to Geo secondary sites](https://gitlab.com/gitlab-org/gitlab/-/issues/32696). To resolve the issue, upgrade to GitLab 12.1 or later. @@ -574,9 +575,9 @@ To resolve the issue, upgrade to GitLab 12.1 or later. During a [backfill](../index.md#backfill), failures are scheduled to be retried at the end of the backfill queue, therefore these failures only clear up **after** the backfill completes. -### Resetting Geo **secondary** node replication +### Resetting Geo **secondary** site replication -If you get a **secondary** node in a broken state and want to reset the replication state, +If you get a **secondary** site in a broken state and want to reset the replication state, to start again from scratch, there are a few steps that can help you: 1. Stop Sidekiq and the Geo LogCursor. @@ -617,8 +618,8 @@ to start again from scratch, there are a few steps that can help you: 1. Optional. Rename other data folders and create new ones. WARNING: - You may still have files on the **secondary** node that have been removed from the **primary** node, but this - removal has not been reflected. If you skip this step, these files are not removed from the Geo node. + You may still have files on the **secondary** site that have been removed from the **primary** site, but this + removal has not been reflected. If you skip this step, these files are not removed from the Geo **secondary** site. Any uploaded content (like file attachments, avatars, or LFS objects) is stored in a subfolder in one of these paths: @@ -667,7 +668,7 @@ to start again from scratch, there are a few steps that can help you: ### Design repository failures on mirrored projects and project imports -On the top bar, under **Menu > Admin > Geo > Nodes**, +On the top bar, under **Menu > Admin > Geo > Sites**, if the Design repositories progress bar shows `Synced` and `Failed` greater than 100%, and negative `Queued`, the instance is likely affected by @@ -714,7 +715,7 @@ Counts: {"synced"=>3} ``` -#### If you are promoting a Geo secondary site running on a single server +#### If you are promoting a Geo secondary site running on a single node `gitlab-ctl promotion-preflight-checks` fails due to the existence of `failed` rows in the `geo_design_registry` table. Use the @@ -831,10 +832,10 @@ We recommend transferring each failing repository individually and checking for after each transfer. Follow the [single target `rsync` instructions](../../operations/moving_repositories.md#single-rsync-to-another-server) to transfer each affected repository from the primary to the secondary site. -## Fixing errors during a failover or when promoting a secondary to a primary node +## Fixing errors during a failover or when promoting a secondary to a primary site The following are possible error messages that might be encountered during failover or -when promoting a secondary to a primary node with strategies to resolve them. +when promoting a secondary to a primary site with strategies to resolve them. ### Message: `ActiveRecord::RecordInvalid: Validation failed: Name has already been taken` @@ -873,9 +874,9 @@ or `gitlab-ctl promote-to-primary-node`, either: ### Message: `ActiveRecord::RecordInvalid: Validation failed: Enabled Geo primary node cannot be disabled` -If you disabled a secondary node, either with the [replication pause task](../index.md#pausing-and-resuming-replication) +If you disabled a secondary site, either with the [replication pause task](../index.md#pausing-and-resuming-replication) (GitLab 13.2) or by using the user interface (GitLab 13.1 and earlier), you must first -re-enable the node before you can continue. This is fixed in GitLab 13.4. +re-enable the site before you can continue. This is fixed in GitLab 13.4. This can be fixed in the database. @@ -894,7 +895,7 @@ This can be fixed in the database. ``` 1. Run the following command, replacing `https:///` with the URL - for your secondary server. You can use either `http` or `https`, but ensure that you + for your secondary node. You can use either `http` or `https`, but ensure that you end the URL with a slash (`/`): ```sql @@ -987,32 +988,31 @@ sudo gitlab-rake geo:set_secondary_as_primary ## Expired artifacts If you notice for some reason there are more artifacts on the Geo -secondary node than on the Geo primary node, you can use the Rake task +**secondary** site than on the Geo **primary** site, you can use the Rake task to [cleanup orphan artifact files](../../../raketasks/cleanup.md#remove-orphan-artifact-files). -On a Geo **secondary** node, this command also cleans up all Geo +On a Geo **secondary** site, this command also cleans up all Geo registry record related to the orphan files on disk. ## Fixing sign in errors ### Message: The redirect URI included is not valid -If you are able to sign in to the **primary** node, but you receive this error message -when attempting to sign in to a **secondary**, you should verify the Geo -node's URL matches its external URL. +If you are able to sign in to the web interface for the **primary** site, but you receive this error message +when attempting to sign in to a **secondary** web interface, you should verify the Geo +site's URL matches its external URL. -On the **primary** node: +On the **primary** site: 1. On the top bar, select **Menu > Admin**. -1. On the left sidebar, select **Geo > Nodes**. +1. On the left sidebar, select **Geo > Sites**. 1. Find the affected **secondary** site and select **Edit**. 1. Ensure the **URL** field matches the value found in `/etc/gitlab/gitlab.rb` - in `external_url "https://gitlab.example.com"` on the frontend servers of - the **secondary** node. + in `external_url "https://gitlab.example.com"` on the **Rails nodes of the secondary** site. ## Fixing common errors -This section documents common error messages reported in the Admin Area, and how to fix them. +This section documents common error messages reported in the Admin Area on the web interface, and how to fix them. ### Geo database configuration file is missing @@ -1029,11 +1029,11 @@ has the correct permissions. Geo cannot reuse an existing tracking database. It is safest to use a fresh secondary, or reset the whole secondary by following -[Resetting Geo secondary node replication](#resetting-geo-secondary-node-replication). +[Resetting Geo secondary site replication](#resetting-geo-secondary-site-replication). -### Geo node has a database that is writable which is an indication it is not configured for replication with the primary node +### Geo site has a database that is writable which is an indication it is not configured for replication with the primary site -This error message refers to a problem with the database replica on a **secondary** node, +This error message refers to a problem with the database replica on a **secondary** site, which Geo expects to have access to. It usually means, either: - An unsupported replication method was used (for example, logical replication). @@ -1043,24 +1043,24 @@ which Geo expects to have access to. It usually means, either: Geo **secondary** sites require two separate PostgreSQL instances: -- A read-only replica of the **primary** node. +- A read-only replica of the **primary** site. - A regular, writable instance that holds replication metadata. That is, the Geo tracking database. This error message indicates that the replica database in the **secondary** site is misconfigured and replication has stopped. To restore the database and resume replication, you can do one of the following: -- [Reset the Geo secondary site replication](#resetting-geo-secondary-node-replication). +- [Reset the Geo secondary site replication](#resetting-geo-secondary-site-replication). - [Set up a new secondary Geo Omnibus instance](../setup/index.md#using-omnibus-gitlab). If you set up a new secondary from scratch, you must also [remove the old site from the Geo cluster](remove_geo_site.md#removing-secondary-geo-sites). -### Geo node does not appear to be replicating the database from the primary node +### Geo site does not appear to be replicating the database from the primary site The most common problems that prevent the database from replicating correctly are: -- **Secondary** nodes cannot reach the **primary** node. Check credentials, firewall rules, and so on. -- SSL certificate problems. Make sure you copied `/etc/gitlab/gitlab-secrets.json` from the **primary** node. +- **Secondary** sites cannot reach the **primary** site. Check credentials, [firewall rules](../index.md#firewall-rules), and so on. +- SSL certificate problems. Make sure you copied `/etc/gitlab/gitlab-secrets.json` from the **primary** site. - Database storage disk is full. - Database replication slot is misconfigured. - Database is not using a replication slot or another alternative and cannot catch-up because WAL files were purged. @@ -1072,26 +1072,26 @@ Make sure you follow the [Geo database replication](../setup/database.md) instru If you are using Omnibus GitLab installation, something might have failed during upgrade. You can: - Run `sudo gitlab-ctl reconfigure`. -- Manually trigger the database migration by running: `sudo gitlab-rake db:migrate:geo` as root on the **secondary** node. +- Manually trigger the database migration by running: `sudo gitlab-rake db:migrate:geo` as root on the **secondary** site. ### GitLab indicates that more than 100% of repositories were synced This can be caused by orphaned records in the project registry. You can clear them [using a Rake task](../../../administration/raketasks/geo.md#remove-orphaned-project-registries). -### Geo Admin Area returns 404 error for a secondary node +### Geo Admin Area returns 404 error for a secondary site -Sometimes `sudo gitlab-rake gitlab:geo:check` indicates that the **secondary** node is -healthy, but a 404 Not Found error message for the **secondary** node is returned in the Geo Admin Area on -the **primary** node. +Sometimes `sudo gitlab-rake gitlab:geo:check` indicates that **Rails nodes of the secondary** sites are +healthy, but a 404 Not Found error message for the **secondary** site is returned in the Geo Admin Area on the web interface for +the **primary** site. To resolve this issue: -- Try restarting the **secondary** using `sudo gitlab-ctl restart`. -- Check `/var/log/gitlab/gitlab-rails/geo.log` to see if the **secondary** node is - using IPv6 to send its status to the **primary** node. If it is, add an entry to - the **primary** node using IPv4 in the `/etc/hosts` file. Alternatively, you should - [enable IPv6 on the **primary** node](https://docs.gitlab.com/omnibus/settings/nginx.html#setting-the-nginx-listen-address-or-addresses). +- Try restarting **each Rails, Sidekiq and Gitaly nodes on your secondary site** using `sudo gitlab-ctl restart`. +- Check `/var/log/gitlab/gitlab-rails/geo.log` on Sidekiq nodes to see if the **secondary** site is + using IPv6 to send its status to the **primary** site. If it is, add an entry to + the **primary** site using IPv4 in the `/etc/hosts` file. Alternatively, you should + [enable IPv6 on the **primary** site](https://docs.gitlab.com/omnibus/settings/nginx.html#setting-the-nginx-listen-address-or-addresses). ### Secondary site returns 502 errors with Geo proxying @@ -1167,7 +1167,7 @@ To fix this issue, set the primary site's internal URL to a URL that is: You may have problems if you're running a version of [Git LFS](https://git-lfs.github.com/) before 2.4.2. As noted in [this authentication issue](https://github.com/git-lfs/git-lfs/issues/3025), -requests redirected from the secondary to the primary node do not properly send the +requests redirected from the secondary to the primary site do not properly send the Authorization header. This may result in either an infinite `Authorization <-> Redirect` loop, or Authorization error messages. @@ -1194,13 +1194,13 @@ The partial failover to a secondary Geo *site* may be the result of a temporary/ 1. SSH into every Sidekiq, PostgresSQL, Gitaly, and Rails node in the **secondary** site and run one of the following commands: - - To promote the secondary node to primary: + - To promote the secondary site to primary: ```shell sudo gitlab-ctl geo promote ``` - - To promote the secondary node to primary **without any further confirmation**: + - To promote the secondary site to primary **without any further confirmation**: ```shell sudo gitlab-ctl geo promote --force diff --git a/doc/administration/gitaly/index.md b/doc/administration/gitaly/index.md index f33fd672f4f..b1c54041b22 100644 --- a/doc/administration/gitaly/index.md +++ b/doc/administration/gitaly/index.md @@ -597,7 +597,8 @@ To migrate to Gitaly Cluster: 1. Create the required storage. Refer to [repository storage recommendations](praefect.md#repository-storage-recommendations). -1. Create and configure [Gitaly Cluster](praefect.md). +1. Create and configure [Gitaly Cluster](praefect.md). +1. Configure the existing Gitaly instance [to use TPC](praefect.md#use-tcp-for-existing-gitlab-instances), if not already configured that way. 1. [Move the repositories](../operations/moving_repositories.md#move-repositories). To migrate to Gitaly Cluster, existing repositories stored outside Gitaly Cluster must be moved. There is no automatic migration but the moves can be scheduled with the GitLab API. diff --git a/doc/user/markdown.md b/doc/user/markdown.md index 6a524fe206a..98f19750d49 100644 --- a/doc/user/markdown.md +++ b/doc/user/markdown.md @@ -611,9 +611,10 @@ Quote break. If this section isn't rendered correctly, [view it in GitLab](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/user/markdown.md#multiline-blockquote). GitLab Flavored Markdown extends the standard Markdown by also supporting multi-line blockquotes -fenced by `>>>`: +fenced by `>>>`, with a blank line before and after the block: ```markdown + >>> If you paste a message from somewhere else @@ -621,6 +622,7 @@ that spans multiple lines, you can quote that without having to manually prepend `>` to every line! >>> + ``` >>> diff --git a/lib/banzai/filter/blockquote_fence_filter.rb b/lib/banzai/filter/blockquote_fence_filter.rb index e07cbfe8d85..fbc020bd20e 100644 --- a/lib/banzai/filter/blockquote_fence_filter.rb +++ b/lib/banzai/filter/blockquote_fence_filter.rb @@ -5,6 +5,37 @@ module Banzai class BlockquoteFenceFilter < HTML::Pipeline::TextFilter REGEX = %r{ #{::Gitlab::Regex.markdown_code_or_html_blocks} + | + (?=(?<=^\n|\A)>>>\ *\n.*\n>>>\ *(?=\n$|\z))(?: + # Blockquote: + # >>> + # Anything, including code and HTML blocks + # >>> + + (?<=^\n|\A)>>>\ *\n + (? + (?: + # Any character that doesn't introduce a code or HTML block + (?! + ^``` + | + ^<[^>]+?>\ *\n + ) + . + | + # A code block + \g + | + # An HTML block + \g + )+? + ) + \n>>>\ *(?=\n$|\z) + ) + }mx.freeze + + OLD_REGEX = %r{ + #{::Gitlab::Regex.markdown_code_or_html_blocks} | (?=^>>>\ *\n.*\n>>>\ *$)(?: # Blockquote: @@ -40,7 +71,7 @@ module Banzai end def call - @text.gsub(REGEX) do + @text.gsub(regex) do if $~[:quote] # keep the same number of source lines/positions by replacing the # fence lines with newlines @@ -50,6 +81,12 @@ module Banzai end end end + + private + + def regex + Feature.enabled?(:markdown_corrected_blockquote) ? REGEX : OLD_REGEX + end end end end diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index d26e1a34a9f..b167afe589a 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -70,7 +70,9 @@ module Gitlab link_path = File.join(shell_path, '.gitlab_shell_secret') if File.exist?(shell_path) && !File.exist?(link_path) - FileUtils.symlink(secret_file, link_path) + # It could happen that link_path is a broken symbolic link. + # In that case !File.exist?(link_path) is true, but we still want to overwrite the (broken) symbolic link. + FileUtils.ln_sf(secret_file, link_path) end end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 47500bb567a..74593c3672b 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -3918,9 +3918,6 @@ msgstr "" msgid "Allowed" msgstr "" -msgid "Allowed characters: +, 0-9, -, and spaces." -msgstr "" - msgid "Allowed email domain restriction only permitted for top-level groups" msgstr "" @@ -11051,9 +11048,6 @@ msgstr "" msgid "Create, update, or delete a merge request." msgstr "" -msgid "Create/import your first project" -msgstr "" - msgid "CreateGroup|You don’t have permission to create a subgroup in this group." msgstr "" @@ -15186,9 +15180,6 @@ msgstr "" msgid "Error loading burndown chart data" msgstr "" -msgid "Error loading countries data." -msgstr "" - msgid "Error loading file viewer." msgstr "" @@ -23237,9 +23228,6 @@ msgstr "" msgid "Learn GitLab" msgstr "" -msgid "Learn GitLab - Ultimate trial" -msgstr "" - msgid "Learn More" msgstr "" @@ -40531,9 +40519,6 @@ msgstr "" msgid "This project will be deleted on %{date} since its parent group '%{parent_group_name}' has been scheduled for deletion." msgstr "" -msgid "This project will live in your group %{strong_open}%{namespace}%{strong_close}. A project is where you store your files (repository), plan your work (issues), publish your documentation (wiki), and so much more." -msgstr "" - msgid "This release was created with a date in the past. Evidence collection at the moment of the release is unavailable." msgstr "" @@ -41477,39 +41462,12 @@ msgstr "" msgid "Trial|Allowed characters: +, 0-9, -, and spaces." msgstr "" -msgid "Trial|Company name" -msgstr "" - msgid "Trial|Continue" msgstr "" -msgid "Trial|Continue using the basic features of GitLab for free." -msgstr "" - -msgid "Trial|Country" -msgstr "" - msgid "Trial|Dismiss" msgstr "" -msgid "Trial|GitLab Ultimate trial (optional)" -msgstr "" - -msgid "Trial|Number of employees" -msgstr "" - -msgid "Trial|Please select a country" -msgstr "" - -msgid "Trial|Telephone number" -msgstr "" - -msgid "Trial|Upgrade to Ultimate to keep using GitLab with advanced features." -msgstr "" - -msgid "Trial|We will activate your trial on your group after you complete this step. After 30 days, you can:" -msgstr "" - msgid "Trial|Your GitLab Ultimate trial lasts for 30 days, but you can keep your free GitLab account forever. We just need some additional information to activate your trial." msgstr "" @@ -45625,9 +45583,6 @@ msgstr "" msgid "Your file must contain a column named %{codeStart}title%{codeEnd}. A %{codeStart}description%{codeEnd} column is optional. The maximum file size allowed is 10 MB." msgstr "" -msgid "Your first project" -msgstr "" - msgid "Your free group is now limited to %d member" msgid_plural "Your free group is now limited to %d members" msgstr[0] "" diff --git a/qa/qa/resource/base.rb b/qa/qa/resource/base.rb index ba1b581b100..7f883ceeab7 100644 --- a/qa/qa/resource/base.rb +++ b/qa/qa/resource/base.rb @@ -263,6 +263,8 @@ module QA end def log_having_both_api_result_and_block(name, api_value) + api_value = "[MASKED]" if name == :token + QA::Runtime::Logger.debug(<<~MSG.strip) <#{self.class}> Attribute #{name.inspect} has both API response `#{api_value}` and a block. API response will be picked. Block will be ignored. MSG diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb index f23f4aa728b..195e497f290 100644 --- a/qa/spec/resource/base_spec.rb +++ b/qa/spec/resource/base_spec.rb @@ -24,6 +24,10 @@ RSpec.describe QA::Resource::Base do 'block' end + attribute :token do + 'token_value' + end + attribute :username do 'qa' end @@ -208,6 +212,24 @@ RSpec.describe QA::Resource::Base do .to have_received(:debug).with(/api_with_block/) end end + + context 'when the attribute is token and has a block' do + let(:api_resource) { { token: 'another_token_value' } } + + before do + allow(QA::Runtime::Logger).to receive(:debug) + end + + it 'emits a masked debug log entry' do + result = subject.fabricate!(resource: resource) + + expect(result).to be_a(described_class) + expect(result.token).to eq('another_token_value') + + expect(QA::Runtime::Logger) + .to have_received(:debug).with(/MASKED/) + end + end end context 'when the attribute is populated via direct assignment' do diff --git a/spec/fixtures/blockquote_fence_after.md b/spec/fixtures/blockquote_fence_after.md index 555905bf07e..18500d94c7a 100644 --- a/spec/fixtures/blockquote_fence_after.md +++ b/spec/fixtures/blockquote_fence_after.md @@ -129,3 +129,27 @@ Double `>>>` inside HTML inside blockquote: > > Quote + +Requires a leading blank line +>>> +Not a quote +>>> + +Requires a trailing blank line + +>>> +Not a quote +>>> +Lorem + +Triple quoting is not our blockquote + +>>> foo +>>> bar +>>> +> baz + +> boo +>>> far +>>> +>>> faz diff --git a/spec/fixtures/blockquote_fence_before.md b/spec/fixtures/blockquote_fence_before.md index d52eec72896..895bff73404 100644 --- a/spec/fixtures/blockquote_fence_before.md +++ b/spec/fixtures/blockquote_fence_before.md @@ -129,3 +129,27 @@ Quote Quote >>> + +Requires a leading blank line +>>> +Not a quote +>>> + +Requires a trailing blank line + +>>> +Not a quote +>>> +Lorem + +Triple quoting is not our blockquote + +>>> foo +>>> bar +>>> +> baz + +> boo +>>> far +>>> +>>> faz diff --git a/spec/frontend/google_tag_manager/index_spec.js b/spec/frontend/google_tag_manager/index_spec.js index 9c4b23e3a70..ec9e1ef8e5f 100644 --- a/spec/frontend/google_tag_manager/index_spec.js +++ b/spec/frontend/google_tag_manager/index_spec.js @@ -8,7 +8,6 @@ import { trackSaasTrialSubmit, trackSaasTrialSkip, trackSaasTrialGroup, - trackSaasTrialProject, trackSaasTrialGetStarted, trackTrialAcceptTerms, trackCheckout, @@ -150,9 +149,6 @@ describe('~/google_tag_manager/index', () => { createTestCase(trackSaasTrialGroup, { forms: [{ cls: 'js-saas-trial-group', expectation: { event: 'saasTrialGroup' } }], }), - createTestCase(trackSaasTrialProject, { - forms: [{ id: 'new_project', expectation: { event: 'saasTrialProject' } }], - }), createTestCase(trackProjectImport, { links: [ { @@ -481,11 +477,11 @@ describe('~/google_tag_manager/index', () => { }); it('no ops', () => { - setHTMLFixture(createHTML({ forms: [{ id: 'new_project' }] })); + setHTMLFixture(createHTML({ forms: [{ cls: 'js-saas-trial-group' }] })); - trackSaasTrialProject(); + trackSaasTrialGroup(); - triggerEvent('#new_project', 'submit'); + triggerEvent('.js-saas-trial-group', 'submit'); expect(spy).not.toHaveBeenCalled(); expect(logError).not.toHaveBeenCalled(); @@ -506,11 +502,11 @@ describe('~/google_tag_manager/index', () => { }); it('logs error', () => { - setHTMLFixture(createHTML({ forms: [{ id: 'new_project' }] })); + setHTMLFixture(createHTML({ forms: [{ cls: 'js-saas-trial-group' }] })); - trackSaasTrialProject(); + trackSaasTrialGroup(); - triggerEvent('#new_project', 'submit'); + triggerEvent('.js-saas-trial-group', 'submit'); expect(logError).toHaveBeenCalledWith( 'Unexpected error while pushing to dataLayer', diff --git a/spec/frontend/groups/components/visibility_level_dropdown_spec.js b/spec/frontend/groups/components/visibility_level_dropdown_spec.js deleted file mode 100644 index 49d0b182f7f..00000000000 --- a/spec/frontend/groups/components/visibility_level_dropdown_spec.js +++ /dev/null @@ -1,70 +0,0 @@ -import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import Component from '~/groups/components/visibility_level_dropdown.vue'; - -describe('Visibility Level Dropdown', () => { - let wrapper; - - const options = [ - { level: 0, label: 'Private', description: 'Private description' }, - { level: 20, label: 'Public', description: 'Public description' }, - ]; - const defaultLevel = 0; - - const createComponent = (propsData) => { - wrapper = shallowMount(Component, { - propsData, - }); - }; - - beforeEach(() => { - createComponent({ - visibilityLevelOptions: options, - defaultLevel, - }); - }); - - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - - const hiddenInputValue = () => - wrapper.find("input[name='group[visibility_level]']").attributes('value'); - const dropdownText = () => wrapper.findComponent(GlDropdown).props('text'); - const findDropdownItems = () => - wrapper.findAllComponents(GlDropdownItem).wrappers.map((option) => ({ - text: option.text(), - secondaryText: option.props('secondaryText'), - })); - - describe('Default values', () => { - it('sets the value of the hidden input to the default value', () => { - expect(hiddenInputValue()).toBe(options[0].level.toString()); - }); - - it('sets the text of the dropdown to the default value', () => { - expect(dropdownText()).toBe(options[0].label); - }); - - it('shows all dropdown options', () => { - expect(findDropdownItems()).toEqual( - options.map(({ label, description }) => ({ text: label, secondaryText: description })), - ); - }); - }); - - describe('Selecting an option', () => { - beforeEach(() => { - wrapper.findAllComponents(GlDropdownItem).at(1).vm.$emit('click'); - }); - - it('sets the value of the hidden input to the selected value', () => { - expect(hiddenInputValue()).toBe(options[1].level.toString()); - }); - - it('sets the text of the dropdown to the selected value', () => { - expect(dropdownText()).toBe(options[1].label); - }); - }); -}); diff --git a/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb b/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb index 2d326bd77a6..36e8002b796 100644 --- a/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb +++ b/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb @@ -14,10 +14,22 @@ RSpec.describe Banzai::Filter::BlockquoteFenceFilter do expect(output).to eq(expected) end + it 'does not require newlines at start or end of string' do + expect(filter(">>>\ntest\n>>>")).to eq("\n> test\n") + end + it 'allows trailing whitespace on blockquote fence lines' do expect(filter(">>> \ntest\n>>> ")).to eq("\n> test\n") end + context 'when feature flag is turned off' do + it 'does not require a leading or trailing blank line' do + stub_feature_flags(markdown_corrected_blockquote: false) + + expect(filter("Foo\n>>>\ntest\n>>>\nBar")).to eq("Foo\n\n> test\n\nBar") + end + end + context 'when incomplete blockquote fences with multiple blocks are present' do it 'does not raise timeout error' do test_string = ">>>#{"\n```\nfoo\n```" * 20}" diff --git a/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb b/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb index 5021ef3a79a..303d0fcb6c2 100644 --- a/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb @@ -32,4 +32,21 @@ RSpec.describe Banzai::Pipeline::PreProcessPipeline do expect(result[:output]).to eq('foo foo f...') end + + context 'when multiline blockquote' do + it 'data-sourcepos references correct line in source markdown' do + markdown = <<~MD + >>> + foo + >>> + MD + + pipeline_output = described_class.call(markdown, {})[:output] + pipeline_output = Banzai::Pipeline::PlainMarkdownPipeline.call(pipeline_output, {})[:output] + sourcepos = pipeline_output.at('blockquote')['data-sourcepos'] + source_line = sourcepos.split(':').first.to_i + + expect(markdown.lines[source_line - 1]).to eq "foo\n" + end + end end diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index 891b3639709..785429aa3b0 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -9,9 +9,13 @@ RSpec.describe Gitlab::Shell do let(:repository) { project.repository } let(:gitlab_shell) { described_class.new } + before do + described_class.instance_variable_set(:@secret_token, nil) + end + it { is_expected.to respond_to :remove_repository } - describe 'memoized secret_token' do + describe '.secret_token' do let(:secret_file) { 'tmp/tests/.secret_shell_test' } let(:link_file) { 'tmp/tests/shell-secret-test/.gitlab_shell_secret' } @@ -19,7 +23,6 @@ RSpec.describe Gitlab::Shell do allow(Gitlab.config.gitlab_shell).to receive(:secret_file).and_return(secret_file) allow(Gitlab.config.gitlab_shell).to receive(:path).and_return('tmp/tests/shell-secret-test') FileUtils.mkdir('tmp/tests/shell-secret-test') - described_class.ensure_secret_token! end after do @@ -27,13 +30,47 @@ RSpec.describe Gitlab::Shell do FileUtils.rm_rf(secret_file) end - it 'creates and links the secret token file' do - secret_token = described_class.secret_token + shared_examples 'creates and links the secret token file' do + it 'creates and links the secret token file' do + secret_token = described_class.secret_token - expect(File.exist?(secret_file)).to be(true) - expect(File.read(secret_file).chomp).to eq(secret_token) - expect(File.symlink?(link_file)).to be(true) - expect(File.readlink(link_file)).to eq(secret_file) + expect(File.exist?(secret_file)).to be(true) + expect(File.read(secret_file).chomp).to eq(secret_token) + expect(File.symlink?(link_file)).to be(true) + expect(File.readlink(link_file)).to eq(secret_file) + end + end + + describe 'memoized secret_token' do + before do + described_class.ensure_secret_token! + end + + it_behaves_like 'creates and links the secret token file' + end + + context 'when link_file is a broken symbolic link' do + before do + File.symlink('tmp/tests/non_existing_file', link_file) + described_class.ensure_secret_token! + end + + it_behaves_like 'creates and links the secret token file' + end + + context 'when secret_file exists' do + let(:secret_token) { 'secret-token' } + + before do + File.write(secret_file, 'secret-token') + described_class.ensure_secret_token! + end + + it_behaves_like 'creates and links the secret token file' + + it 'reads the token from the existing file' do + expect(described_class.secret_token).to eq(secret_token) + end end end diff --git a/spec/services/issues/build_service_spec.rb b/spec/services/issues/build_service_spec.rb index 304e4bb3ebb..838e0675372 100644 --- a/spec/services/issues/build_service_spec.rb +++ b/spec/services/issues/build_service_spec.rb @@ -63,11 +63,13 @@ RSpec.describe Issues::BuildService do it 'wraps the note in a blockquote' do note_text = "This is a string\n"\ + "\n"\ ">>>\n"\ "with a blockquote\n"\ "> That has a quote\n"\ ">>>\n" note_result = " > This is a string\n"\ + " > \n"\ " > \n"\ " > > with a blockquote\n"\ " > > > That has a quote\n"\ diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index e112c1e2497..edde2e0a247 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -417,10 +417,10 @@ RSpec.describe Projects::CreateService, '#execute' do expect(imported_project.import_url).to eq('http://import-url') end - it 'tracks for the combined_registration experiment', :experiment do - expect(experiment(:combined_registration)).to track(:import_project).on_next_instance - + it 'tracks for imported project' do imported_project + + expect_snowplow_event(category: described_class.name, action: 'import_project', user: user) end describe 'import scheduling' do diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index bcd83c431e4..f297734b4b7 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -216,7 +216,6 @@ - './ee/spec/elastic/migrate/20220512150000_pause_indexing_for_unsupported_es_versions_spec.rb' - './ee/spec/elastic/migrate/20220613120500_migrate_commits_to_separate_index_spec.rb' - './ee/spec/elastic/migrate/20220713103500_delete_commits_from_original_index_spec.rb' -- './ee/spec/experiments/combined_registration_experiment_spec.rb' - './ee/spec/factories/lfs_object_spec.rb' - './ee/spec/features/account_recovery_regular_check_spec.rb' - './ee/spec/features/admin/admin_audit_logs_spec.rb' diff --git a/vendor/gems/omniauth-cas3/lib/omniauth/strategies/cas3.rb b/vendor/gems/omniauth-cas3/lib/omniauth/strategies/cas3.rb index 7271621c564..441529b67d8 100644 --- a/vendor/gems/omniauth-cas3/lib/omniauth/strategies/cas3.rb +++ b/vendor/gems/omniauth-cas3/lib/omniauth/strategies/cas3.rb @@ -62,9 +62,14 @@ module OmniAuth end extra do - prune!( - raw_info.delete_if{ |k,v| AuthHashSchemaKeys.include?(k) } - ) + hash = {} + + unless skip_info? + hash = raw_info.dup + hash.delete_if { |k, _v| AuthHashSchemaKeys.include?(k) } + end + + prune! hash end uid do diff --git a/vendor/gems/omniauth-cas3/spec/omniauth/strategies/cas3_spec.rb b/vendor/gems/omniauth-cas3/spec/omniauth/strategies/cas3_spec.rb index fd61fc79580..f434d711f02 100644 --- a/vendor/gems/omniauth-cas3/spec/omniauth/strategies/cas3_spec.rb +++ b/vendor/gems/omniauth-cas3/spec/omniauth/strategies/cas3_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'securerandom' describe OmniAuth::Strategies::CAS3, type: :strategy do include Rack::Test::Methods @@ -15,17 +16,32 @@ describe OmniAuth::Strategies::CAS3, type: :strategy do }.to_app end + let(:csrf_token) { SecureRandom.base64(32) } + let(:base_env) { { 'rack.session' => { csrf: csrf_token }, 'rack.input' => StringIO.new("authenticity_token=#{escaped_token}") } } + let(:post_env) { make_env('/auth/cas3', base_env.merge(request_env)) } + let(:escaped_token) { URI.encode_www_form_component(csrf_token, Encoding::UTF_8) } + + def make_env(path = '/auth/cas3', props = {}) + { + 'REQUEST_METHOD' => 'POST', + 'PATH_INFO' => path, + 'rack.session' => {}, + 'rack.input' => StringIO.new('test=true') + }.merge(props) + end + # TODO: Verify that these are even useful tests shared_examples_for 'a CAS redirect response' do let(:redirect_params) { 'service=' + Rack::Utils.escape("http://example.org/auth/cas3/callback?url=#{Rack::Utils.escape(return_url)}") } - before { get url, nil, request_env } + before { post url, nil, post_env } subject { last_response } it { should be_redirect } it 'redirects to the CAS server' do + expect(subject.status).to eq(302) expect(subject.headers).to include 'Location' => "http://cas.example.org:8080/login?#{redirect_params}" end end @@ -78,7 +94,7 @@ describe OmniAuth::Strategies::CAS3, type: :strategy do it { should include('ssl' => true) } end - describe 'GET /auth/cas3' do + describe 'POST /auth/cas3' do let(:return_url) { 'http://myapp.com/admin/foo' } context 'with a referer' do