View Source

QuickBuild integrates with GitLab via the GitLab repository. This repository has all features of a normal [Git repository|Working with Git], but add the ability to build against merge requests, and update merge request status based on build result.

h2. Build against merge requests

To build against GitLab merge requests, define a GitLab repository like below:

!repository.png!

In repository definition, you may select to build against merge requests with filter, and then you can add your criteria in format: a=value1&b=value2

!gitlab-merge-requests-settings.png!

You need also specify the private access token in order to build against merge requests. The private access token should have permission to access to APIs and the repo.
See more detailed information on below page:

https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html

h2. GitLab Webhook Integration

QuickBuild can trigger builds via GitLab webhooks since 9.0.

h3. Config GitLab

To enable the webhook, first you need go to GitLab repository webhook settings page to configure the QuickBuild side related information:

!gitlab-settings.png!

see more detailed information on webhooks below:

https://docs.gitlab.com/ee/user/project/integrations/webhooks.html


h3. Config QuickBuild

h4. Add anonymous group
As the webhook is triggered without authentication, anonymous group should be added and it should have the permission to use RESTful API.

h4. Add webhook settings


QuickBuild only allow push event to trigger the builds, other events will be ignored. To add integration at QuickBuild side, please go to configuration settings page and then choose Webhook -> GitLab from right side menu:

!webhooks-menu.png!

Then, you can add the settings:
* *Trigger User* the user to trigger the build
* *Webhook Secret* the secret should be the same as what you defined in GitLab
* *Trigger Condition* the trigger condition in Groovy scripts, when the result is true, build will be triggered, otherwise, the build will not be triggered.

!gitlab-webhook-settings.png!