diff options
-rw-r--r-- | .gitlab/ci/rails.gitlab-ci.yml | 54 | ||||
-rw-r--r-- | app/assets/javascripts/content_editor/components/content_editor.vue | 18 | ||||
-rw-r--r-- | app/assets/javascripts/content_editor/services/create_editor.js | 6 | ||||
-rw-r--r-- | config/webpack.config.js | 8 | ||||
-rw-r--r-- | doc/development/documentation/site_architecture/global_nav.md | 16 | ||||
-rw-r--r-- | qa/qa/resource/group.rb | 13 | ||||
-rw-r--r-- | qa/qa/resource/wiki/group_page.rb | 22 | ||||
-rw-r--r-- | qa/qa/runtime/api/repository_storage_moves.rb | 2 | ||||
-rw-r--r-- | qa/qa/service/praefect_manager.rb | 19 | ||||
-rw-r--r-- | qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb | 2 | ||||
-rw-r--r-- | spec/frontend/content_editor/components/content_editor_spec.js | 26 |
12 files changed, 149 insertions, 39 deletions
diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 2f68897d8cb..f4ea6e3ae01 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -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 diff --git a/app/assets/javascripts/content_editor/components/content_editor.vue b/app/assets/javascripts/content_editor/components/content_editor.vue new file mode 100644 index 00000000000..839d4de912d --- /dev/null +++ b/app/assets/javascripts/content_editor/components/content_editor.vue @@ -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> diff --git a/app/assets/javascripts/content_editor/services/create_editor.js b/app/assets/javascripts/content_editor/services/create_editor.js index c6e24bdf9bb..e1ebbe21b3d 100644 --- a/app/assets/javascripts/content_editor/services/create_editor.js +++ b/app/assets/javascripts/content_editor/services/create_editor.js @@ -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, diff --git a/config/webpack.config.js b/config/webpack.config.js index 2b770d67cc5..94aa190b77a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -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', diff --git a/doc/development/documentation/site_architecture/global_nav.md b/doc/development/documentation/site_architecture/global_nav.md index f66b0543ad1..1b6d9a54bc0 100644 --- a/doc/development/documentation/site_architecture/global_nav.md +++ b/doc/development/documentation/site_architecture/global_nav.md @@ -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: diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index 135c3dea628..fb7236f9f4c 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -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 diff --git a/qa/qa/resource/wiki/group_page.rb b/qa/qa/resource/wiki/group_page.rb index 27150ecf6c7..83beaf097ca 100644 --- a/qa/qa/resource/wiki/group_page.rb +++ b/qa/qa/resource/wiki/group_page.rb @@ -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 diff --git a/qa/qa/runtime/api/repository_storage_moves.rb b/qa/qa/runtime/api/repository_storage_moves.rb index 5630a9c02c5..d1d44bd1ab5 100644 --- a/qa/qa/runtime/api/repository_storage_moves.rb +++ b/qa/qa/runtime/api/repository_storage_moves.rb @@ -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 diff --git a/qa/qa/service/praefect_manager.rb b/qa/qa/service/praefect_manager.rb index 119013175c0..91495247906 100644 --- a/qa/qa/service/praefect_manager.rb +++ b/qa/qa/service/praefect_manager.rb @@ -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 diff --git a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb index 631056ed52e..e28e054dc46 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb @@ -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 diff --git a/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb b/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb index 4872acd1004..7b82a872fc0 100644 --- a/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb +++ b/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb @@ -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| diff --git a/spec/frontend/content_editor/components/content_editor_spec.js b/spec/frontend/content_editor/components/content_editor_spec.js new file mode 100644 index 00000000000..f055a49135b --- /dev/null +++ b/spec/frontend/content_editor/components/content_editor_spec.js @@ -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); + }); +}); |