From c72af65710ff6642d282b0e34d043ba92011ee49 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 6 Feb 2024 06:09:03 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../boards/components/board_app.vue | 4 +-- .../boards/components/board_form.vue | 3 +- .../boards/components/board_list.vue | 10 ------ .../boards/components/board_list_header.vue | 2 +- .../boards/components/board_new_item.vue | 3 -- .../boards/components/board_top_bar.vue | 1 + .../boards/components/boards_selector.vue | 1 + ...9-deprecate-v1-license-metadata-format.yml | 4 +-- doc/ci/components/index.md | 7 +++- doc/update/deprecations.md | 36 +++++++++---------- .../lib/gitlab/housekeeper/runner.rb | 4 ++- .../gitlab/housekeeper/gitlab_client_spec.rb | 22 +++++++++--- .../spec/gitlab/housekeeper/runner_spec.rb | 10 +++--- keeps/helpers/postgres_ai.rb | 2 +- .../overdue_finalize_background_migration.rb | 6 ++-- .../boards/components/board_app_spec.js | 15 ++++---- .../boards/components/board_form_spec.js | 15 ++++---- .../boards/components/board_new_item_spec.js | 8 ----- .../boards/components/board_top_bar_spec.js | 5 +++ spec/keeps/helpers/postgres_ai_spec.rb | 2 +- 20 files changed, 84 insertions(+), 76 deletions(-) diff --git a/app/assets/javascripts/boards/components/board_app.vue b/app/assets/javascripts/boards/components/board_app.vue index b1b3e7f7022..08a167e53aa 100644 --- a/app/assets/javascripts/boards/components/board_app.vue +++ b/app/assets/javascripts/boards/components/board_app.vue @@ -5,7 +5,6 @@ import { s__ } from '~/locale'; import BoardContent from '~/boards/components/board_content.vue'; import BoardSettingsSidebar from '~/boards/components/board_settings_sidebar.vue'; import BoardTopBar from '~/boards/components/board_top_bar.vue'; -import eventHub from '~/boards/eventhub'; import { listsQuery, FilterFields } from 'ee_else_ce/boards/constants'; import { formatBoardLists, filterVariables, FiltersInfo } from 'ee_else_ce/boards/boards_util'; import activeBoardItemQuery from 'ee_else_ce/boards/graphql/client/active_board_item.query.graphql'; @@ -113,11 +112,9 @@ export default { }, created() { window.addEventListener('popstate', refreshCurrentPage); - eventHub.$on('updateBoard', this.refetchLists); }, destroyed() { window.removeEventListener('popstate', refreshCurrentPage); - eventHub.$off('updateBoard', this.refetchLists); }, methods: { refetchLists() { @@ -148,6 +145,7 @@ export default { @setFilters="setFilters" @setAddColumnFormVisibility="addColumnFormVisible = $event" @toggleSwimlanes="isShowingEpicsSwimlanes = $event" + @updateBoard="refetchLists" /> { eventHub.$emit(`${toggleFormEventPrefix.issue}${this.list.id}`); }); diff --git a/app/assets/javascripts/boards/components/board_new_item.vue b/app/assets/javascripts/boards/components/board_new_item.vue index 084b7519d1f..a4e1b8ef273 100644 --- a/app/assets/javascripts/boards/components/board_new_item.vue +++ b/app/assets/javascripts/boards/components/board_new_item.vue @@ -2,8 +2,6 @@ import { GlForm, GlFormInput, GlButton } from '@gitlab/ui'; import { __ } from '~/locale'; -import eventHub from '../eventhub'; - export default { i18n: { cancel: __('Cancel'), @@ -58,7 +56,6 @@ export default { handleFormSubmit() { const { title, list } = this; - eventHub.$emit(`scroll-board-list-${this.list.id}`); this.$emit('form-submit', { title: title.trim(), list, diff --git a/app/assets/javascripts/boards/components/board_top_bar.vue b/app/assets/javascripts/boards/components/board_top_bar.vue index d1f0e3f843f..820c1fc1dd1 100644 --- a/app/assets/javascripts/boards/components/board_top_bar.vue +++ b/app/assets/javascripts/boards/components/board_top_bar.vue @@ -97,6 +97,7 @@ export default { :board="board" :is-current-board-loading="isLoading" @switchBoard="$emit('switchBoard', $event)" + @updateBoard="$emit('updateBoard', $event)" /> diff --git a/data/deprecations/16-9-deprecate-v1-license-metadata-format.yml b/data/deprecations/16-9-deprecate-v1-license-metadata-format.yml index 774bde9d645..00e9a5554db 100644 --- a/data/deprecations/16-9-deprecate-v1-license-metadata-format.yml +++ b/data/deprecations/16-9-deprecate-v1-license-metadata-format.yml @@ -1,5 +1,5 @@ - title: "Deprecate license metadata format V1" - removal_milestone: "17.0" + removal_milestone: "18.0" announcement_milestone: "16.9" breaking_change: true reporter: thiagocsf @@ -7,7 +7,7 @@ issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/438477 body: | # (required) Don't change this line. The license metadata format V1 dataset has been deprecated and will be removed - in GitLab 17.0. + in GitLab 18.0. Users who have the `package_metadata_synchronization` feature flag enabled are advised to upgrade to GitLab 16.3 or above, and remove the feature flag configuration. diff --git a/doc/ci/components/index.md b/doc/ci/components/index.md index 0dfa979071a..0b2d2122bc1 100644 --- a/doc/ci/components/index.md +++ b/doc/ci/components/index.md @@ -48,7 +48,12 @@ to a dedicated component project. To create a component project, you must: -1. [Create a new project](../../user/project/index.md#create-a-blank-project) with a `README.md` file. +1. [Create a new project](../../user/project/index.md#create-a-blank-project) with a `README.md` file: + - Ensure the description gives a clear introduction to the component. + - Optional. After the project is created, you can [add a project avatar](../../user/project/working_with_projects.md#edit-project-name-and-description). + + Components published to the [CI/CD catalog](#cicd-catalog) use both the description and avatar when displaying the component project's summary. + 1. Add a YAML configuration file for each component, following the [required directory structure](#directory-structure). For example: diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md index 81958f04e71..7aea7a5a2bf 100644 --- a/doc/update/deprecations.md +++ b/doc/update/deprecations.md @@ -106,6 +106,24 @@ You can read more about the new OpenTofu CI/CD component [here](https://gitlab.c
+### Deprecate license metadata format V1 + +
+- Announced in GitLab 16.9 +- Removal in GitLab 18.0 ([breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change)) +- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/438477). +
+ +The license metadata format V1 dataset has been deprecated and will be removed +in GitLab 18.0. + +Users who have the `package_metadata_synchronization` feature flag enabled are advised to +upgrade to GitLab 16.3 or above, and remove the feature flag configuration. + +
+ +
+ ### GitLab Runner registration token in Runner Operator
@@ -665,24 +683,6 @@ The runner's legacy escape sequence mechanism to handle variable expansion imple
-### Deprecate license metadata format V1 - -
-- Announced in GitLab 16.9 -- Removal in GitLab 17.0 ([breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change)) -- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/438477). -
- -The license metadata format V1 dataset has been deprecated and will be removed -in GitLab 17.0. - -Users who have the `package_metadata_synchronization` feature flag enabled are advised to -upgrade to GitLab 16.3 or above, and remove the feature flag configuration. - -
- -
- ### Deprecated parameters related to custom text in the sign-in page
diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb index 1826dff3f7f..e6a28a92512 100644 --- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb +++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb @@ -116,7 +116,7 @@ module Gitlab Shell.execute('git', 'push', '-f', 'housekeeper', "#{branch_name}:#{branch_name}") end - gitlab_client.create_or_update_merge_request( + mr = gitlab_client.create_or_update_merge_request( change: change, source_project_id: housekeeper_fork_project_id, source_branch: branch_name, @@ -127,6 +127,8 @@ module Gitlab update_labels: !non_housekeeper_changes.include?(:labels), update_reviewers: !non_housekeeper_changes.include?(:reviewers) ) + + puts "Merge request URL: #{mr['web_url'].yellowish}" end def housekeeper_fork_project_id diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/gitlab_client_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/gitlab_client_spec.rb index c52a98058e3..c6595a4326e 100644 --- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/gitlab_client_spec.rb +++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/gitlab_client_spec.rb @@ -274,6 +274,10 @@ RSpec.describe ::Gitlab::Housekeeper::GitlabClient do end it 'calls the GitLab API passing the token' do + api_response = { + iid: 5678, + web_url: 'https://example.com/api/v4/merge_requests/abc123/5678' + } stub = stub_request(:post, "https://gitlab.com/api/v4/projects/123/merge_requests") .with( body: { @@ -290,11 +294,14 @@ RSpec.describe ::Gitlab::Housekeeper::GitlabClient do 'Content-Type' => 'application/json', 'Private-Token' => 'the-api-token' }) - .to_return(status: 200, body: '{}') + .to_return(status: 200, body: api_response.to_json) - client.create_or_update_merge_request(**params) + result = client.create_or_update_merge_request(**params) expect(stub).to have_been_requested + + expect(result['iid']).to eq(5678) + expect(result['web_url']).to eq('https://example.com/api/v4/merge_requests/abc123/5678') end context 'when the merge request for the branch already exists' do @@ -303,6 +310,10 @@ RSpec.describe ::Gitlab::Housekeeper::GitlabClient do end it 'updates the merge request' do + api_response = { + iid: 1234, + web_url: 'https://example.com/api/v4/merge_requests/abc123/1234' + } stub = stub_request(:put, "https://gitlab.com/api/v4/projects/456/merge_requests/1234") .with( body: { @@ -315,10 +326,13 @@ RSpec.describe ::Gitlab::Housekeeper::GitlabClient do 'Content-Type' => 'application/json', 'Private-Token' => 'the-api-token' }) - .to_return(status: 200, body: '{}') + .to_return(status: 200, body: api_response.to_json) - client.create_or_update_merge_request(**params) + result = client.create_or_update_merge_request(**params) expect(stub).to have_been_requested + + expect(result['iid']).to eq(1234) + expect(result['web_url']).to eq('https://example.com/api/v4/merge_requests/abc123/1234') end context 'when multiple merge requests exist' do diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb index 13f58f52771..38674d35f31 100644 --- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb +++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb @@ -98,7 +98,7 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do update_description: true, update_labels: true, update_reviewers: true - ) + ).and_return({ 'web_url' => 'https://example.com' }) expect(gitlab_client).to receive(:create_or_update_merge_request) .with( change: change2, @@ -110,7 +110,7 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do update_description: true, update_labels: true, update_reviewers: true - ) + ).and_return({ 'web_url' => 'https://example.com' }) described_class.new(max_mrs: 2, keeps: [fake_keep]).run end @@ -142,7 +142,7 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do update_description: true, update_labels: true, update_reviewers: true - ) + ).and_return({ 'web_url' => 'https://example.com' }) described_class.new(max_mrs: 2, keeps: [fake_keep], filter_identifiers: [/second/]).run end @@ -186,7 +186,7 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do update_description: false, update_labels: true, update_reviewers: false - ) + ).and_return({ 'web_url' => 'https://example.com' }) expect(gitlab_client).to receive(:create_or_update_merge_request) .with( change: change2, @@ -198,7 +198,7 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do update_description: false, update_labels: true, update_reviewers: true - ) + ).and_return({ 'web_url' => 'https://example.com' }) described_class.new(max_mrs: 2, keeps: [fake_keep]).run end diff --git a/keeps/helpers/postgres_ai.rb b/keeps/helpers/postgres_ai.rb index c4cee13325c..e4833e14038 100644 --- a/keeps/helpers/postgres_ai.rb +++ b/keeps/helpers/postgres_ai.rb @@ -11,7 +11,7 @@ module Keeps def fetch_background_migration_status(job_class_name) query = <<~SQL - SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name + SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name, gitlab_schema FROM batched_background_migrations WHERE job_class_name = $1::text SQL diff --git a/keeps/overdue_finalize_background_migration.rb b/keeps/overdue_finalize_background_migration.rb index 9c1da8a8cb2..f56789b6da8 100644 --- a/keeps/overdue_finalize_background_migration.rb +++ b/keeps/overdue_finalize_background_migration.rb @@ -81,7 +81,7 @@ module Keeps migration_file = generator.invoke_all.first change.changed_files = [migration_file] - add_ensure_call_to_migration(migration_file, queue_method_node, job_name) + add_ensure_call_to_migration(migration_file, queue_method_node, job_name, migration_record) ::Gitlab::Housekeeper::Shell.execute('rubocop', '-a', migration_file) digest = Digest::SHA256.hexdigest(generator.migration_number) @@ -126,7 +126,7 @@ module Keeps nil end - def add_ensure_call_to_migration(file, queue_method_node, job_name) + def add_ensure_call_to_migration(file, queue_method_node, job_name, migration_record) source = RuboCop::ProcessedSource.new(File.read(file), 3.1) ast = source.ast source_buffer = source.buffer @@ -140,7 +140,7 @@ module Keeps column_name = queue_method_node.children[4] job_arguments = queue_method_node.children[5..].select { |s| s.type != :hash } # All remaining non-keyword args - gitlab_schema = ::Gitlab::Database::GitlabSchema.table_schema(table_name.value.to_s) + gitlab_schema = migration_record.gitlab_schema added_content = <<~RUBY.strip disable_ddl_transaction! diff --git a/spec/frontend/boards/components/board_app_spec.js b/spec/frontend/boards/components/board_app_spec.js index 9452e3e10c9..0296c1eeb91 100644 --- a/spec/frontend/boards/components/board_app_spec.js +++ b/spec/frontend/boards/components/board_app_spec.js @@ -5,7 +5,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import BoardApp from '~/boards/components/board_app.vue'; -import eventHub from '~/boards/eventhub'; +import BoardTopBar from '~/boards/components/board_top_bar.vue'; import activeBoardItemQuery from 'ee_else_ce/boards/graphql/client/active_board_item.query.graphql'; import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql'; import * as cacheUpdates from '~/boards/graphql/cache_updates'; @@ -15,6 +15,8 @@ describe('BoardApp', () => { let wrapper; let mockApollo; + const findBoardTopBar = () => wrapper.findComponent(BoardTopBar); + const errorMessage = 'Failed to fetch lists'; const boardListQueryHandler = jest.fn().mockResolvedValue(boardListsQueryResponse); const boardListQueryHandlerFailure = jest.fn().mockRejectedValue(new Error(errorMessage)); @@ -37,9 +39,9 @@ describe('BoardApp', () => { initialBoardId: 'gid://gitlab/Board/1', initialFilterParams: {}, issuableType: 'issue', - boardType: 'group', + boardType: 'project', isIssueBoard: true, - isGroupBoard: true, + isGroupBoard: false, }, }); }; @@ -66,13 +68,12 @@ describe('BoardApp', () => { expect(wrapper.classes()).not.toContain('is-compact'); }); - it('refetches lists when updateBoard event is received', async () => { - jest.spyOn(eventHub, '$on').mockImplementation(() => {}); - + it('refetches lists when top bar emits updateBoard event', async () => { createComponent(); await waitForPromises(); + findBoardTopBar().vm.$emit('updateBoard'); - expect(eventHub.$on).toHaveBeenCalledWith('updateBoard', wrapper.vm.refetchLists); + expect(boardListQueryHandler).toHaveBeenCalled(); }); it('sets error on fetch lists failure', async () => { diff --git a/spec/frontend/boards/components/board_form_spec.js b/spec/frontend/boards/components/board_form_spec.js index 16947a0512d..2a78643990c 100644 --- a/spec/frontend/boards/components/board_form_spec.js +++ b/spec/frontend/boards/components/board_form_spec.js @@ -11,7 +11,6 @@ import { formType } from '~/boards/constants'; import createBoardMutation from '~/boards/graphql/board_create.mutation.graphql'; import destroyBoardMutation from '~/boards/graphql/board_destroy.mutation.graphql'; import updateBoardMutation from '~/boards/graphql/board_update.mutation.graphql'; -import eventHub from '~/boards/eventhub'; import * as cacheUpdates from '~/boards/graphql/cache_updates'; import { visitUrl } from '~/lib/utils/url_utility'; @@ -279,11 +278,15 @@ describe('BoardForm', () => { await waitForPromises(); expect(global.window.location.href).not.toContain('?group_by=epic'); - expect(eventHub.$emit).toHaveBeenCalledTimes(1); - expect(eventHub.$emit).toHaveBeenCalledWith('updateBoard', { - id: 'gid://gitlab/Board/321', - webPath: 'test-path', - }); + expect(wrapper.emitted('updateBoard').length).toBe(1); + expect(wrapper.emitted('updateBoard')).toEqual([ + [ + { + id: 'gid://gitlab/Board/321', + webPath: 'test-path', + }, + ], + ]); }); it('calls GraphQL mutation with correct parameters when issues are grouped by epic', async () => { diff --git a/spec/frontend/boards/components/board_new_item_spec.js b/spec/frontend/boards/components/board_new_item_spec.js index f11eb2baca7..23acba3595a 100644 --- a/spec/frontend/boards/components/board_new_item_spec.js +++ b/spec/frontend/boards/components/board_new_item_spec.js @@ -3,7 +3,6 @@ import { nextTick } from 'vue'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import BoardNewItem from '~/boards/components/board_new_item.vue'; -import eventHub from '~/boards/eventhub'; import { mockList } from '../mock_data'; @@ -111,13 +110,6 @@ describe('BoardNewItem', () => { ]); }); - it('emits `scroll-board-list-` event with list.id on eventHub when `submit` is triggered on gl-form', async () => { - jest.spyOn(eventHub, '$emit').mockImplementation(); - await glForm().trigger('submit'); - - expect(eventHub.$emit).toHaveBeenCalledWith(`scroll-board-list-${mockList.id}`); - }); - it('emits `form-cancel` event and clears title value when `reset` is triggered on gl-form', async () => { titleInput().setValue('Foo'); diff --git a/spec/frontend/boards/components/board_top_bar_spec.js b/spec/frontend/boards/components/board_top_bar_spec.js index 477c504ecba..332f6548502 100644 --- a/spec/frontend/boards/components/board_top_bar_spec.js +++ b/spec/frontend/boards/components/board_top_bar_spec.js @@ -103,6 +103,11 @@ describe('BoardTopBar', () => { wrapper.findComponent(IssueBoardFilteredSearch).vm.$emit('setFilters'); expect(wrapper.emitted('setFilters')).toHaveLength(1); }); + + it('emits updateBoard when updateBoard is emitted by boards selector', () => { + wrapper.findComponent(BoardsSelector).vm.$emit('updateBoard'); + expect(wrapper.emitted('updateBoard')).toHaveLength(1); + }); }); describe('when user can admin list', () => { diff --git a/spec/keeps/helpers/postgres_ai_spec.rb b/spec/keeps/helpers/postgres_ai_spec.rb index e3003be3460..f7f11915224 100644 --- a/spec/keeps/helpers/postgres_ai_spec.rb +++ b/spec/keeps/helpers/postgres_ai_spec.rb @@ -39,7 +39,7 @@ RSpec.describe Keeps::Helpers::PostgresAi, feature_category: :tooling do let(:job_class_name) { 'ExampleJob' } let(:query) do <<~SQL - SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name + SELECT id, created_at, updated_at, finished_at, started_at, status, job_class_name, gitlab_schema FROM batched_background_migrations WHERE job_class_name = $1::text SQL