-
Notifications
You must be signed in to change notification settings - Fork 619
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
Implement approval for merge requests #817
base: master
Are you sure you want to change the base?
Conversation
@padyx thanks for submitting this! I'm happy with the help text that makes clear that this will only be supported in GitLab EE. Regarding the API v3 vs v4 question, I think you should figure out what version of GitLab introduced the API we are using, and then add that as a requirement in the help text. E.g. 'EE v9.0 or newer only.' @dblessing can you or someone else from GitLab comment about the HTTP result codes that should be expected/are possible here, and also the |
@dblessing ping! |
API v4 was introduced in 9.0. v3 was removed in 11.0. That doesn't mean all features of v4 existed in 9.0, though. Those HTTP codes look to be comprehensive for the endpoints you're using. |
Thanks for the input @dblessing I've used Combined that v4 API is available from GitLab EE 9.0 and newer, and that the API v3 does not support approvals at all , I should be able to use the two properties. I'll adapt the PR to use the two properties for better handling in advance, instead of only trying to interpret the response codes after the attempt to approve. @omehegan Do you have any preference how to handle the unsupported methods on the V3GitLabApiProxy? If I remove them, RESTEasy throws a RuntimeException in the tests since the methods in the GitLabApiProxy have no annotations.
|
@padyx TBH I'm not informed enough to have a preference :) If you want to move ahead and just use your own judgment, that's fine with me. |
4356b20
to
2e32ab3
Compare
2e32ab3
to
ecfa747
Compare
I've attempted to implement the other version using the canApprove/hasApproved flags .
For now, I've cleaned up the remaining FIXMEs in the PR and added the info that approvals are available in EE 9.0 and up (since that is when API v4 was introduced). |
I've uploaded a snapshot with this patch to http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/plugins/gitlab-plugin/1.5.12-SNAPSHOT/gitlab-plugin-1.5.12-20181227.052257-3.hpi. I will work on testing it myself. If anyone else is willing to try it, please do. |
I've installed the snapshot version you linked, and all is working with jenkins 2.190.1 and GitLab Enterprise Edition 12.6.4-ee. It approved my merge request as the integration user I configured. I'll gladly do some more testing if you let me know what specifically to look for. I'm really hoping to get this into our production system. |
Any update about this? In plugin 1.5.35 still no "Approve GitLab merge request on success" |
It's been a while and I don't use Jenkins at my current position so I'm no longer pushing this actively. But I'd still be willing to get this back into a mergeable shape, if a maintainer can tell me what is missing to get that done. @omehegan Is anything missing apart from obvious conflicts that I'd need to fix? Otherwise, I'd propose to close this. |
Would be helpful! |
This PR adds a new post-build action to the plugin: The ability to approve / unapprove a merge request depending on the build result (resolves issue #95). It offers a configuration option whether unstable builds should be approved anyway (default: no).
Note: The GitLab approval feature is not available in the self-hosted Community Edition (only Enterprise Edition Starter, or above). The approval feature is available for all public repositories on GitLab.com or in the Bronze tier, or above.
The basic implementation works, but there are several points in need of discussion in this PR before it is ready for merging:
My experimentation yielded these results so far, the last two
The result body contains two very useful attributes, but these aren't mentioned in the API docs - so I'm unsure about relying on them since I don't know if they are available since 8.9:
user_has_approved
anduser_can_approve
.I'd appreciate your input.
Acceptance criteria so far:
Fixes #95