我们有一个基于Gitlab CD / CI的主存储库。
现在,随着我们的成长,我们很难使用Git的自动部署来更新客户的每个应用程序。
现在,我们正在寻找一种解决方案,当生产阶段成功并通过测试时,我们所有的客户都将获得最新的部署并自动提取更新。 (继续交付)
Gitlab中有一个deploy to production,但是它用于单次生产,我们想为每个镜像重复此步骤。
最佳答案
Gitlab-CI部署阶段可以具有多个环境,您可以将每个环境设置为自动/手动部署。
示例:只需将登台更改为customer1,将生产更改为customer2,然后根据需要添加任意数量。
stages:
- test
- build
- deploy
test:
stage: test
script: echo "Running tests"
build:
stage: build
script: echo "Building the app"
deploy_staging:
stage: deploy
script:
- echo "Deploy to staging server"
environment:
name: staging
url: https://staging.example.com
only:
- master
deploy_prod:
stage: deploy
script:
- echo "Deploy to production server"
environment:
name: production
url: https://example.com
when: manual
only:
- master
如果您无权访问客户环境,则另一个解决方案是应用程序自动更新。
还可以 check out 大三角帆,它似乎是专门为CD设计的。
关于docker - 部署到多个生产服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51578776/