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

Gitbucket support #142

Closed
jayvdb opened this issue Mar 13, 2017 · 11 comments
Closed

Gitbucket support #142

jayvdb opened this issue Mar 13, 2017 · 11 comments

Comments

@jayvdb
Copy link
Collaborator

jayvdb commented Mar 13, 2017

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

@guyzmo
Copy link
Owner

guyzmo commented Mar 13, 2017

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 😉

@jayvdb
Copy link
Collaborator Author

jayvdb commented Mar 13, 2017

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

@guyzmo
Copy link
Owner

guyzmo commented Mar 13, 2017

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).

@kounoike
Copy link
Collaborator

@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.)

@kounoike
Copy link
Collaborator

@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.

@guyzmo
Copy link
Owner

guyzmo commented Mar 19, 2017 via email

@guyzmo
Copy link
Owner

guyzmo commented Mar 19, 2017

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 ♥ !!!

@kounoike
Copy link
Collaborator

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.

@jayvdb
Copy link
Collaborator Author

jayvdb commented Mar 19, 2017

@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.

@kounoike
Copy link
Collaborator

@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.

@guyzmo
Copy link
Owner

guyzmo commented Mar 20, 2017

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.

@guyzmo guyzmo closed this as completed in 2dcd901 Apr 30, 2017
guyzmo added a commit that referenced this issue May 8, 2017
First anniversary release 🎂

This release marks the first anniversary
and 10th release of git-repo 🎉

Now git-repo supports 6 git services:

  github, gitlab, bitbucket,
  gogs, gitea and gitbucket

It supports the following commands:

  clone, fork, create, delete,
  add, open, ls, request, gist

And it's becoming relatively stable
(keep sending bug reports 🙏)

♥ Contributors

Thanks to @kounoike for the gitbucket support 🙌

Now there are three contributors promoted to collaborators:

* @kounoike, @pyhedgehog and @Crazybus

🚧 Features

* When add has no parameters, add default remote #100 #141
* When add has 'upstream' parameter, add the upstream remote #99 #141
* Use default branch instead of hardcoded 'master' #91
* Refactor and complete bitbucket support #43 #11 #80 #14 #89 #90 #79
* Loosen versions of dependencies #133
* Report if the service is already setup #136
* Adds GitBucket support #142 #144
* Adds support for ssh:// URL #148

🚒 Bugfixes

* fix various crashes #152
* fix gitlab clone crash #129
* fix request create command #147 #127
* fix request fetch command #138 #131
* fix wizard crash #149
* fix mishandling of renamed gitlab project urls #137

📝 Documentation

* documentation #145

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants