GitLab CI/CD 书写规范

GitLab CI/CD 书写规范

参考:https://docs.gitlab.com/ee/ci/yaml/

示例

在这里插入图片描述

主作业名称

image
services
stages
types
before_script
after_script
variables
cache

配置参数

script	由Runner执行的Shell脚本。
image	使用docker映像。也可用:image:name和image:entrypoint。
services	使用docker服务映像。也可用:services:name,services:alias,services:entrypoint,和services:command。
before_script	覆盖作业之前执行的一组命令。
after_script	覆盖作业后执行的一组命令。
stages	定义管道中的阶段。
stage	定义一个作业阶段(默认值:)test。
only	限制创建作业的时间。也可用:only:refs,only:kubernetes,only:variables,和only:changes。
except	限制不创建作业的时间。也可用:except:refs,except:kubernetes,except:variables,和except:changes。
rules	评估和确定作业的选定属性以及是否创建作业的条件列表。不能与only/ 一起使用except。
tags	用于选择Runner的标签列表。
allow_failure	允许作业失败。失败的工作不会影响提交状态。
when	什么时候开始工作。也可用:when:manual和when:delayed。
environment	作业部署到的环境的名称。也可用:environment:name,environment:url,environment:on_stop,和environment:action。
cache	在后续运行之间应缓存的文件列表。也可用:cache:paths,cache:key,cache:untracked,和cache:policy。
artifacts	成功时附加到作业的文件和目录列表。也可用:artifacts:paths,artifacts:expose_as,artifacts:name,artifacts:untracked,artifacts:when,artifacts:expire_in,artifacts:reports,和artifacts:reports:junit。

在GitLab 企业版,这些都是可供选择:artifacts:reports:codequality,artifacts:reports:sast,artifacts:reports:dependency_scanning,artifacts:reports:container_scanning,artifacts:reports:dast,artifacts:reports:license_management,artifacts:reports:performance和artifacts:reports:metrics。
dependencies	通过提供要从中获取工件的作业列表,限制将哪些工件传递给特定作业。
coverage	给定作业的代码覆盖率设置。
retry	发生故障时可以自动重试作业的次数和次数。
timeout	定义优先于项目范围设置的自定义作业级别超时。
parallel	多少个作业实例应并行运行。
trigger	定义下游管道触发器。
include	允许此作业包括外部YAML文件。也可用:include:local,include:file,include:template,和include:remote。
extends	该作业将要继承的配置条目。
pages	上载作业结果以用于GitLab页面。
variables	在作业级别上定义作业变量。
interruptible	定义在通过新的运行使其冗余时是否可以取消作业。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值