【发布时间】:2018-08-30 07:07:02
【问题描述】:
下一个解决方案应该有效。
deploy_release:
stage: deploy
tags:
- linux
only:
- master
- stable
retry: 2
script:
- do_action 1
- do_action 2
- git push artifacts
deploy_manual:
stage: deploy
tags:
- linux
except:
- master
- stable
when: manual
retry: 2
script:
- do_action 1
- do_action 2
- git push artifacts
但它有一个 ☝️ 显着缺乏 - script: 重复了 2 次。
我认为这样写是个好主意:
.deploy_base:
stage: deploy
tags:
- linux
retry: 2
script:
- do_action 1
- do_action 2
- git push artifacts
deploy_release:
include: .deploy_base
only:
- master
- stable
deploy_manual:
include: .deploy_base
except:
- master
- stable
when: manual
但我怀疑这会奏效。 是否可以在 YAML 中做类似的事情?
另一个直截了当的想法是
将script:移动到单独的文件deploy_script.sh
并在萌芽状态完成问题。
【问题讨论】:
标签: deployment yaml gitlab-ci