diff options
author | Thiago Presa <tpresa@gitlab.com> | 2018-10-18 13:21:36 +0000 |
---|---|---|
committer | Thiago Presa <tpresa@gitlab.com> | 2018-10-18 13:21:36 +0000 |
commit | 262da845d387cbe860f5477844cc703f686506a2 (patch) | |
tree | 401e61046a6c1182f8008a879935767eb76e7595 | |
parent | 59613191221eef91cd7fb2fe055c7bf1cc9982dc (diff) | |
parent | 1c2f95fb18072655fe5460400f8e53000f22741f (diff) | |
download | gitlab-ce-262da845d387cbe860f5477844cc703f686506a2.tar.gz |
Merge branch '11-4-stable-prepare-rc8' into '11-4-stable'
Prepare 11.4 RC8 release
See merge request gitlab-org/gitlab-ce!22452
-rw-r--r-- | app/views/projects/tree/_tree_content.html.haml | 2 | ||||
-rw-r--r-- | doc/administration/git_protocol.md | 97 | ||||
-rw-r--r-- | doc/administration/index.md | 1 | ||||
-rw-r--r-- | qa/qa/factory/repository/push.rb | 12 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 10 | ||||
-rw-r--r-- | qa/spec/factory/repository/push_spec.rb | 26 |
6 files changed, 147 insertions, 1 deletions
diff --git a/app/views/projects/tree/_tree_content.html.haml b/app/views/projects/tree/_tree_content.html.haml index 587aeafa82f..5e0523f0b96 100644 --- a/app/views/projects/tree/_tree_content.html.haml +++ b/app/views/projects/tree/_tree_content.html.haml @@ -1,6 +1,6 @@ .tree-content-holder.js-tree-content{ 'data-logs-path': @logs_path } .table-holder - %table.table#tree-slider{ class: "table_#{@hex_path} tree-table" } + %table.table#tree-slider{ class: "table_#{@hex_path} tree-table qa-file-tree" } %thead %tr %th= s_('ProjectFileTree|Name') diff --git a/doc/administration/git_protocol.md b/doc/administration/git_protocol.md new file mode 100644 index 00000000000..6b82771baf9 --- /dev/null +++ b/doc/administration/git_protocol.md @@ -0,0 +1,97 @@ +--- +description: "Set and configure Git protocol v2" +--- + +# Configuring Git Protocol v2 + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/46555) in GitLab 11.4. + +--- + +Git protocol v2 improves the v1 wire protocol in several ways and is +enabled by default in GitLab for HTTP requests. In order to enable SSH, +further configuration is needed by the administrator. + +More details about the new features and improvements are available in +the [Google Open Source Blog](https://opensource.googleblog.com/2018/05/introducing-git-protocol-version-2.html) +and the [protocol documentation](https://github.com/git/git/blob/master/Documentation/technical/protocol-v2.txt). + +## Requirements + +From the client side, `git` `v2.18.0` or newer must be installed. + +From the server side, if we want to configure SSH we need to set the `sshd` +server to accept the `GIT_PROTOCOL` environment, + +``` +# /etc/ssh/sshd_config +AcceptEnv GIT_PROTOCOL +``` + +Once configured, restart the SSH daemon. In Ubuntu, run: + +```sh +sudo service ssh restart +``` + +## Instructions + +In order to use the new protocol, clients need to either pass the configuration +`-c protocol.version=2` to the git command, or set it globally: + +```sh +git config --global protocol.version 2 +``` + +### HTTP connections + +Verify Git v2 is used by the client: + +```sh +GIT_TRACE_CURL=1 git -c protocol.version=2 ls-remote https://your-gitlab-instance.com/group/repo.git 2>&1 | grep Git-Protocol +``` + +You should see that the `Git-Protocol` header is sent: + +``` +16:29:44.577888 http.c:657 => Send header: Git-Protocol: version=2 +``` + +Verify Git v2 is used by the server: + +```sh +GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote https://your-gitlab-instance.com/group/repo.git 2>&1 | head +``` + +Example response using Git protocol v2: + +```sh +$ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote https://your-gitlab-instance.com/group/repo.git 2>&1 | head +10:42:50.574485 pkt-line.c:80 packet: git< # service=git-upload-pack +10:42:50.574653 pkt-line.c:80 packet: git< 0000 +10:42:50.574673 pkt-line.c:80 packet: git< version 2 +10:42:50.574679 pkt-line.c:80 packet: git< agent=git/2.18.1 +10:42:50.574684 pkt-line.c:80 packet: git< ls-refs +10:42:50.574688 pkt-line.c:80 packet: git< fetch=shallow +10:42:50.574693 pkt-line.c:80 packet: git< server-option +10:42:50.574697 pkt-line.c:80 packet: git< 0000 +10:42:50.574817 pkt-line.c:80 packet: git< version 2 +10:42:50.575308 pkt-line.c:80 packet: git< agent=git/2.18.1 +``` + +### SSH Connections + +Verify Git v2 is used by the client: + +```sh +GIT_SSH_COMMAND="ssh -v" git -c protocol.version=2 ls-remote ssh://your-gitlab-instance.com:group/repo.git 2>&1 |grep GIT_PROTOCOL +``` + +You should see that the `GIT_PROTOCOL` environment variable is sent: + +``` +debug1: Sending env GIT_PROTOCOL = version=2 +``` + +For the server side, you can use the [same examples from HTTP](#http-connections), changing the +URL to use SSH. diff --git a/doc/administration/index.md b/doc/administration/index.md index d713247983b..789d6716eb4 100644 --- a/doc/administration/index.md +++ b/doc/administration/index.md @@ -131,6 +131,7 @@ created in snippets, wikis, and repos. - [Custom Git hooks](custom_hooks.md): Custom Git hooks (on the filesystem) for when webhooks aren't enough. - [Git LFS configuration](../workflow/lfs/lfs_administration.md): Learn how to configure LFS for GitLab. - [Housekeeping](housekeeping.md): Keep your Git repositories tidy and fast. +- [Configuring Git Protocol v2](git_protocol.md): Git protocol version 2 support. ## Monitoring GitLab diff --git a/qa/qa/factory/repository/push.rb b/qa/qa/factory/repository/push.rb index 6c5088f1da5..703c78daa99 100644 --- a/qa/qa/factory/repository/push.rb +++ b/qa/qa/factory/repository/push.rb @@ -30,6 +30,14 @@ module QA @directory = dir end + def files=(files) + if !files.is_a?(Array) || files.empty? + raise ArgumentError, "Please provide an array of hashes e.g.: [{name: 'file1', content: 'foo'}]" + end + + @files = files + end + def fabricate! Git::Repository.perform do |repository| if ssh_key @@ -63,6 +71,10 @@ module QA @directory.each_child do |f| repository.add_file(f.basename, f.read) if f.file? end + elsif @files + @files.each do |f| + repository.add_file(f[:name], f[:content]) + end else repository.add_file(file_name, file_content) end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 267e7bbc249..f73a1c73cca 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -35,6 +35,10 @@ module QA element :new_file_button, "_('New file')," end + view 'app/views/projects/tree/_tree_content.html.haml' do + element :file_tree + end + def project_name find('.qa-project-name').text end @@ -43,6 +47,12 @@ module QA click_on 'New file' end + def go_to_file(filename) + within_element(:file_tree) do + click_on filename + end + end + def switch_to_branch(branch_name) find_element(:branches_select).click diff --git a/qa/spec/factory/repository/push_spec.rb b/qa/spec/factory/repository/push_spec.rb new file mode 100644 index 00000000000..2eb6c008248 --- /dev/null +++ b/qa/spec/factory/repository/push_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +describe QA::Factory::Repository::Push do + describe '.files=' do + let(:files) do + [ + { + name: 'file.txt', + content: 'foo' + } + ] + end + + it 'raises an error if files is not an array' do + expect { subject.files = '' }.to raise_error(ArgumentError) + end + + it 'raises an error if files is an empty array' do + expect { subject.files = [] }.to raise_error(ArgumentError) + end + + it 'does not raise if files is an array' do + expect { subject.files = files }.not_to raise_error + end + end +end |