Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-02-06 06:09:03 +00:00
parent c986052d53
commit c72af65710
20 changed files with 84 additions and 76 deletions

View File

@ -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"
/>
<board-content
:board-id="boardId"

View File

@ -2,7 +2,6 @@
import { GlModal, GlAlert } from '@gitlab/ui';
import { visitUrl } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale';
import eventHub from '~/boards/eventhub';
import { formType } from '../constants';
import { setError } from '../graphql/cache_updates';
@ -221,7 +220,7 @@ export default {
try {
const board = await this.createOrUpdateBoard();
if (this.board.id) {
eventHub.$emit('updateBoard', board);
this.$emit('updateBoard', board);
} else {
this.$emit('addBoard', board);
}

View File

@ -73,7 +73,6 @@ export default {
},
data() {
return {
scrollOffset: 250,
showCount: false,
showIssueForm: false,
showEpicForm: false,
@ -246,10 +245,8 @@ export default {
handler(id, oldVal) {
if (id) {
eventHub.$on(`${this.toggleFormEventPrefix}${this.list.id}`, this.toggleForm);
eventHub.$on(`scroll-board-list-${this.list.id}`, this.scrollToTop);
eventHub.$off(`${this.toggleFormEventPrefix}${oldVal}`, this.toggleForm);
eventHub.$off(`scroll-board-list-${oldVal}`, this.scrollToTop);
}
},
immediate: true,
@ -257,7 +254,6 @@ export default {
},
beforeDestroy() {
eventHub.$off(`${this.toggleFormEventPrefix}${this.list.id}`, this.toggleForm);
eventHub.$off(`scroll-board-list-${this.list.id}`, this.scrollToTop);
},
methods: {
listHeight() {
@ -266,12 +262,6 @@ export default {
scrollHeight() {
return this.listRef?.scrollHeight || 0;
},
scrollTop() {
return this.listRef.scrollTop + this.listHeight();
},
scrollToTop() {
this.listRef.scrollTop = 0;
},
async loadNextPage() {
this.isLoadingMore = true;
await this.$apollo.queries.currentList.fetchMore({

View File

@ -243,7 +243,7 @@ export default {
},
showNewIssueForm() {
if (this.isSwimlanesHeader) {
eventHub.$emit('open-unassigned-lane');
this.$emit('openUnassignedLane');
this.$nextTick(() => {
eventHub.$emit(`${toggleFormEventPrefix.issue}${this.list.id}`);
});

View File

@ -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,

View File

@ -97,6 +97,7 @@ export default {
:board="board"
:is-current-board-loading="isLoading"
@switchBoard="$emit('switchBoard', $event)"
@updateBoard="$emit('updateBoard', $event)"
/>
<new-board-button />
<issue-board-filtered-search

View File

@ -329,6 +329,7 @@ export default {
:current-board="board"
:current-page="currentPage"
@addBoard="addBoard"
@updateBoard="$emit('updateBoard', $event)"
@cancel="cancel"
/>
</span>

View File

@ -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.

View File

@ -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:

View File

@ -106,6 +106,24 @@ You can read more about the new OpenTofu CI/CD component [here](https://gitlab.c
<div class="deprecation breaking-change" data-milestone="18.0">
### Deprecate license metadata format V1
<div class="deprecation-notes">
- Announced in GitLab <span class="milestone">16.9</span>
- Removal in GitLab <span class="milestone">18.0</span> ([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).
</div>
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.
</div>
<div class="deprecation breaking-change" data-milestone="18.0">
### GitLab Runner registration token in Runner Operator
<div class="deprecation-notes">
@ -665,24 +683,6 @@ The runner's legacy escape sequence mechanism to handle variable expansion imple
<div class="deprecation breaking-change" data-milestone="17.0">
### Deprecate license metadata format V1
<div class="deprecation-notes">
- Announced in GitLab <span class="milestone">16.9</span>
- Removal in GitLab <span class="milestone">17.0</span> ([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).
</div>
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.
</div>
<div class="deprecation breaking-change" data-milestone="17.0">
### Deprecated parameters related to custom text in the sign-in page
<div class="deprecation-notes">

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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!

View File

@ -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 () => {

View File

@ -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 () => {

View File

@ -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');

View File

@ -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', () => {

View File

@ -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