【发布时间】:2022-01-22 08:49:39
【问题描述】:
这是我们简化的 gitlab-ci.yml
stages:
- build
- deploy
# fetch home repo that'll run the pipeline processes
before_script:
- git clone git@git.org:home_repo/home_repo.git
- cd home_repo
build:
stage: build
needs: []
resource_group: $CI_PROJECT_NAME'_build'
script:
- ./pipeline.sh build
deploy_environment1:
stage: deploy
needs: [build]
resource_group: deploy_environment1
script:
- ./pipeline.sh deploy env1
deploy_environment2:
stage: deploy
needs: [build]
resource_group: deploy_environment2
script:
- ./pipeline.sh deploy env2
添加 5-10 个环境会大大增加规模。我们该如何处理?
可能的解决方案 1: 有一项工作将创建所有可用环境的列表并部署到它们。但是,我们无法很好地了解每个部署的进展情况。
deploy_environments:
stage: deploy
needs: [build]
resource_group: deploy_environments
script:
- ./pipeline.sh deploy to_all
可能的解决方案 2:
before_script 获取所有环境的列表并根据需要插入尽可能多的deploy_environment 作业定义。但我们不知道该怎么做。因此标题中的问题。
【问题讨论】:
标签: continuous-integration gitlab-ci continuous-deployment