【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》
相关推荐
plmm烟酒僧2 分钟前
使用 Tmux 在断开SSH连接后,保持会话的生命周期
运维·ssh·tmux·分离会话
多多*2 小时前
Java设计模式 简单工厂模式 工厂方法模式 抽象工厂模式 模版工厂模式 模式对比
java·linux·运维·服务器·stm32·单片机·嵌入式硬件
南鸳6104 小时前
Linux常见操作命令(2)
linux·运维·服务器
Kaede64 小时前
怎么安装JSON服务器?JSON服务器最新安装教程
运维·服务器·json
西北大程序猿4 小时前
linux进程信号 ─── linux第27课
linux·运维·服务器·信号处理
inxunoffice5 小时前
批量给 PDF 添加或删除密码保护,支持设置打开密码、只读密码、限制复制和打印
运维·服务器·pdf
Brandon汐7 小时前
Linux中常用的文件管理命令
linux·运维·服务器
Vacancy空白8 小时前
【Ubuntu常用命令】
linux·运维·ubuntu·ssh
老天文学家了9 小时前
课表周视图数据【示例】
linux·运维·服务器
爪娃侠9 小时前
解决wsl2下CentOS 7 的 yum 仓库无法连接问题
linux·运维·centos