Skip to content

GitLab URL for gitaly needs to be escaped + http

Ash McKenzie requested to merge ashmckenzie/gitaly-gitlab-url-fix into master

What does this Merge Request do?

This MR ensures the GitLab socket URI for gitaly is escaped and is prefixed with http+ as that's what gitaly expects.

Without this fix, git push's fail:

Before

$ git push -u origin
[master ef8bb84] 1591004215
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1591004215.txt
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 890 bytes | 890.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote: /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/http_helper.rb:42:in `http_request_for': undefined method `request_uri' for #<URI::Generic:0x00007f88a190f228> (NoMethodError)
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/http_helper.rb:68:in `request'
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/http_helper.rb:99:in `post'
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/gitlab_net.rb:31:in `check_access'
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/gitlab_access.rb:24:in `block in exec'
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/gitlab_metrics.rb:50:in `measure'
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/lib/gitlab_access.rb:23:in `exec'
remote: 	from /Users/ash/src/gitlab/gitlab-development-kit/gitaly/ruby/gitlab-shell/hooks/pre-receive:26:in `<main>'
To http://gdk.localhost:3443/root/test.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://gdk.localhost:3443/root/test.git'

After

$ git push -u origin
[master ad04fe9] 1591004086
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1591004086.txt
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 890 bytes | 890.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
To http://gdk.localhost:3443/root/test.git
   da2cd5d..ad04fe9  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin' by rebasing.

Merge Request checklist

  • Tests added for new functionality. If not, please raise Issue to follow-up.
  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
Edited by 🤖 GitLab Bot 🤖

Merge request reports