-
Notifications
You must be signed in to change notification settings - Fork 2
feat: support bitbucket and gitlab shortcut, support private repo through sshurl #12
Conversation
Somehow, travis-cli failed to see public repo
|
@zkochan could you configure a user key on travis-ci, apparently it's even needed for ssh url to work on public repo. |
but it means that everyone will have to make this configuration, who will use git dependencies. Currently, it is not required by npm/yarn |
Yes, I am surprised too travis-ci cannot even see public repo. I will investigate bit more. |
You are right, I myself have github project using git dep running travis-ci without problem. I am not exactly sure how npm/yarn install git dep. But I can replicate the issue on travis-ci with another https://travis-ci.org/huochunpeng/debug-travis Interestingly, yarn mocked git command in test. |
I got idea why npm/yarn don't have problem with installing git dep on travis-ci. When npm install git dep, it tries git url and https url before ssh url. I guess yarn did similar thing. test('github-shortcut', function (t) {
const cloneUrls = [
['git://github.com/foo/private.git', 'GitHub shortcuts try git URLs first'],
['https://github.com/foo/private.git', 'GitHub shortcuts try HTTPS URLs second'],
['ssh://git@github.com/foo/private.git', 'GitHub shortcuts try SSH third'] @zkochan how you think we replicate the behaviour? Try git/https/ssh url in sequence? Performance wise, git url is fastest. I guess it's due to no encryption.
|
@zkochan There is something I don't like about https path. When installing private repo, npm pops up a dialog to ask for username/password. Apparently it is trying https url. If I cancel the login, npm still got my private repo installed, apparently it falls back to ssh url which works. NOT sure whether yarn tried https url before ssh url. From what I can see in yarn.lock file, yarn uses ssh url, not https url. Since yarn mocked git commands in test, it doesn't have issue in ci.
Update: from what I see from yarn verbose ouput, it seems yarn tries http HEAD request on the url before tries I am going to do the same thing. |
The test doesn't cover private repo. I guess we have to use mock in test if wanna cover private repo. But I tested private repo with my local pnpm with patched git-resolver/lib files. |
@andreineculau you might want to check this. You worked a lot with this repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would be nice to have a test for private repos. But not a blocker
I might have a look this evening, but if i don't, just go with it #parentalleave
… 29 juni 2018 kl. 13:15 skrev Zoltan Kochan ***@***.***>:
@zkochan approved this pull request.
LGTM. Would be nice to have a test for private repos. But not a blocker
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I made another small change. When try HTTP HEAD on BitBucket treats both urls with same response. I am adding some basic test coverage for gitlab. |
Added test coverage on gitlab. |
}); | ||
|
||
// This test relies on implementation detail. | ||
// current implementation does not try git ls-remote --refs on pref with full commit hash, this fake repo url will pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so what makes it private then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not this one, the one after. The fake repo fails check on both git url and https url, effectively runs the same code path of private repo by using ssh url.
🚢 pnpm v2.10.0 |
Removed usage of Github api, normalised all hosts (Github/Bitbucket/Gitlab) using git/https/ssh url.
By using sshurl, private repo now works as long as user has ssh public key setup properly on host account.
Patched Github tarball url, can be removed after npm/hosted-git-info#34.