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

未完待续......

相关推荐
yunson_Liu18 小时前
jenkins更新了gitlab后出现报错
运维·gitlab·jenkins
stark张宇1 天前
Git 与 GitHub 协同工作流:从0到1搭建版本控制体系
git·gitlab·github
牛马的人生6 天前
GitLab入门教程:打开DevOps全流程的大门
运维·其他·gitlab·devops
水冗水孚6 天前
Ubuntu服务器上使用docker-compose部署 gitlab(图文并茂记录)
gitlab
<花开花落>8 天前
gitlab-runner 再次实践中理解和学习
gitlab
Vahala0623-孔勇9 天前
CI/CD流水线优化:GitLab CI镜像构建加速实战
ci/cd·gitlab
Lin_Aries_042110 天前
部署 GitLab 服务器
linux·运维·服务器·docker·gitlab·github
FreeBuf_10 天前
GitLab高危漏洞可致实例崩溃(CVE-2025-10858 和 CVE-2025-8014)
gitlab
恒雨田10 天前
Jenkins安装并与GitLab集成,实现dev、qa、uat、prod多分支持续集成的详细步骤
ci/cd·gitlab·jenkins
꧁༺摩༒西༻꧂10 天前
Windows Server 2022离线搭建Gitlab
gitlab