Geo: Clone instructions are wrong when clone_url_prefix is empty in the database
Summary
In a Geo secondary node when you click the small "globe" icon in a project's primary page, you get a modal dialog with instructions on how to clone and setup a different URL for push, so users can pull from secondary and push to primary using the same remote origin.
We've introduced the clone_url_prefix
in the database in preparation for the replication changes and started using it to the modal dialog. Because there is an issue that is preventing clone_url_prefix
from being set we are displaying incorrect instructions. We should fallback to the old way when we don't have a clone_url_prefix set.
Steps to reproduce
set clone_url_prefix
to nil in the GeoNode for the primary node. Access any secondary node's project and click on the icon
What is the current bug behavior?
On the modal, the step to set a different push URL, displays as (for root/test_repo.git):
git remote set-url --push origin root/test-repo
What is the expected correct behavior?
It should display instead:
git remote set-url --push origin git@gitlab.mycompanycom:root/test-repo.git
Or when we don't have clone_url_prefix
in the database, fallback to:
git remote set-url --push origin <clone url for primary repository>:root/test-repo.git
Relevant logs and/or screenshots
Related MRs
- gitlab-org/gitlab-ee!2027
- gitlab-org/gitlab-ee!2015
Possible fixes
Introduce a fallback when clone_url_prefix
is nil and try to fix (in another issue) the situations where it can be nil.