guyzmo/git-repo

Gitbucket support

jayvdb opened this issue · 11 comments

https://github.com/gitbucket/gitbucket is a self-hosted OSS like GitLab and gogs.

never heard of it up until now, so for sure it'd be a great addition.

Though, it does not look like there's an existing python library to interace gitbucket's API. If it does not, someone should start implementing it 😉

It has an API very similar to GitHub Pro, so one of the libraries which supports that should work.
See https://gitter.im/gitbucket/gitbucket?at=58c66579567b0fc813902068

if that's really the case, then it should already be supported, You just need to setup a custom fqdn for the gitbucket you're targetting. Only caveat: it only supports fqdn, not subdirs (gitbucket.example.org, not example.org/gitbucket).

@guyzmo Is git-repo really supports GitHub Enterprise?
I think no, because gh.login doesn't pass url to github3.py.
github3.login requires url for GHE login.

I run git repo config as following:

Do you want to configure the bitbucket service?
    [Yn]> n
Do you want to configure the github service?
    [Yn]> y
Is your service self-hosted?
    [yN]> y
What name do you want to give this service?
[github]> gitbucket
Enter the service's domain name:
[github.com]> gitbucket.local
Enter the service's port:
[443]> 80
Are you connecting using HTTPS? (you should):
    [Yn]> n
Please enter your credentials to connect to the service:
username> kounoike
password>
Great! You've been identified 🍻
Do you want to give a custom name for this service's remote?
    [yN]> n
Do you want to configure a git alias?
N.B.: instead of typing `git repo gitbucket` you'll be able to type `git gitbucket`
    [Yn]> y
Do you want to configure the gitlab service?
    [Yn]> n
Do you want to configure the gogs service?
    [Yn]> n
🍻 The configuration is done!

But, username/password must be github.com account. And it creates github.com's personal access token. This shows git-repo connects to github.com.

Even if supported GHE, GitBucket doesn't support many features such as authorization API, etc.
Maybe git-repo doesn't work with GitBucket. (But it is GitBucket's issue.)

@guyzmo I wrote gitbucket.py module, quick-and-dirty.
https://gist.github.com/kounoike/95ad741d8269663628b45f1925c5f957

It can only login and few tasks. Because GitBucket lacks some important API.
I will talk about these API in GitBucket community.
If those APIs supported, I will test more feature and make PR.

It can only login and few tasks. Because GitBucket lacks some important API.
I will talk about these API in GitBucket community.
If those APIs supported, I will test more feature and make PR.

that would be lovely ♥ !!!

Is there a gitbucket public instance available for testing?

https://gitbucket.github.io/gitbucket-news/ has "Demo" link to https://gitbucket.herokuapp.com/ and Chat link.

I don't know this demo site's configuration. It can login with GitBucket's default admin id/pw.
But, GitBucket runs locally is very easy. Just run java -jar gitbucket.war. It creates repositry into $HOME/.gitbucket and runs embedded database engine. and it listen on 8080 port.

@kounoike , I guess you could add 'fetch PR' action to your module, as it only needs to convert a PR id to git fetch reference. No metadata needed. An API should only be needed for actions like fetch PR list, and create PR, which require information not in the git repo.

Are there open bugs for the missing 'list PR'/'list issue' API in gitbucket? I'd like to track those bugs as that is the functionality that I am looking for.

@jayvdb fetch PR works partially correct. But it fetched to `request/github/1'. I think it should be 'request/gitbucket/1'. And message shows as followed:

Successfully fetched request id `1` of `None` into `requests/github/1`!

(I'm reading code...) Ah, it is hard-coded in GithubService.request_fetch. GitbucketService is the class inherits GithubService. And some error exists on self.repo_slug.
(I read more) It based on remote url which is changed by gitbucket.py.GitBucket requires non-standard port for git-ssh.

for the refspec, it can be easily patched, using the service name in the format instead of the github part. Though the None thing is a bit bothering. There's been a few changes in the code to accept different git-ssh URIs (using a configuration) instead of guessing the URI based on the HTTP URI, that's been a patch from @pyhedgehog for gogs. I don't remember if it's been released yet, but we can make sure it's working ok for the next release.