我想要一个阻止手动操作,它将在下一阶段触发多个并行作业。我该如何实现?例如:
这是我尝试过的:
stages:
- deploy-dev
- deploy-prd-1
- deploy-prd-2
deploy-dev:
stage: deploy-dev
script:
- echo deploy-dev
deploy-prd-1:
when: manual
allow_failure: false
stage: deploy-prd-1
script:
- echo deploy-prd-1
deploy-prd-2:
stage: deploy-prd-2
script:
- echo deploy-prd-2
这实现了1和2,但失败了3,因为deploy-prd-1和deploy-prd-2是串联的,而不是并行的
stages:
- deploy-dev
- deploy-prd
deploy-dev:
stage: deploy-dev
script:
- echo deploy-dev
deploy-prd-1:
when: manual
allow_failure: false
stage: deploy-prd
script:
- echo deploy-prd-1
deploy-prd-2:
stage: deploy-prd
script:
- echo deploy-prd-2
此操作在2日失败,因为deploy-prd-2将自动运行,而无需等待手动触发器
stages:
- deploy-dev
- deploy-prd
deploy-dev:
stage: deploy-dev
script:
- echo deploy-dev
deploy-prd-1:
when: manual
allow_failure: false
stage: deploy-prd
script:
- echo deploy-prd-1
deploy-prd-2:
when: manual
allow_failure: false
stage: deploy-prd
script:
- echo deploy-prd-2
这不是理想的选择,因为它需要分别手动触发每个并行作业。
stages:
- deploy-dev
- approve
- deploy-prd
deploy-dev:
stage: deploy-dev
script:
- echo deploy-dev
approve:
when: manual
allow_failure: false
deploy-prd-1:
stage: deploy-prd
script:
- echo deploy-prd-1
deploy-prd-2:
stage: deploy-prd
script:
- echo deploy-prd-2
这是我尝试设置手动“门”的尝试,但是gitlab用Error: jobs:approve script can't be blank
拒绝文件。
我可以像script: [":"]
这样设置无操作,但是现在gitlab会启动一个容器不做任何事情,这浪费了时间和资源。