4

I'm working on a project that has two branches, develop and production. The .gitlab-ci.yml has two stages on production branch but three different stages on develop branch. Also the docker-compose file is different on this two branches. When I merge develop to production branch that two files replaced with wrong version. What can I do?

torek
  • 448,244
  • 59
  • 642
  • 775

2 Answers2

4

You can prepare a same file for .gitlab-ci that has all stages and make these pipelines run only when on true branches, with this lines:

  only:
    - develop

and you should prepare two docker-compose and on stage's script, point to the right file on each stage.

Kasra Najafi
  • 560
  • 5
  • 11
3

Agree with Kasra, in addition you can separate develop and production pipelines each on a separate yml files. take a look at the example here: https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image

and make sure to use after every stage that is branch-specific :

  only:
    - develop
mohalahmad
  • 76
  • 5