Code Monkey home page Code Monkey logo

Comments (31)

luxifer avatar luxifer commented on July 19, 2024

I'd like to be part of this feature. I'll look at the go gitlab api to see how I can add the lacking features

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

@luxifer thanks, much appreciated!

from gitness.

kzaitsev avatar kzaitsev commented on July 19, 2024

Hooks https://github.com/gitlabhq/gitlabhq/blob/master/lib/api/project_hooks.rb
Deployment keys for private repos https://github.com/gitlabhq/gitlabhq/blob/master/lib/api/deploy_keys.rb

from gitness.

luxifer avatar luxifer commented on July 19, 2024

Thanks for the links ;)

Hooks
https://github.com/gitlabhq/gitlabhq/blob/master/lib/api/project_hooks.rb
Deployment keys for private repos
https://github.com/gitlabhq/gitlabhq/blob/master/lib/api/deploy_keys.rb


Reply to this email directly or view it on
GitHubhttps://github.com//issues/53#issuecomment-34811990
.

from gitness.

kzaitsev avatar kzaitsev commented on July 19, 2024

I think you can look at the appliance gitlab-ci, it use http basic auth for git. GitLab creates special service user for project. May be it easy.

from gitness.

ajcrowe avatar ajcrowe commented on July 19, 2024

I don't have any experience with programming in Go (coming from an ops background). But I would be happy to test and provide feedback.

from gitness.

luxifer avatar luxifer commented on July 19, 2024

Would it be great to create a Host interface which describe each methods needed to add a repo and trigger build and then implement this methods in specific struct for GitHub, GitLab and so on?

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

@luxifer agreed. take a look at the last few comments in thread #10

from gitness.

luxifer avatar luxifer commented on July 19, 2024

I made a PR to the plouc/go-gitlab-client, you can check it out here plouc/go-gitlab-client#2
This on is for deploy keys, i'll made another for adding and removing projetc hooks

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

Awesome! It looks like it was accepted. I forgot to mention, we'll also need a way to download the .drone.yml file for a particular commit hash.

from gitness.

luxifer avatar luxifer commented on July 19, 2024

Thanks ;) I'm working on it!

from gitness.

luxifer avatar luxifer commented on July 19, 2024

Here's the api doc to get a single file for a particular commit/branch https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repositories.md#raw-file-content

from gitness.

luxifer avatar luxifer commented on July 19, 2024

Here's my PR to manage hooks plouc/go-gitlab-client#3

from gitness.

luxifer avatar luxifer commented on July 19, 2024

And here's the PR to get single raw file content without having to clone the entire repo plouc/go-gitlab-client#5

from gitness.

arrowcircle avatar arrowcircle commented on July 19, 2024

any news?

from gitness.

luxifer avatar luxifer commented on July 19, 2024

For now I don't have so much time to work on the PR.
Also I would like to have the point of view of the core dev. To go in the right direction

from gitness.

************ avatar ************ commented on July 19, 2024

If you want to increase the probability of this happening, vote here: http://feedback.gitlab.com/forums/176466-general/suggestions/5675077-integrate-docker-drone-with-gitlab-ci-runner

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

@fudanchii expressed interest in working on this as well. @luxifer perhaps you two can work together to expedite the request? I think it is safe to add but would ask that we take the following into account:

Code Structure
Let's try to keep the GitLab code in a single go file, using a struct, similar to how I started writing the Bitbucket code:
https://github.com/drone/drone/blob/bitbucket/pkg/handler/bitbucket.go

Unit Tests
Look at this github branch and how we implement unit tests, and follow that pattern:
https://github.com/bradrydzewski/drone/blob/example-fixture/pkg/handler/testing/github_test.go

Minimize Refactoring
Resist the urge to refactor code. There will be inefficiencies and code duplication. This is OK. We can (and will) refactor as part of a separate pull request. This section of the code will change a lot, so keeping it isolated (no shared code between GitLab, GitHub, Bitbucket, etc) will make it easier to refactor and combine once we've figured out an appropriate plugin design.

The smaller and more isolated the changeset the quicker we can merge the change.

from gitness.

fudanchii avatar fudanchii commented on July 19, 2024

Few updates...
Gitlab only use secret key for API invocation. And this Secret key is tied to user. The secret is similar to access token for OAuth, so the account-linking process is just a matter of filling this secret key.

Also github.com/plouc/go-gitlab-client still missing few features needed to get gitlab integrated:

  • Project.Public attribute. This is equal to Repo.Private for GitHub
  • Add SSH key for user.
  • The project payload from Gitlab includes ssh_url_to_repo and http_url_to_repo, github.com/plouc/go-gitlab-client currently doesn't have this properties, but I think this will be very convenient to have.

I'll continue over the weekend.
Thanks

from gitness.

arrowcircle avatar arrowcircle commented on July 19, 2024

@fudanchii
I made pull request with ssh and http repo urls to go-gitlab-client.
Could You please tell more info about Project.Public attribute?

from gitness.

fudanchii avatar fudanchii commented on July 19, 2024

Pardon me, the Project.Public is apparently already there :D
Much obliged.

from gitness.

arrowcircle avatar arrowcircle commented on July 19, 2024

@fudanchii
For keys you need method like user.AddKey("title", "key") ?

from gitness.

fudanchii avatar fudanchii commented on July 19, 2024

There is 2 versions of addkey, user.AddKey(title, key) which can be invoked if the given private_token is owned by admin account, this version require the user ID , so we have to get user instance first, another version can be used to add key for our current user (the user which tied to the private_token) maybe something like this? gitlab.UserAddKey(title, key). I think we may use the latter since we don't want to messing with another user here, and I suppose it's easier to implement?

Again, thank you!

from gitness.

arrowcircle avatar arrowcircle commented on July 19, 2024

@fudanchii I will make both methods and see whats better.
UPD. Made all api key methods in same pull request. Waiting for merge

from gitness.

arrowcircle avatar arrowcircle commented on July 19, 2024

@fudanchii it seems like @plouc it now available or looks for pull requests rarely.
You can use my fork of go gitlab client until changes get merged.

from gitness.

plouc avatar plouc commented on July 19, 2024

@arrowcircle, sorry but I just didn't received any notifications until this comment, I'll take a look at your PR asap. I've (quickly) seen the refactoring you made on tests, it will be easier to add test with stubs !

from gitness.

fudanchii avatar fudanchii commented on July 19, 2024

@arrowcircle @plouc
Just in: fudanchii/go-gitlab-client@d0da2d6
I'm not sure about this approach, any suggestions?

In another note, here's current status on the integration: https://github.com/fudanchii/drone/compare/gitlab?expand=1
Haven't add hook handling yet, I want to make sure I did the right approach for gitlab above.
Another way is to get all list of projects and iterate over it until we find the project we want, but this will get really exhaustive, so I guess it's a no no.

I plan to enable user level key later. The plan is, user can opted to add/generate key pair and add it to the user account at upstream repo host. Then each time drone create project, it will check if user is opted-in for user key, if it's true drone will use this key and wont add deploy key to the repository.

from gitness.

fudanchii avatar fudanchii commented on July 19, 2024

Some updates,
I'm currently working on the merge_request hook handling,
I've added the push hook handling and now waiting for @plouc to review my PR for the hook parsing feature and the raw requests at go-gitlab-client.

I'll open a PR after this.

Thanks!

from gitness.

luxifer avatar luxifer commented on July 19, 2024

Hey guys, having this issue with self signed gitlab server :

Private Token is not valid: "Client.Do error: \"Get https:/.../api/v3/user?private_token=HXgFW2XH5zqSfjJDYDyC: x509: certificate signed by unknown authority\""

from gitness.

kzaitsev avatar kzaitsev commented on July 19, 2024

@luxifer by default self signed certificates disabled, add flag -gitlab.skip-cert-check=true to /etc/init/drone.conf

from gitness.

luxifer avatar luxifer commented on July 19, 2024

@Bugagazavr thx, it works 😉

from gitness.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.