Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab-CI: gitlab ci trigger build only for merge request

Im using gitlab 8.1.4. And using gitlab-ci thats comes built-in. By default, gitlab-ci is triggering build for every push. How can make it trigger only during creation of merge request?

Thanks in advance

like image 591
Kaviraj Kanagaraj Avatar asked Nov 25 '15 06:11

Kaviraj Kanagaraj


2 Answers

Try the following into your .gitlab-ci.yml file.

stage: build
script:
    - xxxxx
artifacts:
    paths:
        - xxxxx
tags:
    - xxxx
only:
    - merge_requests

Source: https://docs.gitlab.com/ee/ci/yaml/#only-and-except-simplified

like image 139
santhoshRenga Avatar answered Oct 11 '22 22:10

santhoshRenga


You could try gitlab-ci-build-on-merge-request. Gitlab issue that explores other options - https://gitlab.com/gitlab-org/gitlab-ci/issues/360.

Disclaimer: I'm the author of gitlab-ci-build-on-merge-request.

like image 38
Stanley Shyiko Avatar answered Oct 11 '22 22:10

Stanley Shyiko