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也不会合并到目标分支。

未完待续......

相关推荐
hasnum5 小时前
探索 GitLab-Connect:一个连接 GitLab 的轻量级工具
gitlab
极小狐1 天前
极狐GitLab 17.9 正式发布,40+ DevSecOps 重点功能解读【四】
gitlab·devsecops·devops
极小狐2 天前
极狐GitLab 17.9 正式发布,40+ DevSecOps 重点功能解读【三】
gitlab·devsecops·devops
极小狐2 天前
极狐GitLab 17.9 正式发布,40+ DevSecOps 重点功能解读【二】
gitlab·devsecops·devops
lion_zjg2 天前
DOCKER模式部署GITLAB
docker·容器·gitlab
RedCong3 天前
Gitlab配置personal access token
gitlab
Super_man541883 天前
gitlab+jenkins+harbor+k8s安装操作流程之harbor
运维·容器·kubernetes·gitlab·jenkins
极小狐4 天前
极狐GitLab 正式发布安全版本17.9.1、17.8.4、17.7.6
安全·gitlab·devsecops·devops
XMYX-04 天前
代码托管平台对比分析:Gitee与GitLab
gitee·gitlab
GR906 天前
GitLab常用操作
gitlab