script | 由Runner执行的Shell脚本。 |
image | 使用docker镜像, image:name |
service | 使用docker services镜像, services:name |
before_script | 执行做业前运行的脚本 |
after_script | 做业完成后运行的脚本 |
stages | 定义管道中的步骤,依次运行 |
stage | 定义管道中步骤的做业段 |
only | 指定做业限制only:refs ,only:kubernetes ,only:variables ,和only:changes |
tags | 指定执行做业的runner |
allow_failure | 让job失败 |
when | 何时开始工做,
|
environment | 做业部署到的环境名称 #暂未搞清 |
cache | key: |
artifacts | job成功时附加到做业的文件或目录git |
dependencies | 此job依赖其余jobz,主要做用于做业优先级 |
converage | 给定做业代码覆盖率设置 |
retry | 在发生故障时,能够自动重试做业的次数。 |
parallel | 应该并行运行多少个做业实例 |
trigger | 定义下游管道触发器 |
include | 容许此做业包含外部YAML |
extends | 此做业将继承的配置项 |
pages | 上传做业结果用于gitlab pages |
variables | 做业级别定义做业变量 |
runner的执行方式为shell的简单示例。docker
1 cache: 2 key:"$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG" #为每分支提供缓存 3 paths: 4 - node_modules #缓存哪些文件/文件夹 5 - bower_components 6 before_script: 7 -echo "执行前运行脚本" 8 after_script: 9 -echo "执行后运行脚本" 10 stages: #设置步骤有哪些,经常使用三大块,建立,测试,发布 11 -build 12 -test 13 -deploy 14 Job1: #设置某一步的运行工做,每一个步骤可有多个job同步进行,也可设置dependencies限制 15 stage:build #此job属于哪一个步骤 16 script: 17 -echo "go go go" 18 only: 19 -master #哪一个分支触发 20 tags: 21 -share #指定runner,注册runner时填写的tag 22 test: 23 stage:test 24 script: 25 -echo "测试开始" 26 only: 27 -master 28 tags: 29 -share 30 deploy: 31 stage:deploy 32 when: 33 - manual #上面有解释 34 script: 35 -echo "部署开始" 36 only: 37 -master 38 tags: 39 -share