From a3e10bf32044486be8923176581670cf9ccacc8b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 11 Apr 2023 06:13:04 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- Gemfile | 2 -- db/fixtures/development/33_triage_ops.rb | 2 +- ...404194907_remove_mr_mentions_temp_index.rb | 14 ++++++++ db/schema_migrations/20230404194907 | 1 + doc/administration/gitaly/praefect.md | 2 +- doc/development/emails.md | 33 ++----------------- doc/update/plan_your_upgrade.md | 10 ------ doc/user/project/import/github.md | 3 ++ .../settings/import_export_troubleshooting.md | 29 +++++++++++++--- qa/qa/page/group/menu.rb | 1 + .../group/sub_menus/super_sidebar/main.rb | 27 +++++++++++++++ qa/qa/page/main/menu.rb | 6 ++++ qa/qa/page/profile/super_sidebar/menu.rb | 12 ++++--- qa/qa/page/project/menu.rb | 2 +- qa/qa/page/project/sub_menus/issues.rb | 2 +- .../super_sidebar/{project.rb => main.rb} | 14 +++++--- qa/qa/page/sub_menus/super_sidebar/main.rb | 21 ++++++++++++ .../import/import_github_repo_spec.rb | 6 +++- .../jira/jira_issue_import_spec.rb | 4 +-- .../2_plan/issue/create_issue_spec.rb | 4 +-- .../2_plan/issue/export_as_csv_spec.rb | 2 +- 21 files changed, 133 insertions(+), 64 deletions(-) create mode 100644 db/post_migrate/20230404194907_remove_mr_mentions_temp_index.rb create mode 100644 db/schema_migrations/20230404194907 create mode 100644 qa/qa/page/group/sub_menus/super_sidebar/main.rb rename qa/qa/page/project/sub_menus/super_sidebar/{project.rb => main.rb} (51%) create mode 100644 qa/qa/page/sub_menus/super_sidebar/main.rb diff --git a/Gemfile b/Gemfile index d0840df21ea..e0ba0f8cccf 100644 --- a/Gemfile +++ b/Gemfile @@ -478,8 +478,6 @@ end gem 'octokit', '~> 4.15' -# Updating this gem version here is deprecated. See: -# https://docs.gitlab.com/ee/development/emails.html#mailroom-gem-updates gem 'gitlab-mail_room', '~> 0.0.23', require: 'mail_room' gem 'email_reply_trimmer', '~> 0.1' diff --git a/db/fixtures/development/33_triage_ops.rb b/db/fixtures/development/33_triage_ops.rb index 080e985fc5f..5d8b4a0a48f 100644 --- a/db/fixtures/development/33_triage_ops.rb +++ b/db/fixtures/development/33_triage_ops.rb @@ -192,7 +192,7 @@ class Gitlab::Seeder::TriageOps group = Group.new( name: group_path.titleize, path: group_path, - parent_id: parent&.id + parent: parent ) group.description = FFaker::Lorem.sentence group.save! diff --git a/db/post_migrate/20230404194907_remove_mr_mentions_temp_index.rb b/db/post_migrate/20230404194907_remove_mr_mentions_temp_index.rb new file mode 100644 index 00000000000..49a2b22df0a --- /dev/null +++ b/db/post_migrate/20230404194907_remove_mr_mentions_temp_index.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class RemoveMrMentionsTempIndex < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'merge_request_mentions_temp_index' + + # TODO: Index to be destroyed synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/402497 + def up + prepare_async_index_removal :merge_requests, :id, name: INDEX_NAME + end + + def down + unprepare_async_index :merge_requests, :id, name: INDEX_NAME + end +end diff --git a/db/schema_migrations/20230404194907 b/db/schema_migrations/20230404194907 new file mode 100644 index 00000000000..76b16536f8d --- /dev/null +++ b/db/schema_migrations/20230404194907 @@ -0,0 +1 @@ +7dccec7b92a1ea97acad03086c8d7c05ee06d1afdb88ffe34d6e83b1ffe61ad3 \ No newline at end of file diff --git a/doc/administration/gitaly/praefect.md b/doc/administration/gitaly/praefect.md index 80fbc1623b1..62773f66796 100644 --- a/doc/administration/gitaly/praefect.md +++ b/doc/administration/gitaly/praefect.md @@ -1033,7 +1033,7 @@ For more information on Gitaly server configuration, see our 1. Disable all other services by editing `/etc/gitlab/gitlab.rb`: ```ruby - # Disable all other services on the Praefect node + # Disable all other services on the Gitaly node postgresql['enable'] = false redis['enable'] = false nginx['enable'] = false diff --git a/doc/development/emails.md b/doc/development/emails.md index 2d03d8bca2f..fdcdcec814d 100644 --- a/doc/development/emails.md +++ b/doc/development/emails.md @@ -151,37 +151,10 @@ fork of [`MailRoom`](https://github.com/tpitale/mail_room/), to ensure that we can make updates quickly to the gem if necessary. We try to upstream changes as soon as possible and keep the two projects in sync. -Updating the `gitlab-mail_room` dependency in `Gemfile` is deprecated at -the moment in favor of updating the version in -[Omnibus](https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/master/config/software/mail_room.rb) -(see [example merge request](https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/5816)) -and Helm Chart configuration (see [example merge request](https://gitlab.com/gitlab-org/build/CNG/-/merge_requests/854)). +To update MailRoom: -#### Rationale - -This was done because to avoid [thread deadlocks](https://github.com/ruby/net-imap/issues/14), `MailRoom` needs -an updated version of the `net-imap` gem. However, this -[version of the net-imap cannot be installed by an unprivileged user](https://github.com/ruby/net-imap/issues/14) due to -[an error installing the digest gem](https://github.com/ruby/digest/issues/14). -[This bug in the Ruby interpreter](https://bugs.ruby-lang.org/issues/17761) was fixed in Ruby -3.0.2. - -Updating the gem directly in the GitLab Rails `Gemfile` caused a [production incident](https://gitlab.com/gitlab-com/gl-infra/production/-/issues/4053) -since Kubernetes pods do not run as privileged users. - -Note that Omnibus GitLab runs `/opt/gitlab/embedded/bin/mail_room` -instead of `bundle exec rake` to avoid loading the older version. With a -Kubernetes install, the MailRoom version has always been explicitly set -in the Helm Chart configuration rather than the `Gemfile`. - -#### Preserving backwards compatibility - -Removing the `Gemfile` would break incoming email processing for source -installs. For now, source installs are advised to upgrade manually to -the version specified in Omnibus and run `bin/mail_room` directly as -done with Omnibus. - -We can reconsider this deprecation once we upgrade to Ruby 3.0. +1. Update `Gemfile` in GitLab Rails (see [example merge request](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/116494)). +1. Update the Helm Chart configuration (see [example merge request](https://gitlab.com/gitlab-org/build/CNG/-/merge_requests/854)). --- diff --git a/doc/update/plan_your_upgrade.md b/doc/update/plan_your_upgrade.md index fd5e1ac8c30..e1354ea3665 100644 --- a/doc/update/plan_your_upgrade.md +++ b/doc/update/plan_your_upgrade.md @@ -60,16 +60,6 @@ to ensure the major components of GitLab are working: 1. If using Elasticsearch, verify that searches are successful. -1. If you are using [Reply by Email](../administration/reply_by_email.md) or [Service Desk](../user/project/service_desk.md), - manually install the latest version of `gitlab-mail_room`: - - ```shell - gem install gitlab-mail_room - ``` - - NOTE: This step is necessary to avoid thread deadlocks and to support the latest MailRoom features. See - [this explanation](../development/emails.md#mailroom-gem-updates) for more details. - If in any case something goes wrong, see [how to troubleshoot](#troubleshooting). ## Rollback plan diff --git a/doc/user/project/import/github.md b/doc/user/project/import/github.md index 2984ccebc8e..7e99f6e4e8c 100644 --- a/doc/user/project/import/github.md +++ b/doc/user/project/import/github.md @@ -55,6 +55,9 @@ To import projects from GitHub: See also [Branch protection rules and project settings](#branch-protection-rules-and-project-settings) for additional prerequisites for those imports. +Because of a [known issue](https://gitlab.com/gitlab-org/gitlab/-/issues/383047), if you are using GitHub as an OmniAuth provider, ensure that the URL +perimeter is specified in the [OmniAuth configuration](../../../integration/github.md#enable-github-oauth-in-gitlab). + ### Importing from GitHub Enterprise to self-managed GitLab If you are importing from GitHub Enterprise to a self-managed GitLab instance: diff --git a/doc/user/project/settings/import_export_troubleshooting.md b/doc/user/project/settings/import_export_troubleshooting.md index 82412a1dcbf..530e7497b52 100644 --- a/doc/user/project/settings/import_export_troubleshooting.md +++ b/doc/user/project/settings/import_export_troubleshooting.md @@ -10,10 +10,10 @@ If you have problems with [migrating projects using file exports](import_export. ## Troubleshooting commands -Finds information about the status of the import and further logs using the JID: +Finds information about the status of the import and further logs using the JID, +using the [Rails console](../../../administration/operations/rails_console.md): ```ruby -# Rails console Project.find_by_full_path('group/project').import_state.slice(:jid, :status, :last_error) > {"jid"=>"414dec93f941a593ea1a6894", "status"=>"finished", "last_error"=>nil} ``` @@ -35,6 +35,27 @@ Review [issue 276930](https://gitlab.com/gitlab-org/gitlab/-/issues/276930), and - Ensure shared runners are enabled in both the source and destination projects. - Disable shared runners on the parent group when you import the project. +## Users missing from imported project + +If users aren't imported with imported projects, see the [preserving user contributions](import_export.md#preserving-user-contributions) requirements. + +A common reason for missing users is that the [public email setting](../../profile/index.md#set-your-public-email) isn't configured for users. +To resolve this issue, ask users to configure this setting using the GitLab UI. + +If there are too many users for manual configuration to be feasible, +you can set all user profiles to use a public email address using the +[Rails console](../../../administration/operations/rails_console.md#starting-a-rails-console-session): + +```ruby +User.where("public_email IS NULL OR public_email = '' ").find_each do |u| + next if u.bot? + + puts "Setting #{u.username}'s currently empty public email to #{u.email}…" + u.public_email = u.email + u.save! +end +``` + ## Import workarounds for large repositories [Maximum import size limitations](import_export.md#import-a-project-and-its-data) @@ -153,12 +174,12 @@ Rather than attempting to push all changes at once, this workaround: You usually export a project through [the web interface](import_export.md#export-a-project-and-its-data) or through [the API](../../../api/project_import_export.md). Exporting using these methods can sometimes fail without giving enough information to troubleshoot. In these cases, -[open a rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session) and loop through +[open a Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session) and loop through [all the defined exporters](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/projects/import_export/export_service.rb). Execute each line individually, rather than pasting the entire block at once, so you can see any errors each command returns. -```shell +```ruby # User needs to have permission to export u = User.find_by_username('someuser') p = Project.find_by_full_path('some/project') diff --git a/qa/qa/page/group/menu.rb b/qa/qa/page/group/menu.rb index 46228926311..04c4f20ad18 100644 --- a/qa/qa/page/group/menu.rb +++ b/qa/qa/page/group/menu.rb @@ -10,6 +10,7 @@ module QA prepend Page::SubMenus::SuperSidebar::Manage prepend Page::SubMenus::SuperSidebar::Plan prepend SubMenus::SuperSidebar::Settings + prepend SubMenus::SuperSidebar::Main prepend SubMenus::SuperSidebar::Build end diff --git a/qa/qa/page/group/sub_menus/super_sidebar/main.rb b/qa/qa/page/group/sub_menus/super_sidebar/main.rb new file mode 100644 index 00000000000..e470c03b9e5 --- /dev/null +++ b/qa/qa/page/group/sub_menus/super_sidebar/main.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module QA + module Page + module Group + module SubMenus + module SuperSidebar + module Main + extend QA::Page::PageConcern + + def self.included(base) + super + + base.class_eval do + include QA::Page::SubMenus::SuperSidebar::Main + end + end + + def go_to_group_overview + click_element(:nav_item_link, submenu_item: 'Group overview') + end + end + end + end + end + end +end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index c21b1a4ca3c..fa8c0508142 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -80,10 +80,14 @@ module QA end def go_to_projects + return click_element(:nav_item_link, submenu_item: 'Projects') if Runtime::Env.super_sidebar_enabled? + click_element(:sidebar_menu_link, menu_item: 'Projects') end def go_to_groups + return click_element(:nav_item_link, submenu_item: 'Groups') if Runtime::Env.super_sidebar_enabled? + # Use new functionality to visit Groups where possible if has_element?(:sidebar_menu_link, menu_item: 'Groups') click_element(:sidebar_menu_link, menu_item: 'Groups') @@ -98,6 +102,8 @@ module QA end def go_to_snippets + return click_element(:nav_item_link, submenu_item: 'Snippets') if Runtime::Env.super_sidebar_enabled? + click_element(:sidebar_menu_link, menu_item: 'Snippets') end diff --git a/qa/qa/page/profile/super_sidebar/menu.rb b/qa/qa/page/profile/super_sidebar/menu.rb index e31f8bbec58..ade9c47313d 100644 --- a/qa/qa/page/profile/super_sidebar/menu.rb +++ b/qa/qa/page/profile/super_sidebar/menu.rb @@ -6,19 +6,23 @@ module QA module SuperSidebar module Menu def click_ssh_keys - click_element(:sidebar_menu_link, menu_item: 'SSH Keys') + click_element(:nav_item_link, submenu_item: 'SSH Keys') end def click_account - click_element(:sidebar_menu_link, menu_item: 'Account') + click_element(:nav_item_link, submenu_item: 'Account') end def click_emails - click_element(:sidebar_menu_link, menu_item: 'Emails') + click_element(:nav_item_link, submenu_item: 'Emails') end def click_password - click_element(:sidebar_menu_link, menu_item: 'Password') + click_element(:nav_item_link, submenu_item: 'Password') + end + + def click_access_tokens + click_element(:nav_item_link, submenu_item: 'Access Tokens') end end end diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index 4f91484e5a8..025102e29e6 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -18,13 +18,13 @@ module QA if Runtime::Env.super_sidebar_enabled? include Page::SubMenus::SuperSidebar::Manage - include SubMenus::SuperSidebar::Project include SubMenus::SuperSidebar::Plan include SubMenus::SuperSidebar::Settings include SubMenus::SuperSidebar::Code include SubMenus::SuperSidebar::Build include SubMenus::SuperSidebar::Operate include SubMenus::SuperSidebar::Monitor + include SubMenus::SuperSidebar::Main end def click_merge_requests diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb index 48840c29635..b5b918e076d 100644 --- a/qa/qa/page/project/sub_menus/issues.rb +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -15,7 +15,7 @@ module QA end end - def click_issues + def go_to_issues within_sidebar do click_element(:sidebar_menu_link, menu_item: 'Issues') end diff --git a/qa/qa/page/project/sub_menus/super_sidebar/project.rb b/qa/qa/page/project/sub_menus/super_sidebar/main.rb similarity index 51% rename from qa/qa/page/project/sub_menus/super_sidebar/project.rb rename to qa/qa/page/project/sub_menus/super_sidebar/main.rb index 0d2df959548..63641248b15 100644 --- a/qa/qa/page/project/sub_menus/super_sidebar/project.rb +++ b/qa/qa/page/project/sub_menus/super_sidebar/main.rb @@ -5,14 +5,20 @@ module QA module Project module SubMenus module SuperSidebar - module Project + module Main extend QA::Page::PageConcern - def click_project - within_sidebar do - click_element(:sidebar_menu_link, menu_item: 'Project overview') + def self.included(base) + super + + base.class_eval do + include QA::Page::SubMenus::SuperSidebar::Main end end + + def click_project + click_element(:nav_item_link, submenu_item: 'Project overview') + end end end end diff --git a/qa/qa/page/sub_menus/super_sidebar/main.rb b/qa/qa/page/sub_menus/super_sidebar/main.rb new file mode 100644 index 00000000000..aadb24369ea --- /dev/null +++ b/qa/qa/page/sub_menus/super_sidebar/main.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module QA + module Page + module SubMenus + module SuperSidebar + module Main + extend QA::Page::PageConcern + + def go_to_issues + click_element(:nav_item_link, submenu_item: 'Issues') + end + + def go_to_merge_requests + click_element(:nav_item_link, submenu_item: 'Merge requests') + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/1_manage/import/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/import/import_github_repo_spec.rb index b5a8df15ddc..d92d8de5567 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/import/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/import/import_github_repo_spec.rb @@ -37,7 +37,11 @@ module QA end end - it 'imports a project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347877' do + it 'imports a project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347877', + quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/405127', + type: :investigating + } do Page::Project::Import::Github.perform do |import_page| import_page.add_personal_access_token(Runtime::Env.github_access_token) diff --git a/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_issue_import_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_issue_import_spec.rb index 9132b262b51..f4042795995 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_issue_import_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_issue_import_spec.rb @@ -18,7 +18,7 @@ module QA set_up_jira_integration import_jira_issues - Page::Project::Menu.perform(&:click_issues) + Page::Project::Menu.perform(&:go_to_issues) Page::Project::Issue::Index.perform do |issues_page| expect { issues_page }.to eventually_have_content(jira_issue_title).within( max_attempts: 5, sleep_interval: 1, reload_page: issues_page @@ -56,7 +56,7 @@ module QA end def import_jira_issues - Page::Project::Menu.perform(&:click_issues) + Page::Project::Menu.perform(&:go_to_issues) Page::Project::Issue::Index.perform(&:go_to_jira_import_form) Page::Project::Issue::JiraImport.perform do |form| diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb index e2fd0ec9cef..821f885c4c8 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -26,7 +26,7 @@ module QA ) do issue = Resource::Issue.fabricate_via_browser_ui! { |issue| issue.project = project } - Page::Project::Menu.perform(&:click_issues) + Page::Project::Menu.perform(&:go_to_issues) Page::Project::Issue::Index.perform do |index| expect(index).to have_issue(issue) @@ -46,7 +46,7 @@ module QA expect(issue_page).to have_reopen_issue_button end - Page::Project::Menu.perform(&:click_issues) + Page::Project::Menu.perform(&:go_to_issues) Page::Project::Issue::Index.perform do |index| expect(index).not_to have_issue(closed_issue) diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb index 61fd743f920..275f3a52f17 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb @@ -19,7 +19,7 @@ module QA end project.visit! - Page::Project::Menu.perform(&:click_issues) + Page::Project::Menu.perform(&:go_to_issues) end it 'successfully exports issues list as CSV', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347968' do