Added support for gitlab merge requests

Added function to verify if a gitlab merge request is sent.
If yes, then will create a build for the source branch of the request.

Closes #699
This commit is contained in:
Lucas Gois 2014-12-11 11:56:50 -02:00 committed by Dan Cryer
commit b5f6e07068
2 changed files with 18 additions and 5 deletions

View file

@ -256,6 +256,21 @@ class WebhookController extends \PHPCI\Controller
try {
// build on merge request events
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
$attributes = $payload['object_attributes'];
if ( $attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
$branch = $attributes['source_branch'];
$commit = $attributes['last_commit'];
$committer = $commit['author']['email'];
$this->createBuild($project, $commit['id'], $branch, $committer, $commit['message'] );
}
}
// build on push events
if (isset($payload['commits']) && is_array($payload['commits'])) {
// If we have a list of commits, then add them all as builds to be tested: