kyb*_*kyb 2 deployment yaml gitlab-ci
下一个解决方案应该起作用。
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
Run Code Online (Sandbox Code Playgroud)
但是它有一个?? 严重不足– 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
Run Code Online (Sandbox Code Playgroud)
但我怀疑这会奏效。 是否可以在YAML中做类似的事情?
另一个简单的想法是
script:到单独的文件deploy_script.sh并解决问题。
这是 https://docs.gitlab.com/ce/ci/yaml/README.html#extends
在GitLab 11.3中引入
extends定义使用扩展名的作业将要继承的条目名称。
extends替代使用YAML锚点的方法更灵活,更易读。
.tests:
only:
refs:
- branches
rspec:
extends: .tests
script: rake rspec
stage: test
only:
variables:
- $RSPEC
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
432 次 |
| 最近记录: |