Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing private packages hosted on bitbucket.org #56

Open
michelezamuner opened this issue Dec 22, 2015 · 4 comments
Open

Installing private packages hosted on bitbucket.org #56

michelezamuner opened this issue Dec 22, 2015 · 4 comments

Comments

@michelezamuner
Copy link

I've been trying to get bpkg to install a private package hosted on my bitbucket.org account, but so far I couldn't manage to make it work. I added a ${HOME}/.bpkgrc file with these contents:

#BPKG_REMOTES=("https://raw.githubusercontent.com")
BPKG_REMOTES+=("raw-oauth| michelezamuner https://bitbucket.org")

#BPKG_GIT_REMOTES=("https://github.com")
BPKG_GIT_REMOTES+=("https://bitbucket.org")

And issuing this install command:

$ bpkg install michelezamuner/bpkg-test

Unlinke github, bitbucket doesn't allow you to have a permanent oauth2 token, you can only have one that expires after some time. However, I've seen that that BPKG_REMOTE syntax triggers the inner curl command to ask me for my password. However I can see a problem with the URL where it's trying to download the package from:

`Install /michelezamuner/bpkg-test/raw/master from remote  [https:// michelezamuner https://bitbucket.org:x-oauth-basic@bitbucket.org]`

bitbucket doesn't support /raw/master URLs, so I think that this link is responding 404. Anyway, with that configuration I get remote unreachable.

I've also tried using

https://x-token-auth:{access_token}@bitbucket.org

as remote, using the temporary access token, but I'm still getting the remote unreachable error.

Any suggestion on what should I do to connect to bitbucket, or is it not possible altogether? Thanks!

@jwerle
Copy link
Member

jwerle commented Dec 22, 2015

@michelezamuner I think it would be valuable to allow for installation of packages from bitbucket. Can you describe the URL pattern? We would have to modify the following lines https://github.com/bpkg/bpkg/blob/master/lib/install/install.sh#L217-L234

@michelezamuner
Copy link
Author

This is the URL for a raw file hosted in a private bitbucket repository:

https://bitbucket.org/michelezamuner/bpkg-test/raw/master/package.json

Is this what you were asking for?

@calvernaz
Copy link
Member

Hi,

@jwerle, @michelezamuner I was able to get the file doing the following steps:

curl -X POST -i https://bitbucket.org/site/oauth2/access_token?redirect_uri=http://whatever -d grant_type=client_credentials -u key:secret

I had to previously generate the key and secret in bitbucket. From the request above I got the access token which I used in the following request:

curl -H "Authorization: Bearer <access-token>" https://api.bitbucket.org/1.0/repositories/<repo>/raw/master/package.json

Is somehow similar to github, as @jwerle said it would be nice to support the private repositories from bitbucket.

@hydra1983
Copy link

@michelezamuner You may try GH-94, but I have not got bitbucket tested yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants