Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab CI Pipeline on specific branch only

I'm trying to implement GitLab CI Pipelines to build and deploy an Angular app. In our project we have two general branches: master (for production only) and develop. For development we create feature/some-feature branches from develop branch. When development finished, we create merge request from feature/some-feature to develop. When merge request approved and merged into develop branch I want to run a Pipeline in order to build application and deploy the build on some environment.

I use the following setup in .gitlab-ci.yml:

image: node:7.5-configured  stages:     - build     - deploy  build_job:     stage: build     only:         - develop     script:         - /bin/bash <some script here>  ... 

The problem is that Pipeline executed every time I push into any feature/some-feature branch. What's wrong with my setup? How can I force the Pipeline to be executed only when push performed into develop branch directly?

Solution It was my mistake - I had two different .gitlab-ci.yml files in develop branch and feature/some-feature branch.

like image 498
ProximaCygni Avatar asked Oct 26 '17 08:10

ProximaCygni


Video Answer


1 Answers

It was my mistake - I had two different .gitlab-ci.yml files in develop branch and feature/some-feature branch and that's why the Pipeline was executed for all branches.

like image 77
ProximaCygni Avatar answered Sep 22 '22 11:09

ProximaCygni