Home > Back-end >  merge problem in docker-compose and .gitlab-ci.yml
merge problem in docker-compose and .gitlab-ci.yml

Time:05-24

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?

CodePudding user response:

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.

CodePudding user response:

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
  • Related