From 8a560d56661f56804ddf6596f928e7d25db37443 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 May 2023 00:08:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../Geo Replicate a new Git repository type.md | 4 +-- GITLAB_ELASTICSEARCH_INDEXER_VERSION | 2 +- .../profiles/two_factor_auths_controller.rb | 4 +-- doc/api/merge_requests.md | 4 +-- doc/api/rest/deprecations.md | 2 +- doc/ci/pipelines/merge_trains.md | 6 ++++ doc/ci/troubleshooting.md | 2 +- doc/development/code_review.md | 7 ++--- doc/user/profile/notifications.md | 2 +- doc/user/project/merge_requests/index.md | 2 +- .../merge_requests/merge_when_pipeline_succeeds.md | 20 ++++++------- doc/user/project/merge_requests/widgets.md | 2 +- .../user_merges_when_pipeline_succeeds_spec.rb | 2 +- spec/features/profiles/two_factor_auths_spec.rb | 34 ++++++++++++++++++++++ 14 files changed, 66 insertions(+), 27 deletions(-) diff --git a/.gitlab/issue_templates/Geo Replicate a new Git repository type.md b/.gitlab/issue_templates/Geo Replicate a new Git repository type.md index 05a643c967c..549100741d8 100644 --- a/.gitlab/issue_templates/Geo Replicate a new Git repository type.md +++ b/.gitlab/issue_templates/Geo Replicate a new Git repository type.md @@ -511,13 +511,13 @@ That's all of the required database changes. FactoryBot.modify do factory :cool_widget do trait :verification_succeeded do - with_file + repository verification_checksum { 'abc' } verification_state { CoolWidget.verification_state_value(:verification_succeeded) } end trait :verification_failed do - with_file + repository verification_failure { 'Could not calculate the checksum' } verification_state { CoolWidget.verification_state_value(:verification_failed) } end diff --git a/GITLAB_ELASTICSEARCH_INDEXER_VERSION b/GITLAB_ELASTICSEARCH_INDEXER_VERSION index f77856a6f1a..e91d9be2a86 100644 --- a/GITLAB_ELASTICSEARCH_INDEXER_VERSION +++ b/GITLAB_ELASTICSEARCH_INDEXER_VERSION @@ -1 +1 @@ -4.3.1 +4.3.3 diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index bc6e67a3a7d..e83b72b71a8 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -35,9 +35,9 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController render 'create' else @error = { message: _('Invalid pin code.') } - @qr_code = build_qr_code @account_string = account_string - setup_webauthn_registration + + setup_show_page render 'show' end diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 1be5f6204a1..068a0a0dfd3 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -621,11 +621,11 @@ Supported attributes: | `latest_build_started_at` | datetime | Timestamp of when the latest build for the merge request started. | | `merge_commit_sha` | string | SHA of the merge request commit. Returns `null` until merged. | | `merge_error` | string | Error message shown when a merge has failed. To check mergeability, use `detailed_merge_status` instead | -| `merge_user` | object | The user who merged this merge request, the user who set it to merge when pipeline succeeds, or `null`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/349031) in GitLab 14.7. | +| `merge_user` | object | The user who merged this merge request, the user who set it to auto-merge, or `null`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/349031) in GitLab 14.7. | | `merge_status` | string | Status of the merge request. Can be `unchecked`, `checking`, `can_be_merged`, `cannot_be_merged`, or `cannot_be_merged_recheck`. Affects the `has_conflicts` property. For important notes on response data, read [Single merge request response notes](#single-merge-request-response-notes). [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/3169#note_1162532204) in GitLab 15.6. Use `detailed_merge_status` instead. | | `merge_when_pipeline_succeeds` | boolean | Indicates if the merge has been set to be merged when its pipeline succeeds. | | `merged_at` | datetime | Timestamp of when the merge request was merged. | -| `merged_by` | object | User who merged this merge request or set it to merge when pipeline succeeds. [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/350534) in GitLab 14.7, and scheduled for removal in [API version 5](https://gitlab.com/groups/gitlab-org/-/epics/8115). Use `merge_user` instead. | +| `merged_by` | object | User who merged this merge request or set it to auto-merge. [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/350534) in GitLab 14.7, and scheduled for removal in [API version 5](https://gitlab.com/groups/gitlab-org/-/epics/8115). Use `merge_user` instead. | | `milestone` | object | Milestone of the merge request. | | `pipeline` | object | Pipeline running on the branch HEAD of the merge request. Consider using `head_pipeline` instead, as it contains more information. | | `project_id` | integer | ID of the merge request project. | diff --git a/doc/api/rest/deprecations.md b/doc/api/rest/deprecations.md index db9b590606f..20fa999516e 100644 --- a/doc/api/rest/deprecations.md +++ b/doc/api/rest/deprecations.md @@ -26,7 +26,7 @@ Breaking change. [Related issue](https://gitlab.com/gitlab-org/gitlab/-/issues/3 The `merged_by` field in the [merge request API](../merge_requests.md#list-merge-requests) has been deprecated in favor of the `merge_user` field which more correctly identifies who merged a merge request when -performing actions (merge when pipeline succeeds, add to merge train) other than a simple merge. +performing actions (set to auto-merge, add to merge train) other than a simple merge. API users are encouraged to use the new `merge_user` field instead. The `merged_by` field will be removed in v5 of the GitLab REST API. diff --git a/doc/ci/pipelines/merge_trains.md b/doc/ci/pipelines/merge_trains.md index 548acc147f5..ee1c08c4df8 100644 --- a/doc/ci/pipelines/merge_trains.md +++ b/doc/ci/pipelines/merge_trains.md @@ -216,6 +216,12 @@ You can find reason the merge request was dropped from the merge train in the sy notes. Check the **Activity** section in the **Overview** tab for a message similar to: `User removed this merge request from the merge train because ...` +### Cannot use auto-merge + +You cannot use [auto-merge](../../user/project/merge_requests/merge_when_pipeline_succeeds.md) +(formerly **Merge when pipeline succeeds**) to skip the merge train, when merge trains are enabled. +See [issue 12267](https://gitlab.com/gitlab-org/gitlab/-/issues/12267) for more information. + ### Cannot retry merge train pipeline cannot When a merge train pipeline fails, the merge request is dropped from the train and the pipeline can't be retried. diff --git a/doc/ci/troubleshooting.md b/doc/ci/troubleshooting.md index ceecb020044..c56ca439c83 100644 --- a/doc/ci/troubleshooting.md +++ b/doc/ci/troubleshooting.md @@ -396,7 +396,7 @@ Earlier jobs are already canceled by a periodic background worker (`StuckCiJobsW The following commands are run in the [rails console](../administration/operations/rails_console.md#starting-a-rails-console-session). WARNING: -Any command that changes data directly could be damaging if not run correctly, or under the right conditions. +Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case. ### Cancel stuck pending pipelines diff --git a/doc/development/code_review.md b/doc/development/code_review.md index f2edc882d91..02f187d62c8 100644 --- a/doc/development/code_review.md +++ b/doc/development/code_review.md @@ -576,8 +576,7 @@ WARNING: messy commit history, it will be more efficient to squash commits instead of circling back with the author about that. Otherwise, if the MR only has a few commits, we'll be respecting the author's setting by not squashing them. -- Start a new merge request pipeline with the `Run pipeline` button in the merge - request's "Pipelines" tab, and enable "Merge When Pipeline Succeeds" (MWPS). +- Go to the merge request's **Pipelines** tab, and select **Run pipeline**. Then, on the **Overview** tab, enable **Auto-merge**. Note that: - If **[the default branch is broken](https://about.gitlab.com/handbook/engineering/workflow/#broken-master), do not merge the merge request** except for @@ -587,7 +586,7 @@ WARNING: - If the **latest [merged results pipeline](../ci/pipelines/merged_results_pipelines.md)** was **created less than 6 hours ago**, and **finished less than 2 hours ago**, you may merge without starting a new pipeline as the merge request is close enough to `main`. -- When you set the MR to "Merge When Pipeline Succeeds", you should take over +- When you set the MR to auto-merge, you should take over subsequent revisions for anything that would be spotted after that. - For merge requests that have had [Squash and merge](../user/project/merge_requests/squash_and_merge.md#squash-and-merge) set, the squashed commit's default commit message is taken from the merge request title. @@ -597,7 +596,7 @@ Thanks to **merged results pipelines**, authors no longer have to rebase their branch as frequently anymore (only when there are conflicts) because the Merge Results Pipeline already incorporate the latest changes from `main`. This results in faster review/merge cycles because maintainers don't have to ask -for a final rebase: instead, they only have to start a MR pipeline and set MWPS. +for a final rebase: instead, they only have to start a MR pipeline and set auto-merge. This step brings us very close to the actual Merge Trains feature by testing the Merge Results against the latest `main` at the time of the pipeline creation. diff --git a/doc/user/profile/notifications.md b/doc/user/profile/notifications.md index b60ff8471bf..c94954e4dd2 100644 --- a/doc/user/profile/notifications.md +++ b/doc/user/profile/notifications.md @@ -263,7 +263,7 @@ epics: | Issue | Reassigned | Participants, Watchers, Subscribers, Custom notification level with this event selected, and the old assignee. | | Issue | Reopened | Subscribers and participants. | | Merge Request | Closed | Subscribers and participants. | -| Merge Request | Conflict | Author and any user that has set the merge request to automatically merge when pipeline succeeds. | +| Merge Request | Conflict | Author and any user that has set the merge request to auto-merge. | | Merge Request | [Marked as ready](../project/merge_requests/drafts.md) | Watchers and participants. _[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15332) in GitLab 13.10._ | | Merge Request | Merged | Subscribers and participants. | | Merge Request | Merged when pipeline succeeds | Author, Participants, Watchers, Subscribers, and Custom notification level with this event selected. Custom notification level is ignored for Author, Watchers and Subscribers. _[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211961) in GitLab 13.4._ | diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index a65c5518658..b7467843e1d 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -300,7 +300,7 @@ For a software developer working in a team: 1. Your manager: 1. Pushes a commit with their final review. 1. [Approves the merge request](approvals/index.md). - 1. Sets it to [merge when pipeline succeeds](merge_when_pipeline_succeeds.md). + 1. Sets it to [auto-merge](merge_when_pipeline_succeeds.md) (formerly **Merge when pipeline succeeds**). 1. Your changes get deployed to production with [manual jobs](../../../ci/jobs/job_control.md#create-a-job-that-must-be-run-manually) for GitLab CI/CD. 1. Your implementations were successfully shipped to your customer. diff --git a/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md b/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md index 7588af70bd4..6678bdd2ad0 100644 --- a/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md +++ b/doc/user/project/merge_requests/merge_when_pipeline_succeeds.md @@ -9,23 +9,23 @@ type: reference, concepts > **Merge when pipeline succeeds** and **Add to merge train when pipeline succeeds** [renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/409530) to **Auto-merge** in GitLab 16.0 [with a flag](../../../administration/feature_flags.md) named `auto_merge_labels_mr_widget`. Enabled by default. -NOTE: -[In GitLab 16.0 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/359057), **Merge when pipeline succeeds** and **Add to merge train when pipeline succeeds** become **Set to auto-merge**. - If you review a merge request and it's ready to merge, but the pipeline hasn't -completed yet, you can set it to merge when the pipeline succeeds (MWPS). You don't +completed yet, you can set it to auto-merge. You don't have to remember later to merge the work manually: -![Enable MWPS on a merge request](img/mwps_v15_4.png) +![Auto-merge a merge request](img/mwps_v15_4.png) + +NOTE: +[In GitLab 16.0 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/359057), **Merge when pipeline succeeds** and **Add to merge train when pipeline succeeds** are renamed **Set to auto-merge**. If the pipeline succeeds, the merge request is merged. If the pipeline fails, the author can either retry any failed jobs, or push new commits to fix the failure: - If a retried job succeeds on the second try, the merge request is merged. -- If new commits are added to the merge request, GitLab cancels the MWPS request +- If new commits are added to the merge request, GitLab cancels the request to ensure the new changes are reviewed before merge. -## Set a merge request to MWPS +## Auto-merge a merge request Prerequisites: @@ -44,15 +44,15 @@ To do this from the GitLab user interface: 1. Scroll to the merge request reports section. 1. Optional. Select your desired merge options, such as **Delete source branch**, **Squash commits**, or **Edit commit message**. -1. Select **Merge when pipeline succeeds**. +1. Select **Auto-merge**. -If a new comment is added to the merge request after you select **Merge when pipeline succeeds**, +If a new comment is added to the merge request after you select **Auto-merge**, but before the pipeline completes, GitLab blocks the merge until you resolve all existing threads. ## Cancel an auto-merge -If a merge request is set to MWPS, you can cancel it. +If a merge request is set to auto-merge, you can cancel it. Prerequisites: diff --git a/doc/user/project/merge_requests/widgets.md b/doc/user/project/merge_requests/widgets.md index a7aa86a16d4..6663e298a97 100644 --- a/doc/user/project/merge_requests/widgets.md +++ b/doc/user/project/merge_requests/widgets.md @@ -45,7 +45,7 @@ disabled. If the pipeline fails to deploy, the deployment information is hidden. For more information, [read about pipelines](../../../ci/pipelines/index.md). -## Merge when pipeline succeeds (MWPS) +## Set auto-merge Set a merge request that looks ready to merge to [merge automatically when CI pipeline succeeds](merge_when_pipeline_succeeds.md). diff --git a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb index 5c00da1f569..576ce23b058 100644 --- a/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_request/user_merges_when_pipeline_succeeds_spec.rb @@ -111,7 +111,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js, featur describe 'enabling Merge when pipeline succeeds' do shared_examples 'Set to auto-merge activator' do - it 'activates the Merge when pipeline succeeds feature' do + it 'activates the Merge when pipeline succeeds feature', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/410055' do click_button "Set to auto-merge" expect(page).to have_content "Set by #{user.name} to be merged automatically when the pipeline succeeds" diff --git a/spec/features/profiles/two_factor_auths_spec.rb b/spec/features/profiles/two_factor_auths_spec.rb index e8ff8416722..b52f66cfcee 100644 --- a/spec/features/profiles/two_factor_auths_spec.rb +++ b/spec/features/profiles/two_factor_auths_spec.rb @@ -62,6 +62,40 @@ RSpec.describe 'Two factor auths', feature_category: :user_profile do expect(page).to have_link('Try the troubleshooting steps here.', href: help_page_path('user/profile/account/two_factor_authentication.md', anchor: 'troubleshooting')) end end + + context 'when two factor is enforced in global settings' do + before do + stub_application_setting(require_two_factor_authentication: true) + end + + context 'when invalid pin is provided' do + let_it_be(:user) { create(:omniauth_user) } + + it 'renders alert for global settings' do + visit profile_two_factor_auth_path + + fill_in 'pin_code', with: '123' + click_button 'Register with two-factor app' + + expect(page).to have_content('The global settings require you to enable Two-Factor Authentication for your account. You need to do this before ') + end + end + + context 'when invalid password is provided' do + let_it_be(:user) { create(:user) } + + it 'renders a error alert with a link to the troubleshooting section' do + visit profile_two_factor_auth_path + + register_2fa(user.current_otp, 'abc') + click_button 'Register with two-factor app' + + expect(page).to have_content( + 'The global settings require you to enable Two-Factor Authentication for your account' + ) + end + end + end end context 'when user has two-factor authentication enabled' do -- cgit v1.2.1