选择当前作业继承的全局默认值
可能的取值
default:retry: 2image: ruby:3.0interruptible: truejob1:script: echo "This job does not inherit any default keywords."inherit:default: falsejob2:script: echo "This job inherits only the two listed default keywords. It does not inherit 'interruptible'."inherit:default:- retry- image
上面例子中,全局default 中定义了三个全局变量分别为:retry、image、interruptible。
在job1中不适用全局变量,在job2中仅使用retry、image两个全局变量
用于控制全局变量inherit:variables继承的关键字。
可能的取值:
variables:VARIABLE1: "This is variable 1"VARIABLE2: "This is variable 2"VARIABLE3: "This is variable 3"job1:script: echo "This job does not inherit any global variables."inherit:variables: falsejob2:script: echo "This job inherits only the two listed global variables. It does not inherit 'VARIABLE3'."inherit:variables:- VARIABLE1- VARIABLE2
interruptible: true启用后,在为同一分支上的新更改启动管道时,将取消正在运行的作业。比如说每次提交都会触发代码扫描任务,在很短的时间内连续提交了两次,第一次的任务还没跑完,第二次触发时会中断第一次的任务。
如果设置了interruptible: false 在开始作业后无法取消后续作业
stages:- stage1- stage2- stage3step-1:stage: stage1script:- echo "Can be canceled."interruptible: truestep-2:stage: stage2script:- echo "Can not be canceled."step-3:stage: stage3script:- echo "Because step-2 can not be canceled, this step can never be canceled, even though it's set as interruptible."interruptible: true
在上面例子中,如果此时再次触发流水线,则可能有两种结果
使用retry用于配置作业失败时重试的次数。如果未定义,则默认为0并且作业不会重试。
当一个作业失败时,该作业最多再处理两次。
可能的取值
test:script: rspecretry: 2
使用retry:when with retry:max仅针对特定的失败案例重试作业。 retry:max是最大重试次数,例如retry,可以是 0、1或2。
可能的取值:
test:script: rspecretry:max: 2when: runner_system_failure
如果存在系统故障以外的故障,则不会重试该作业。
test:script: rspecretry:max: 2when:- runner_system_failure- stuck_or_timeout_failure
也可以使用数组来登记多个条件
上一篇:期货是衍生产品(期货衍生产品法)
下一篇:Xxx综合业务平台巡检记录