ori*_*tvv 8 continuous-integration yaml gitlab gitlab-ci
我有一个统一的ci项目。
.gitlab-ci.yml包含.build一个script命令的基本作业。我也有多个指定的工作来构建扩展了基础的每个平台.build。我想为Android执行一些平台特定的命令,所以我创建了单独的job generate-android-apk。但是,如果失败了,管道也会失败。(我知道allow_failure)。是否可以script在作业之间扩展部分而无需复制粘贴?
您可以通过使用“文字块”(使用|)来实现模块化脚本部分,如下所示:
.template1: &template1 |
echo install
.template2: &template2 |
echo bundle
testJob:
script:
- *template1
- *template2
Run Code Online (Sandbox Code Playgroud)
见资料
从GitLab 11.3开始,可以使用extend它也可以为您工作。
.template:
script: echo test template
stage: testStage
only:
refs:
- branches
rspec:
extends: .template1
after-script: echo test job
only:
variables:
- $TestVar
Run Code Online (Sandbox Code Playgroud)
查看文件
| 归档时间: |
|
| 查看次数: |
2227 次 |
| 最近记录: |