-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
GitLab service interface #1159
GitLab service interface #1159
Conversation
Currently gitlab not support it, but if gitlab merge my MR, this can be merged too |
@Bugagazavr cool. In the mean time, we should capture enough data in the {
"ID": 10,
"number": 3,
"status": "success",
"started_at": 1440022534,
"finished_at": 0,
"head_commit": {
"sha": "ededa54d3968051ef18ae3bebe2903bd1bb061d0",
"ref": "refs\/pull\/1\/merge",
"branch": "fix\/clone-into-non-empty-dir",
"timestamp": "2015-08-19 22:04:07.457360262 +0000 UTC",
"remote": "https:\/\/github.com\/donny-dont\/drone-git.git",
"author": {
"login": "donny-dont"
}
},
"pull_request": {
"number": 1,
"title": "Use git init instead of git clone",
"base_commit": {
"sha": "7138816569c347afef5f62d899a1677b59037fd6",
"ref": "master",
"remote": "https:\/\/github.com\/drone-plugins\/drone-git.git",
"author": { }
}
}
} just wanted to throw out as an option in case it takes a while for your pull request to be accepted by GitLab. Also, we'll need similar logic for Stash, Bitbucket, etc anyway. |
How you want to clone source repository without ref pathspec? |
using the above json example, we could do something like this: git fetch origin # this would pull from drone/drone
git fetch https://github.com/donny-dont/drone-git.git fix/clone-into-non-empty-dir
git checkout FETCH_HEAD I'm sure we can refine the above to even clone the specific sha. Everything we need to clone the pull request should be in the payload. If you look at the sample json you'll see the The ref doesn't have to be |
Github, Gitlab, Stash support refs, Bitbucket - not, Your case works only for public repos, but not for:
Ofc if you use netrc, maybe you can have access to some private repositories, but maybe not, there is no guarantee that source repo will be accessible. And so Gitlab doesn't present head commit, only source. |
Sorry, I think I misunderstood. I thought that refs weren't supported in GitLab until your pull request was merged |
I would, however, like to split this into two separate pull requests. Let's merge the gitlab.go changes right away to enable pull request functionality. I would like to understand and discuss some of the other REST and database-related changes |
Since
thats a breaking functionality, after merge this we need reactivate, all builds to get it works Database changes:
REST changes:
Remote changes:
I have a plan come to september ( from 1st to 7th ) merge window, if not, i create a pull request to drone with only push tags and pull requests support |
@@ -596,6 +596,79 @@ WHERE build_repo_id = ? | |||
AND build_number = ? | |||
` | |||
|
|||
const stmtBuildSelectPullRequestNumber = ` | |||
SELECT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the build_sql.go is auto-generated, let's move these non-generated queries to build.go
so they don't overwritten. I haven't published the sql generator yet, but I'll try to do that next week :)
also, I will probably adjust some of the non-generated queries I wrote to use the following:
const stmtBuildSelectPullRequestNumber = stmtBuildSelectList + `
WHERE build_repo_id = ?
AND build_pull_request_number = ?
ORDER BY build_number DESC
LIMIT 1
`
... the benefit to the above is that we don't have to worry about column changes in our non-generated queries
Thanks for the explanation, sorry I didn't mention this previously, but there is a ton of great work here! I've added some (hopefully) minor notes in the code review section. Once those are complete we are good to merge. Also, you get bonus points for porting the unit tests back over to the 0.4 branch :) I'll take care of updating the swagger file to include the new endpoints once this is complete. It is a pain in the ass to update, and I don't want to punish you after submitting such a nice patch :) |
7b4e480
to
6854d13
Compare
@bradrydzewski so i have finally complete this PR. but @DouweM requests to merge this PR before gitlab merge own ( https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1215 ), this breaks current compatibility, and can be used after september 22 gitlab 8.0 release. Need to add description about this and create current drone snapshot if someone wanna to play with drone and gitlab less then 8.0 (: |
hook.Commit.Sha = parsed.ObjectAttributes.LastCommit.Id | ||
hook.Commit.Remote = parsed.ObjectAttributes.Source.HttpUrl | ||
|
||
if parsed.ObjectAttributes.Source.HttpUrl == parsed.ObjectAttributes.Target.HttpUrl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably safer to compare source_project_id
and target_project_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, it most simple compare then:
itarget.Name == source.Name && target.Namespace == source.Namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bugagazavr https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1215 implements access over HTTP with |
@DouweM you use incorrect basic auth look this:
|
hook.Repo.Owner = req.FormValue("owner") | ||
hook.Repo.Name = req.FormValue("name") | ||
hook.Repo.FullName = fmt.Sprintf("%s/%s", hook.Repo.Owner, hook.Repo.Name) | ||
hook.Repo.Link = re.ReplaceAllString(parsed.ObjectAttributes.Target.HttpUrl, "$1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, you can add web_url
to the project's hook_attrs
in your MR. The method already exists and it's already returned by the API. It's a little cleaner than doing this replacement here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like hook does not contains web_url
key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was suggesting that you can add it to the GitLab hook_attrs
method on Project
, so that you can use it here.
@Bugagazavr I understand how Basic Auth works, but I don't see the |
@DouweM in this PR no, because it works on |
@Bugagazavr All right, I hope you'll get everything ready and merged into Drone before GitLab 8.0 is released :) |
@DouweM thanks for the review, I have tried to fulfill all your wishes (: so, i have find a bug in drone model, i have plan to cover drone model tomorrow, now i send minor fixes to gitlab |
@bradrydzewski hi brad, any news, on this? |
@Bugagazavr sorry for the delay on my end. The PR looks awesome. I do have 1 final request, and I promise we can merge :) I'd like to take the gitlab-specific routes and wrap them in a
I'd also like to move all GitLab routes into a I hope that makes sense, and that it isn't too big of a change. Thanks again! |
@bradrydzewski done |
awesome, thanks!!!!! |
Allow to work with gitlab as service interface
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1184