Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-03-25 00:09:18 +00:00
parent e0e980334d
commit 0a209fd10e
12 changed files with 149 additions and 39 deletions

View File

@ -359,32 +359,34 @@ db:check-migrations:
- scripts/validate_migration_schema
allow_failure: true
db:migrate-from-v12.10.0:
extends: .db-job-base
variables:
SETUP_DB: "false"
script:
- export PROJECT_TO_CHECKOUT="gitlab"
- export TAG_TO_CHECKOUT="v12.10.0-ee"
- '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab-foss"'
- '[[ -d "ee/" ]] || export TAG_TO_CHECKOUT="v12.10.0"'
- retry 'git fetch https://gitlab.com/gitlab-org/$PROJECT_TO_CHECKOUT.git $TAG_TO_CHECKOUT'
- git checkout -f FETCH_HEAD
- sed -i -e "s/gem 'grpc', '~> 1.24.0'/gem 'grpc', '~> 1.30.2'/" Gemfile # Update gRPC for Ruby 2.7
- sed -i -e "s/gem 'google-protobuf', '~> 3.8.0'/gem 'google-protobuf', '~> 3.12.0'/" Gemfile
- gem install bundler:1.17.3
- bundle update google-protobuf grpc bootsnap
- bundle install $BUNDLE_INSTALL_FLAGS
- date
- cp config/gitlab.yml.example config/gitlab.yml
- bundle exec rake db:drop db:create db:structure:load db:seed_fu
- date
- git checkout -f $CI_COMMIT_SHA
- bundle install $BUNDLE_INSTALL_FLAGS
- date
- . scripts/prepare_build.sh
- date
- bundle exec rake db:migrate
# Temporarily disabled due to failures in https://gitlab.com/gitlab-org/gitlab/-/issues/325838
# db:migrate-from-v12.10.0:
# extends: .db-job-base
# variables:
# SETUP_DB: "false"
# script:
# - export PROJECT_TO_CHECKOUT="gitlab"
# - export TAG_TO_CHECKOUT="v12.10.0-ee"
# - '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab-foss"'
# - '[[ -d "ee/" ]] || export TAG_TO_CHECKOUT="v12.10.0"'
# - retry 'git fetch https://gitlab.com/gitlab-org/$PROJECT_TO_CHECKOUT.git $TAG_TO_CHECKOUT'
# - git checkout -f FETCH_HEAD
# - sed -i -e "s/gem 'grpc', '~> 1.24.0'/gem 'grpc', '~> 1.30.2'/" Gemfile # Update gRPC for Ruby 2.7
# - sed -i -e "s/gem 'google-protobuf', '~> 3.8.0'/gem 'google-protobuf', '~> 3.12.0'/" Gemfile
# - gem install bundler:1.17.3
# - bundle update google-protobuf grpc bootsnap
# - bundle install $BUNDLE_INSTALL_FLAGS
# - date
# - cp config/gitlab.yml.example config/gitlab.yml
# - bundle exec rake db:drop db:create db:structure:load db:seed_fu
# - date
# - git checkout -f $CI_COMMIT_SHA
# - bundle install $BUNDLE_INSTALL_FLAGS
# - date
# - . scripts/prepare_build.sh
# - date
# - bundle exec rake db:migrate
db:rollback:
extends: .db-job-base

View File

@ -0,0 +1,18 @@
<script>
import { EditorContent } from 'tiptap';
import createEditor from '../services/create_editor';
export default {
components: {
EditorContent,
},
data() {
return {
editor: createEditor(),
};
},
};
</script>
<template>
<editor-content :editor="editor" />
</template>

View File

@ -1,7 +1,7 @@
const createEditor = async ({ content }) => {
const { Editor } = await import(/* webpackChunkName: 'tiptap' */ 'tiptap');
const { Bold, Code } = await import(/* webpackChunkName: 'tiptap' */ 'tiptap-extensions');
import { Editor } from 'tiptap';
import { Bold, Code } from 'tiptap-extensions';
const createEditor = ({ content } = {}) => {
return new Editor({
extensions: [new Bold(), new Code()],
content,

View File

@ -307,6 +307,14 @@ module.exports = {
chunks: 'initial',
minChunks: autoEntriesCount * 0.9,
}),
tiptap: {
priority: 17,
name: 'tiptap',
chunks: 'all',
test: /[\\/]node_modules[\\/](tiptap|prosemirror)-?\w*[\\/]/,
minChunks: 2,
reuseExistingChunk: true,
},
graphql: {
priority: 16,
name: 'graphql',

View File

@ -93,11 +93,13 @@ mechanics of what is required is [documented below](#data-file) but, in principl
## How it works
The global nav has 3 components:
The global nav has five levels:
- **Section**
- Category
- Doc
- Doc
- Doc
The available sections are described on the table below:
@ -203,10 +205,10 @@ add the attribute `external_url: true` below the category title. Example:
#### Docs
Each doc represents the third level of nav links. They must be always
Each doc represents the third, fourth, and fifth level of nav links. They must be always
added within a category.
Example with one doc link:
Example with three doc links, one at each level:
```yaml
- category_title: Category title
@ -214,10 +216,16 @@ Example with one doc link:
docs:
- doc_title: Document title
doc_url: 'doc-link'
docs:
- doc_title: Document title
doc_url: 'doc-link'
docs:
- doc_title: Document title
doc_url: 'doc-link'
```
A category supports as many docs as necessary, but, for clarity, try to not
overpopulate a category.
overpopulate a category. Also, do not use more than three levels of docs.
Example with multiple docs:

View File

@ -89,6 +89,19 @@ module QA
raise ResourceUpdateFailedError, "Could not update require_two_factor_authentication to #{value}. Request returned (#{response.code}): `#{response}`."
end
end
def change_repository_storage(new_storage)
post_body = { destination_storage_name: new_storage }
response = post Runtime::API::Request.new(api_client, "/groups/#{id}/repository_storage_moves").url, post_body
unless response.code.between?(200, 300)
raise ResourceUpdateFailedError, "Could not change repository storage to #{new_storage}. Request returned (#{response.code}): `#{response}`."
end
wait_until(sleep_interval: 1) { Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished', new_storage) }
rescue Support::Repeater::RepeaterConditionExceededError
raise Runtime::API::RepositoryStorageMoves::RepositoryStorageMovesError, 'Timed out while waiting for the group repository storage move to finish'
end
end
end
end

View File

@ -16,6 +16,14 @@ module QA
end
end
attribute :repository_http_location do
EE::Page::Group::Wiki::Show.perform do |show|
show.click_clone_repository
show.choose_repository_clone_http
show.repository_location
end
end
def initialize
@title = 'Home'
@content = 'This wiki page is created via API'
@ -42,6 +50,20 @@ module QA
title: title
}
end
def api_list_wiki_pages_path
"/groups/#{group.id}/wikis"
end
def has_page_content?(page_title, page_content)
response = get Runtime::API::Request.new(api_client, "#{api_list_wiki_pages_path}?with_content=1").url
unless response.code == HTTP_STATUS_OK
raise ResourceQueryError, "Could not get a list of all wiki pages for a given group. Request returned (#{response.code}): `#{response}`."
end
parse_body(response).any? { |page| page[:title] == page_title && page[:content] == page_content }
end
end
end
end

View File

@ -33,6 +33,8 @@ module QA
def resource_equals?(resource, move)
if resource.class.name.include?('Snippet')
move[:snippet][:id] == resource.id
elsif resource.class.name.include?('Group')
move[:group][:id] == resource.id
else
move[:project][:path_with_namespace] == resource.path_with_namespace
end

View File

@ -180,10 +180,10 @@ module QA
wait_for_reliable_connection
end
def verify_storage_move(source_storage, destination_storage)
def verify_storage_move(source_storage, destination_storage, repo_type: :project)
return if QA::Runtime::Env.dot_com?
repo_path = verify_storage_move_from_gitaly(source_storage[:name])
repo_path = verify_storage_move_from_gitaly(source_storage[:name], repo_type: repo_type)
destination_storage[:type] == :praefect ? verify_storage_move_to_praefect(repo_path, destination_storage[:name]) : verify_storage_move_to_gitaly(repo_path, destination_storage[:name])
end
@ -404,13 +404,13 @@ module QA
Service::Shellout.sql_to_docker_exec_cmd(sql, 'postgres', 'SQL_PASSWORD', 'praefect_production', 'postgres.test', @postgres)
end
def verify_storage_move_from_gitaly(storage)
def verify_storage_move_from_gitaly(storage, repo_type: :project)
wait_until_shell_command("docker exec #{@gitlab} bash -c 'tail -n 50 /var/log/gitlab/gitaly/current'") do |line|
log = JSON.parse(line)
if (log['grpc.method'] == 'RenameRepository' || log['grpc.method'] == 'RemoveRepository') &&
log['grpc.request.repoStorage'] == storage &&
!log['grpc.request.repoPath'].include?('wiki')
repo_type(log['grpc.request.repoPath']) == repo_type
break log['grpc.request.repoPath']
end
rescue JSON::ParserError
@ -444,6 +444,17 @@ module QA
yield JSON.parse(line)
end
end
def repo_type(repo_path)
return :snippet if repo_path.start_with?('@snippets')
return :design if repo_path.end_with?('.design.git')
if repo_path.end_with?('.wiki.git')
return repo_path.start_with?('@groups') ? :group_wiki : :wiki
end
:project
end
end
end
end

View File

@ -9,7 +9,7 @@ module QA
it 'confirms a `finished` status after moving project repository storage' do
expect(project).to have_file('README.md')
expect { project.change_repository_storage(destination_storage[:name]) }.not_to raise_error
expect { praefect_manager.verify_storage_move(source_storage, destination_storage) }.not_to raise_error
expect { praefect_manager.verify_storage_move(source_storage, destination_storage, repo_type: :project) }.not_to raise_error
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project

View File

@ -24,7 +24,7 @@ module QA
it 'moves snippet repository from one Gitaly storage to another', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1700' do
expect(snippet).to have_file('original_file')
expect { snippet.change_repository_storage(destination_storage[:name]) }.not_to raise_error
expect { praefect_manager.verify_storage_move(source_storage, destination_storage) }.not_to raise_error
expect { praefect_manager.verify_storage_move(source_storage, destination_storage, repo_type: :snippet) }.not_to raise_error
# verifies you can push commits to the moved snippet
Resource::Repository::Push.fabricate! do |push|

View File

@ -0,0 +1,26 @@
import { shallowMount } from '@vue/test-utils';
import { EditorContent } from 'tiptap';
import ContentEditor from '~/content_editor/components/content_editor.vue';
import createEditor from '~/content_editor/services/create_editor';
jest.mock('~/content_editor/services/create_editor');
describe('ContentEditor', () => {
let wrapper;
const buildWrapper = () => {
wrapper = shallowMount(ContentEditor);
};
afterEach(() => {
wrapper.destroy();
});
it('renders editor content component and attaches editor instance', () => {
const editor = {};
createEditor.mockReturnValueOnce(editor);
buildWrapper();
expect(wrapper.findComponent(EditorContent).props().editor).toBe(editor);
});
});