Skip to content

Incorrect git_ssh_url for webhooks on Kubernetes installations

Summary

On Kubernetes installations with a custom GitLab shell port. The value for git_ssh_url in webhooks does not include the custom port. This does not happen on omnibus installations.

This was reported a large premium customer in this ticket

Steps to reproduce

  1. Create a GitLab install on Kubernetes with a custom GitLab shell port e.g. 7999
  2. Configure webhooks for push events or merge request events on the project
  3. The created webhook has an incorrect git_ssh_url and ssh_url i.e. git@<gitlab_host_name>:<project_path>.git instead of ssh://git@<gitlab_host_name>:7999<project_path>.git
  4. Running Gitlab.config.gitlab_shell.ssh_path_prefix in the rails console for Kubernetes installs will also give git@<gitlab_host_name>: instead of ssh://git@<gitlab_host_name>:7999

Example Project

What is the current bug behavior?

The webhook does not contain the configured port for git_ssh_url and ssh_url

What is the expected correct behavior?

The webhook should contain the configured port for git_ssh_url and ssh_url

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

git_ssh_url is created here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/repository_url_builder.rb#L19