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

未完待续......

相关推荐
牛奶咖啡131 天前
Git实践——GitLab服务器的部署与使用
gitlab·gitlab是什么·gitlab有啥用·gitlab适用场景·gitlab的版本如何选·安装部署gitlab·gitlab的使用
lisanmengmeng2 天前
Gitlab搭建
gitlab
dapeng-大鹏4 天前
记一次 GitLab Let‘s Encrypt 证书申请失败的排查与修复
gitlab
身如柳絮随风扬4 天前
使用 Docker 部署 GitLab 并分配用户账号 —— 保姆级教程
docker·容器·gitlab
鼎道开发者联盟5 天前
鼎享会 | 从手工到自动化:OpenClaw改造GitLab内部协作流程的全过程
自动化·gitlab·openclaw
ℳ₯㎕ddzོꦿ࿐6 天前
告别手工发版:用 GitLab CI/CD 打通前后端自动化部署的“任督二脉”
ci/cd·自动化·gitlab
ℳ₯㎕ddzོꦿ࿐6 天前
实战:在 Linux 系统用 Docker-Compose 优雅部署 GitLab 及防坑指南
linux·docker·gitlab
源图客6 天前
Linux(CentOS9)服务器部署gitlab-ce-18.11.1-ce.0.el9.x86_64.rpm
linux·服务器·gitlab
ℳ₯㎕ddzོꦿ࿐6 天前
实战篇:结合 GitLab CI/CD 实现 Spring Cloud 微服务自动化部署与防坑指南
spring cloud·ci/cd·gitlab
菜萝卜子7 天前
【Git】GitLab 18.9 全局服务器钩子(Server Hooks)官方规范与落地实践
服务器·git·gitlab