From c097ca59a16661859dc192ca1c02c957c3025d46 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 21 Jun 2022 21:09:41 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- Gemfile.lock | 4 ++-- .../components/canary_update_modal.vue | 2 +- .../groups/components/group_name_and_path.vue | 6 ++++-- app/views/devise/shared/_signup_box.html.haml | 4 +++- .../_apply_template_warning.html.haml | 4 ++-- doc/api/projects.md | 8 ++++++++ lib/api/helpers/projects_helpers.rb | 2 ++ .../environments/canary_update_modal_spec.js | 2 +- .../components/group_name_and_path_spec.js | 17 ++++++++++++----- .../100_patch_omniauth_oauth2_spec.rb | 2 +- spec/requests/api/projects_spec.rb | 2 ++ 11 files changed, 38 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6b0488519ff..c0299cb5251 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -878,8 +878,8 @@ GEM omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.7.2) - oauth2 (~> 1.4) + omniauth-oauth2 (1.7.3) + oauth2 (>= 1.4, < 3) omniauth (>= 1.9, < 3) omniauth-oauth2-generic (0.2.2) omniauth-oauth2 (~> 1.0) diff --git a/app/assets/javascripts/environments/components/canary_update_modal.vue b/app/assets/javascripts/environments/components/canary_update_modal.vue index fd4885a9dbd..cacd868bed0 100644 --- a/app/assets/javascripts/environments/components/canary_update_modal.vue +++ b/app/assets/javascripts/environments/components/canary_update_modal.vue @@ -42,7 +42,7 @@ export default { modalId: CANARY_UPDATE_MODAL, actionPrimary: { text: s__('CanaryIngress|Change ratio'), - attributes: [{ variant: 'info' }], + attributes: [{ variant: 'confirm' }], }, actionCancel: { text: __('Cancel') }, static: true, diff --git a/app/assets/javascripts/groups/components/group_name_and_path.vue b/app/assets/javascripts/groups/components/group_name_and_path.vue index f9bd8701199..983535d3e9c 100644 --- a/app/assets/javascripts/groups/components/group_name_and_path.vue +++ b/app/assets/javascripts/groups/components/group_name_and_path.vue @@ -133,6 +133,8 @@ export default { signal: this.activeApiRequestAbortController.signal, }); + this.apiLoading = false; + if (exists) { if (suggests.length) { return Promise.resolve({ exists, suggests }); @@ -148,14 +150,14 @@ export default { return Promise.resolve({ exists, suggests }); } catch (error) { if (!axios.isCancel(error)) { + this.apiLoading = false; + createAlert({ message: this.$options.i18n.apiErrorMessage, }); } return Promise.reject(); - } finally { - this.apiLoading = false; } }, handlePathInput(value) { diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml index 57135c6cdfc..38e1e72e454 100644 --- a/app/views/devise/shared/_signup_box.html.haml +++ b/app/views/devise/shared/_signup_box.html.haml @@ -45,11 +45,13 @@ = f.label :email, class: 'label-bold' = f.email_field :email, value: @invite_email, - class: 'form-control gl-form-input middle', + class: 'form-control gl-form-input middle js-validate-email', data: { qa_selector: 'new_user_email_field' }, required: true, title: _('Please provide a valid email address.') %p.gl-field-hint.text-secondary= _('We recommend a work email address.') + -# This is used for providing entry to Jihu on email verification + = render_if_exists 'devise/shared/signup_email_additional_info' .form-group.gl-mb-5#password-strength = f.label :password, class: 'label-bold' = f.password_field :password, diff --git a/app/views/shared/form_elements/_apply_template_warning.html.haml b/app/views/shared/form_elements/_apply_template_warning.html.haml index ca1d3d53f16..131c450ddd7 100644 --- a/app/views/shared/form_elements/_apply_template_warning.html.haml +++ b/app/views/shared/form_elements/_apply_template_warning.html.haml @@ -7,7 +7,7 @@ %p = _("Applying a template will replace the existing issue description. Any changes you have made will be lost.") - %button.js-override-template.btn.gl-button.btn-confirm.mr-2{ type: 'button' } + = render Pajamas::ButtonComponent.new(variant: :confirm, button_options: { class: 'gl-mr-3 js-override-template' }) do = _("Apply template") - %button.js-close-btn.js-cancel-btn.btn.gl-button.btn-default{ type: 'button' } + = render Pajamas::ButtonComponent.new(button_options: { class: 'js-close-btn js-cancel-btn' }) do = _("Cancel") diff --git a/doc/api/projects.md b/doc/api/projects.md index 3cb75c39980..45c675c0b82 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -175,6 +175,7 @@ When the user is authenticated and `simple` is not set this returns something li "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 50, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, @@ -282,6 +283,7 @@ When the user is authenticated and `simple` is not set this returns something li "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 0, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, @@ -470,6 +472,7 @@ GET /users/:user_id/projects "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 50, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, @@ -577,6 +580,7 @@ GET /users/:user_id/projects "runners_token": "b8547b1dc37721d05889db52fa2f02", "ci_default_git_depth": 0, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, @@ -983,6 +987,7 @@ GET /projects/:id "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b", "ci_default_git_depth": 50, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [ { @@ -1422,6 +1427,7 @@ Supported attributes: | `ci_config_path` | string | **{dotted-circle}** No | The path to CI configuration file. | | `ci_default_git_depth` | integer | **{dotted-circle}** No | Default number of revisions for [shallow cloning](../ci/pipelines/settings.md#limit-the-number-of-changes-fetched-during-clone). | | `ci_forward_deployment_enabled` | boolean | **{dotted-circle}** No | When a new deployment job starts, [skip older deployment jobs](../ci/pipelines/settings.md#skip-outdated-deployment-jobs) that are still pending | +| `ci_separated_caches` | boolean | **{dotted-circle}** No | Set whether or not caches should be [separated](../ci/caching/index.md#cache-key-names) by branch protection status. | | `container_expiration_policy_attributes` | hash | **{dotted-circle}** No | Update the image cleanup policy for this project. Accepts: `cadence` (string), `keep_n` (integer), `older_than` (string), `name_regex` (string), `name_regex_delete` (string), `name_regex_keep` (string), `enabled` (boolean). | | `container_registry_access_level` | string | **{dotted-circle}** No | Set visibility of container registry, for this project, to one of `disabled`, `private` or `enabled`. | | `container_registry_enabled` | boolean | **{dotted-circle}** No | _(Deprecated)_ Enable container registry for this project. Use `container_registry_access_level` instead. | @@ -1997,6 +2003,7 @@ Example response: "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b", "ci_default_git_depth": 50, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, @@ -2122,6 +2129,7 @@ Example response: "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b", "ci_default_git_depth": 50, "ci_forward_deployment_enabled": true, + "ci_separated_caches": true, "public_jobs": true, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, diff --git a/lib/api/helpers/projects_helpers.rb b/lib/api/helpers/projects_helpers.rb index 52cb398d6bf..3a518959b2c 100644 --- a/lib/api/helpers/projects_helpers.rb +++ b/lib/api/helpers/projects_helpers.rb @@ -96,6 +96,7 @@ module API params :optional_update_params_ce do optional :ci_forward_deployment_enabled, type: Boolean, desc: 'Skip older deployment jobs that are still pending' + optional :ci_separated_caches, type: Boolean, desc: 'Enable or disable separated caches based on branch protection.' optional :restrict_user_defined_variables, type: Boolean, desc: 'Restrict use of user-defined variables when triggering a pipeline' end @@ -130,6 +131,7 @@ module API :ci_config_path, :ci_default_git_depth, :ci_forward_deployment_enabled, + :ci_separated_caches, :container_registry_access_level, :container_expiration_policy_attributes, :default_branch, diff --git a/spec/frontend/environments/canary_update_modal_spec.js b/spec/frontend/environments/canary_update_modal_spec.js index 22d13558a84..16792dcda1e 100644 --- a/spec/frontend/environments/canary_update_modal_spec.js +++ b/spec/frontend/environments/canary_update_modal_spec.js @@ -47,7 +47,7 @@ describe('/environments/components/canary_update_modal.vue', () => { modalId: 'confirm-canary-change', actionPrimary: { text: 'Change ratio', - attributes: [{ variant: 'info' }], + attributes: [{ variant: 'confirm' }], }, actionCancel: { text: 'Cancel' }, }); diff --git a/spec/frontend/groups/components/group_name_and_path_spec.js b/spec/frontend/groups/components/group_name_and_path_spec.js index eaa0801ab50..9c9bdead6fa 100644 --- a/spec/frontend/groups/components/group_name_and_path_spec.js +++ b/spec/frontend/groups/components/group_name_and_path_spec.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { merge } from 'lodash'; import { GlAlert } from '@gitlab/ui'; import { mountExtended, extendedWrapper } from 'helpers/vue_test_utils_helper'; @@ -50,17 +51,17 @@ describe('GroupNameAndPath', () => { const findAlert = () => extendedWrapper(wrapper.findComponent(GlAlert)); const apiMockAvailablePath = () => { - getGroupPathAvailability.mockResolvedValue({ + getGroupPathAvailability.mockResolvedValueOnce({ data: { exists: false, suggests: [] }, }); }; const apiMockUnavailablePath = (suggests = [mockGroupUrlSuggested]) => { - getGroupPathAvailability.mockResolvedValue({ + getGroupPathAvailability.mockResolvedValueOnce({ data: { exists: true, suggests }, }); }; const apiMockLoading = () => { - getGroupPathAvailability.mockImplementation(() => new Promise(() => {})); + getGroupPathAvailability.mockImplementationOnce(() => new Promise(() => {})); }; const expectLoadingMessageExists = () => { @@ -169,7 +170,7 @@ describe('GroupNameAndPath', () => { describe('when API call fails', () => { it('calls `createAlert`', async () => { - getGroupPathAvailability.mockRejectedValue({}); + getGroupPathAvailability.mockRejectedValueOnce({}); createComponent(); @@ -184,14 +185,20 @@ describe('GroupNameAndPath', () => { describe('when multiple API calls are in-flight', () => { it('aborts the first API call and resolves second API call', async () => { - apiMockLoading(); + getGroupPathAvailability.mockRejectedValueOnce({ __CANCEL__: true }); apiMockUnavailablePath(); + const abortSpy = jest.spyOn(AbortController.prototype, 'abort'); createComponent(); await findGroupNameField().setValue('Foo'); await findGroupNameField().setValue(mockGroupName); + + // Wait for re-render to ensure loading message is still there + await nextTick(); + expectLoadingMessageExists(); + await waitForPromises(); expect(createAlert).not.toHaveBeenCalled(); diff --git a/spec/initializers/100_patch_omniauth_oauth2_spec.rb b/spec/initializers/100_patch_omniauth_oauth2_spec.rb index c30a1cdeafa..36a14816b7e 100644 --- a/spec/initializers/100_patch_omniauth_oauth2_spec.rb +++ b/spec/initializers/100_patch_omniauth_oauth2_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'OmniAuth::Strategies::OAuth2' do it 'verifies the gem version' do current_version = OmniAuth::OAuth2::VERSION - expected_version = '1.7.2' + expected_version = '1.7.3' expect(current_version).to eq(expected_version), <<~EOF New version #{current_version} of the `omniauth-oauth2` gem detected! diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 431d2e56cb5..36f8270f2d3 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -2388,6 +2388,7 @@ RSpec.describe API::Projects do expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to eq(project.only_allow_merge_if_all_discussions_are_resolved) expect(json_response['ci_default_git_depth']).to eq(project.ci_default_git_depth) expect(json_response['ci_forward_deployment_enabled']).to eq(project.ci_forward_deployment_enabled) + expect(json_response['ci_separated_caches']).to eq(project.ci_separated_caches) expect(json_response['merge_method']).to eq(project.merge_method.to_s) expect(json_response['squash_option']).to eq(project.squash_option.to_s) expect(json_response['readme_url']).to eq(project.readme_url) @@ -3652,6 +3653,7 @@ RSpec.describe API::Projects do merge_method: 'ff', ci_default_git_depth: 20, ci_forward_deployment_enabled: false, + ci_separated_caches: false, description: 'new description' } put api("/projects/#{project3.id}", user4), params: project_param