【DEVOPS】gitChecker快速使用指南

0. 目录

      • [1. 前言](#1. 前言)
      • [2. gitChecker简介](#2. gitChecker简介)
      • [3. 快速应用](#3. 快速应用)
      • [4. 相关](#4. 相关)

1. 前言

时过境迁,原本以为不需要文档说明的操作,四年后的现在因为GitLab服务器的掉电损坏,被迫面对从零开始的一切,才发现实际执行时的一步一个坑。

痛定思痛之下,决定重新整理思维,于是便有了本文。

2. gitChecker简介

Gitee - gitChecker借鉴自SVNChecker, 简化GIT服务端的Hook功能实现,实现逻辑复用。

3. 快速应用

shell 复制代码
################ 1. clone gitchecker project
cd /usr/local/
git clone https://gitee.com/lqzkcx3/gitchecker.git
mv gitchecker _gitchecker

################ 2. install hook
########### 2.1 pre-commit
# 基于全局hook
cd /opt/gitlab/embedded/service/gitlab-shell/hooks
mkdir pre-receive.d && cd $_ 
vi pre-commit.sh
	#!/bin/sh
	/usr/bin/python2.7 /usr/local/_gitchecker/Main.py PpreCommit || exit 1

chmod +x  pre-commit.sh   # 调整这个脚本的权限, 千万注意. 这里特意将这条命令单独列了出来.

########### 2.2 post-commit
# 基于全局hook
cd /opt/gitlab/embedded/service/gitlab-shell/hooks
mkdir post-receive.d && cd $_
vi post-commit.sh
	#!/bin/sh
	/usr/bin/python2.7 /usr/local/_gitchecker/Main.py PostCommit || exit 1

chmod +x  post-commit.sh   # 调整这个脚本的权限, 千万注意. 这里特意将这条命令单独列了出来.

################ 3. 配置gitcheckerconfig.ini (详细说明参见底部参考链接)
[Default]
#This property tells gitchecker about all checks
#(UnitTests, AccessRights, XMLValidator etc) it should execute.
#Separated with comma (",")
Main.PostCommitChecks=PushCommitMsgToZentao

PushCommitMsgToZentao.FailureHandlers=Console
PushCommitMsgToZentao.SuccessHandlers=Console

################ 4. 拷贝相应的hook脚本(这里以PushCommitMsgToZentao.py为例)
cd /usr/local/_gitchecker
cp checks_extend/PushCommitMsgToZentao.py checks/

################ 5. 测试验证
cp /usr/local/_gitchecker/test/test-post-commit.sh ${gitLocalRespRootPath}
chmod +x test-post-commit.sh
./test-post-commit.sh

4. 相关

  1. Github - SVNChecker
  2. Gitee - gitChecker
  3. 【DEVOPS】借助SvnChecker实现SVN提交日志规范的落地
  4. 《SVNChecker_Overview_V1_0官方文档.pdf》
相关推荐
Yana.nice8 小时前
Linux 只保留 30 天内日志(find命令删除日志文件)
linux·运维·chrome
2601_9605679610 小时前
电商套图自动化效率的工程量化分析——从逐张生成到批量套图的架构演进
运维·架构·自动化
吳所畏惧11 小时前
宝塔面板Redis密码修改指南:SSH命令修改 vs 面板UI界面修改,哪个更靠谱?
运维·服务器·数据库·redis·缓存·ssh
HiDev_12 小时前
【非标自动化】2、认识元器件(确定目标)
运维·自动化
Zhang~Ling12 小时前
从 fopen 到 struct file:从零开始拆解 Linux 文件 I/O
linux·运维·服务器
爱写代码的森12 小时前
蒙三方库 | harmony-utils之FileUtil文件重命名与属性查询详解
linux·运维·服务器·华为·harmonyos·鸿蒙·huawei
中微极客13 小时前
2026主流AI Agent框架技术选型与性能对比
运维·网络·人工智能
久曲健的测试窝13 小时前
智能座舱自动化测试落地方案:数字仿真搭配实车实测,解决用例运维与场景失真难题
运维
wangruofeng13 小时前
git-filter-repo 把 .git 从 112MB 砍到 1.4MB,但漏推 tag 让 clone 又胖回来
github·devops
AOwhisky14 小时前
Python 学习笔记(第十五期)——运维自动化(下·后篇):堡垒机实战——paramiko高阶篇
运维·python·学习·云原生·自动化·运维开发