【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》
相关推荐
一叶知秋yyds1 小时前
Ubuntu 虚拟机安装 OpenClaw 完整流程
linux·运维·ubuntu·openclaw
斯普信云原生组2 小时前
Prometheus 环境监控虚机 Redis 方案(生产实操版)
运维·docker·容器
safestar20123 小时前
ES批量写入性能调优:BulkProcessor 参数详解与实战案例
java·大数据·运维·jenkins
Luke~3 小时前
阿里云计算巢已上架!3分钟部署 Loki AI 事故分析引擎,SRE 复盘时间直接砍掉 80%
人工智能·阿里云·云计算·loki·devops·aiops·sre
来一颗砂糖橘3 小时前
负载均衡的多维深度解析
运维·负载均衡
楠奕3 小时前
CentOS7安装GoldenDB单机搭建及常见报错解决方案
linux·运维·服务器
GCTTTTTT4 小时前
远程服务器走本地代理
运维·服务器
剑锋所指,所向披靡!4 小时前
Linux常用指令(2)
linux·运维·服务器
飞Link4 小时前
逆向兼容的桥梁:3to2 自动化降级工具实现全解析
运维·开发语言·python·自动化
LIZhang20165 小时前
linux写一个脚本实时保存内存占用情况
linux·运维·服务器