I need to deploy my application on multiple servers.
I have hosted my source code on gitlab-ci. I have setup envrionnement variables and .gitlab-ci.yml file
It works great for a single server: I can build docker images and push this images to a registry. Then i am deploying this images on a kubernetes infrastructure. All operations are described in .gitlab-ci.yml
What i need to do is to "repeat" .gitlab-ci.yml steps for each server. I need a different set of envrionment variables for each server. (I will need one docker image for each server, for each upgrade of my application).
Is there a way to do this with gitlab-ci ?
Thanks
** EDIT **
Here is my .gitlab-ci.yml:
stages:
- build
- deploy
build:
stage: build
script:
- docker image build -t my_ci_registry_url/myimagename .
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- docker push my_ci_registry_url/myimagename
deploy:
stage: deploy
environment: production
script:
- kubectl delete --ignore-not-found=true secret mysecret
- kubectl create secret docker-registry mysecret --docker-server=$CI_REGISTRY --docker-username=$CI_REGISTRY_USER --docker-password=$CI_REGISTRY_PASSWORD
- kubectl apply -f myapp.yml
- kubectl rollout restart deployment/myapp-deployment