Page MenuHomePhabricator

Gitiles project landing pages should have an anonymous clone URL
Closed, ResolvedPublic

Description

Upstream patch https://gerrit-review.googlesource.com/c/plugins/gitiles/+/163611


Visiting a Gitiles landing page like https://gerrit.wikimedia.org/g/mediawiki/extensions/SyntaxHighlight_GeSHi gives me an SSH clone URL like git clone ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SyntaxHighlight_GeSHi which is just not very useful. It should use the anonymous HTTPS URL (like git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi"), or both. Compare https://gerrit.wikimedia.org/r/admin/projects/mediawiki/extensions/SyntaxHighlight_GeSHi which has those options.

(If the SSH URL is kept it should made easier to use - that's T189182: Gitiles should add username in git clone links, triggers "Permission denied (publickey)" error.)

Event Timeline

How is this a duplicate? The other task is about SSH URLs, not HTTPS ones.

@Tgr: Feel free to reopen and clarify in the task summaries

Tgr updated the task description. (Show Details)
ema triaged this task as High priority.Jul 22 2020, 2:27 PM

Due to this issue I have so far been pointing people to the github mirrors of our repositories so that they can clone things and look around. Clearly not optimal.

Yup, that's not good.

However, the URL can currently not be configured. It's hardwired to SSH, if SSH is available.

Not sure if anyone is working on it or planning to work on it. But the relevant code seems to be

https://gerrit.googlesource.com/plugins/gitiles/+/641476e153143c2b67e334b35626beb9b2534956/src/main/java/com/googlesource/gerrit/plugins/gitiles/Module.java#91

However, the URL can currently not be configured. It's hardwired to SSH, if SSH is available.

Not sure if anyone is working on it or planning to work on it. But the relevant code seems to be

https://gerrit.googlesource.com/plugins/gitiles/+/641476e153143c2b67e334b35626beb9b2534956/src/main/java/com/googlesource/gerrit/plugins/gitiles/Module.java#91

Ah, thanks! HTTP seems like a more sensible default to me. Release-Engineering-Team: perhaps Module.java could be patched to change the default for us?

I think that is addressed by the pending Upstream patch https://gerrit-review.googlesource.com/c/plugins/gitiles/+/163611 . It introduces a new configuration variable:

The flag gerrit.cloneUrlType can be set to either ssh, http, or git. This will determine which protocol to be used to display repos' clone url to the user.
If it's not set, or it fails to get the set type of URL, it will automatically prefer SSH, then HTTP, then Git.

[gerrit]
  cloneUrlType = http

http would set the URL to gerrit.gitHttpUrl
git would use gerrit.canonicalGitUrl

We haven't those set, so I have suggested to also fall back to gerrit.canonicalWebUrl which on our setup is https://gerrit.wikimedia.org/r.

Can't we just set this new flag? I think it would be nice to address this unnecessary hurdle.

Can't we just set this new flag? I think it would be nice to address this unnecessary hurdle.

The flag introduced by https://gerrit-review.googlesource.com/c/plugins/gitiles/+/163611 has been released with Gerrit 3.6.2 (we run 3.4 currently and I will upgrade to 3.5 soonish and hopefully to 3.6 soon after).

Change 903260 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/puppet@production] gerrit: set gitiles clone url to http (Gerrit 3.6.2)

https://gerrit.wikimedia.org/r/903260

Change 903260 merged by Dzahn:

[operations/puppet@production] gerrit: set gitiles clone url to http (Gerrit 3.6.2)

https://gerrit.wikimedia.org/r/903260

I have upgraded to Gerrit 3.6.8. Gitiles now shows the https url but it is missing slash / between the base URL and the repository name :-\

gerrit_gitiles_clone_cmd.png (145×917 px, 21 KB)

Change 989735 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/puppet@production] gerrit: add trailing slash to gerrit.canonicalWebUrl

https://gerrit.wikimedia.org/r/989735

Change 989735 merged by Jelto:

[operations/puppet@production] gerrit: add trailing slash to gerrit.canonicalWebUrl

https://gerrit.wikimedia.org/r/989735

Fixed by adjusting gerrit.canonicalWebUrl to have a trailing /:

gerrit_gitiles_clone_cmd_fixed.png (145×917 px, 21 KB)