Following Szenario. I've got 1 production and 2 development branches which should be deployed with different environment variables
- prod
- dev1
- dev2
I want to separate the deploy into 2 different stages
- build
- deploy
How to configure the gitlab-ci file, to store the scripts and stages for each branch?
I've tried several things but do not get a valid working ci.
stages:
- build
- deploy
variables:
IMAGE: my_image
# Production
prod:
stage: build
script:
- docker build -t $IMAGE --build-arg RAILS_ENV=production .
only:
- prod
stage: deploy
script:
- docker push $IMAGE
- docker run -e "some production relevated env vars"
only:
- prod
# Development 1
dev1:
stage: build
script:
- docker build -t $IMAGE --build-arg RAILS_ENV=staging .
only:
- dev1
stage: deploy
script:
- docker push $IMAGE
- docker run -e "some dev1 relevated env vars"
only:
- dev1
# Development 2
dev2:
stage: build
script:
- docker build -t $IMAGE --build-arg RAILS_ENV=staging .
only:
- dev2
stage: deploy
script:
- docker push $IMAGE
- docker run -e "some dev2 relevated env vars"
only:
- dev2
Is there a possibility to split Jobs that way?