houston icon indicating copy to clipboard operation
houston copied to clipboard

Add support for GitLab [$505]

Open danirabbit opened this issue 6 years ago • 29 comments

We should:

  • [ ] Put together a list of all the GitHub APIs we rely on
  • [ ] Make sure those APIs have equivalents on GitLab
  • [ ] Support publishing GitLab projects

There is a bounty on this issue on BountySource


There is a $505 open bounty on this issue. Add to the bounty at Bountysource.

danirabbit avatar Jun 04 '18 13:06 danirabbit

Currently, the only GitHub code in V2 is wrapped up in a service file. There are three interfaces that GitLab will need to implement:

  • [ ] A code repo
  • [ ] package repo
  • [ ] log repo

https://github.com/elementary/houston/blob/v2-publishing/src/lib/service/type.ts

The other two things that will need to be added would include:

  • [ ] database models (not done in V2)
  • [ ] web hook controllers (also not done in V2).

btkostner avatar Jun 04 '18 14:06 btkostner

@btkostner Can we make sure we get tickets opened up on GitLab (and linked back here with convenient checkboxes) for any missing APIs? :)

danirabbit avatar Jun 04 '18 14:06 danirabbit

There's lots of GitLab functionality exposed via API - See https://docs.gitlab.com/ee/api/

If there's something missing and there isn't an issue about it already you can open an issue in http://gitlab.com/gitlab-org/gitlab-ce/issues

Let me know if there's anything that GitLab can do to make this easier for you.

matteeyah avatar Jun 04 '18 15:06 matteeyah

Would you like to keep support for GitHub or transition entirely?

I'm looking at this.

rupertdev avatar Jun 05 '18 20:06 rupertdev

We will want to add this next to GitHub and keep them both working.

btkostner avatar Jun 05 '18 20:06 btkostner

I assumed, just wanted to be sure, there are some extreme opinions out there :)

rupertdev avatar Jun 05 '18 20:06 rupertdev

I have almost all of this done, is there a gitlab repo I can use in the e2e tests?

rupertdev avatar Jun 08 '18 11:06 rupertdev

elementary currently has no gitlab repos. Your best bet would be to create a temp repo on gitlab for testing.

btkostner avatar Jun 08 '18 15:06 btkostner

Hope elementary stays on Github.

robinlahtinen avatar Jun 09 '18 16:06 robinlahtinen

@robinkooli There are no plans for elementary to move any of our code. This issue is about adding GitLab support to AppCenter Dashboard so that 3rd party developers can publish repos hosted on both GitHub and GitLab

danirabbit avatar Jun 09 '18 16:06 danirabbit

Does this need to be implemented in the v2 branch, master, or both?

rupertdev avatar Jun 10 '18 01:06 rupertdev

@matteeyah and others:

sad news, looks like GitLab doesnt support release file uploads through the API.

There's been an issue open for some time: https://gitlab.com/gitlab-org/gitlab-ce/issues/31221

What path should we take here?

rupertdev avatar Jun 10 '18 02:06 rupertdev

@rupertdev

Just V2, I think. @btkostner would be able to answer more definitively.

By release file uploads, this would mean attaching the completed deb file to the release tag right? If so, I think we can consider the release file uploads optional. This is more of a convenience and isn’t necessary for publishing in AppCenter

danirabbit avatar Jun 10 '18 03:06 danirabbit

@rupertdev I pinged our VP of Product and relevant Product Managers in the issues. Thanks for bringing this up.

matteeyah avatar Jun 22 '18 17:06 matteeyah

Still have a PR for this, looks like bounty has increased, would love to finish it up :)

rupertdev avatar Dec 23 '18 20:12 rupertdev

@danrabbit what's the deal with this task?

rupertdev avatar Mar 04 '19 21:03 rupertdev

@rupertdev I've been doing a lot of non houston related things lately, like weblate and infrastructure tasks. I've also been prioritizing fixing issues with the testing / releasing process over adding new features.

Speaking of GitLab. I realized that in most of the code I wrote, I made a huge assumption that each service would have a single API endpoint. This mostly works for GitHub, but with GitLab (where it's much more feasible to host it yourself), this is not always the case. I've been thinking in the back of my head of how I want to deal with this and what would need to be changed.

btkostner avatar Mar 04 '19 21:03 btkostner

@btkostner You could implement support for GitLab.com first, then add support for self-hosted instances in a later iteration. I think the bulk of people wanting to add their apps to the AppCenter will have their code hosted on .com.

matteeyah avatar Mar 05 '19 03:03 matteeyah

Whoops. Did not mean to close

btkostner avatar Mar 06 '19 21:03 btkostner

I'm trying to find out how to test solution As I understood: Now: houston build works only with Github repositories After: it should work also with Gitlab repos

Which repos I can test this way? I'm trying to build houston repo with houston. First I tried houston build [email protected]:elementary/houston.git 6.2.0, next houston build [email protected]:elementary/houston.git master / v6.20 / refs/tags/v6.2.0. Result is "no reference found for shorthands"

Which repos I've could test by houston and how?

thecyberd3m0n avatar Sep 10 '19 15:09 thecyberd3m0n

@thecyberd3m0n You can't build houston with houston. Houston does not produce a deb file.

btkostner avatar Sep 10 '19 15:09 btkostner

please give me example repo where I could start. I'm also on your Gitter

thecyberd3m0n avatar Sep 10 '19 16:09 thecyberd3m0n

To give a status update on this:

There is currently a PR to add support for GitLab to the worker. This only makes it possible for most of the "houston ci" stuff to work.

elementary is currently working on making Flatpak a first class citizen with houston, but how flatpaks are built compared to debs is quite different. Therefore, there will probably be significant changes made to support this. I have not started work on this.

I am currently working on updating the server side logic to make it easier to support other services besides GitHub. It's still in its early stage, but if anyone would like to help out, here is the repo: https://github.com/elementary/houston-server.

btkostner avatar Sep 10 '19 16:09 btkostner

ok I'm working on it

thecyberd3m0n avatar Sep 11 '19 06:09 thecyberd3m0n

tcd@tcd-MS-7A40:~/hdd/bountysource/houston$ houston build [email protected]:thecyberd3m0n/palette.git 2.2.0
setting url [email protected]:thecyberd3m0n/palette.git
httpPath https://gitlab.com/thecyberd3m0n/palette
Running build for [email protected]:thecyberd3m0n/palette.git version 2.2.0
cloning /tmp/houston/c3c24431-3674-4b09-9069-458f50c4719b/repository/0
Error while running build for [email protected]:thecyberd3m0n/palette.git for 2.2.0

================================================================================

# Incorrect values in Debian control file

AppCenter checked your Debian control files and found some errors

- Source should be "com.gitlab.thecyberd3m0n.palette" not Source: com.github.cassidyjames.palette
Section: x11
Maintainer: Cassidy James Blaede <[email protected]>
Build-Depends: debhelper (>= 9), libgee-0.8-dev, libgtk-3-dev, meson, valac
Standards-Version: 3.9.6
Homepage: https://github.com/cassidyjames/palette

Package: com.github.cassidyjames.palette
Architecture: any
Priority: optional
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: View and copy colors from the elementary brand palette
 Access the elementary color palette on your local device

- Package should  "com.gitlab.thecyberd3m0n.palette" not Source: com.github.cassidyjames.palette
Section: x11
Maintainer: Cassidy James Blaede <[email protected]>
Build-Depends: debhelper (>= 9), libgee-0.8-dev, libgtk-3-dev, meson, valac
Standards-Version: 3.9.6
Homepage: https://github.com/cassidyjames/palette

Package: com.github.cassidyjames.palette
Architecture: any
Priority: optional
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: View and copy colors from the elementary brand palette
 Access the elementary color palette on your local device

### Build Information
Affects Architecture: amd64
Affects Distribution: juno
Built with the following references:
- refs/tags/2.2.0

================================================================================

First (almost) successfull build from Gitlab. You can see additional logs about package that was built (it was Palette imported to Gitlab specially for that purpose). Errors are result of package descriptors missmatch (I should change them in Palette repo I suppose)

Additional questions:

  • do you consider private repos?
  • any additional things or processes that I should test out or implement? How to test them?

Clear Definition of Done will make CR quicker :)

thecyberd3m0n avatar Sep 13 '19 09:09 thecyberd3m0n

I hate to complain, but I'm feeling a little upset about how this bounty/Issue was handled. I received some pretty active feedback at the time of my development, I delivered a PR that covered all of the acceptance criteria. When the PR was opened, I was told that it would be some time before it was reviewed. That was over a year ago.

It seems silly to let my work go to waste. I don't want to take away from what @thecyberd3m0n has done, I hope the same thing doesn't happen to them. I'm not really worried about what's going to happen when the bounty pays out because I'm not sure it ever will.

rupertdev avatar Sep 13 '19 13:09 rupertdev

I'm planning to deliver it on monday. I don't want my work to be useless. @btkostner should I continue work? Could you review @rupertdev pr, maybe this is enough?

thecyberd3m0n avatar Sep 13 '19 13:09 thecyberd3m0n

@thecyberd3m0n I would stop that branch. Sorry I did not say that earlier. I figured you were trying out @rupertdev's branch.

@rupertdev's branch covers half of the work needed to support GitLab. It does everything needed to run houston build on a GitLab project, but does not contain the API server logic needed for things like oauth login and listing all of a person's repos.

The server component of this makes huge assumptions with GitHub, and is currently being rewritten for better support, easier testing, and overall betterness. Therefore it's pointless to try to add that logic now. You can see it's progress on it's GitHub repo.

When @rupertdev's PR is merged, it will be awarded half of this bounty.

btkostner avatar Sep 13 '19 14:09 btkostner

actually I've just copied github.ts to gitlab.ts, changed some variables and added some ifs and produced log by my own, later I realized that somebody did it before me (my mistake)

Ok so if it was done, and second half requires additional integrations I'll stop my work on this task until any news.

thecyberd3m0n avatar Sep 13 '19 15:09 thecyberd3m0n