Gitlab自动化测试的配置

1. 代码分支命名规范检测

Setting → Repository → Push rules → Branch name,添加分支命名规范对应的正则表达式。如:

^(Release|Tag|Develop|Feature).+.+|Main$

表示分支名只能以以下关键字之一开头:Release、Tag、Develop和Feature。

2. 代码log编写规范检测

Setting → Repository → Push rules → Require expression in commit messages,添加log编写规范对应的正则表达式。如:

^(feat|fix|docs|style|refactor|impr|perf|sync|test): .+|Merge .*branch '.+' .*|Revert .+

表示提交的log必须满足以下条件之一:

  1. 以【以下关键字之一 + 半角冒号 + 空格】开头:"feat: "、"fix: "、"docs: "、"style: "、"refactor: "、"impr: "、"perf: "、"sync: "或"test: "。
  2. 以"Merge"开头,后跟任意文本,然后是"branch ",再后跟用单引号括起来的任意文本,最后是任意其他文本的提交消息,如"Merge branch 'development' into main"。
  3. 以"Revert"开头,后跟一个或多个字符的提交消息,如"Revert 'Fix issue #123'"。

3. 代码分支保护

Setting → Repository → Protected branches / Protected Tag,可设置某一分支或者某一类分支关于merge和push的权限。

4. merge的冒烟测试

Setting → General → Merge Requests → Merge options → 勾选"Enable merged results pipelines",表示冒烟测试是测试merge后的代码。

Setting → General → Merge Requests → Merge options → Merge checks → "Pipelines must succeed",表示必须冒烟测试通过才能merge成功,否则即使是人工点击merge也不会合并到目标分支。

未完待续......

相关推荐
极小狐5 天前
极狐GitLab万人并发架构实践,大规模组织的扩容路线图
架构·gitlab·极狐gitlab
Lvan的前端笔记5 天前
GitLab CI 环境变量整理
ci/cd·gitlab
李迟6 天前
CICD实例:解决GitLab Runner无法执行CICD问题
gitlab
hanjq_code8 天前
gitlab本地文件 跨分支 忽略改动 不提交
gitlab
极小狐8 天前
极狐GitLab集群高可用方案,多节点架构与故障自愈实践
架构·gitlab·高可用·极狐gitlab
极小狐9 天前
极狐GitLab主备同步延迟治理,复制滞后监控与优化方法
gitlab·极狐gitlab·geo容灾
极小狐10 天前
跨项目流水线报 404 Not Found?CI_JOB_TOKEN 允许名单 9 步排查
ci/cd·gitlab·devops·权限管理·流水线·极狐gitlab·作业令牌
极小狐10 天前
极狐GitLab双机热备搭建指南,主机备机部署与切换实操
gitlab·高可用·极狐gitlab
有同事要进步17 天前
如何在github或者是gitlab上创建空文件
gitlab·github
GoodStudyAndDayDayUp18 天前
gitlab私有化跑CICD
gitlab·gitlab私有化跑cicd