【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》
相关推荐
R-sz1 小时前
如何创建伪服务器,伪接口
运维·服务器
python算法(魔法师版)1 小时前
Docker容器启动失败?无法启动?
linux·运维·nginx·docker·容器
酷爱码1 小时前
Ubuntu日志文件清空的三种方式
linux·运维·ubuntu
狄加山6755 小时前
Linux Input子系统与驱动开发实战
linux·运维·驱动开发
小刘|5 小时前
对称加密以及非对称加密
linux·运维·网络
Levin__NLP_CV_AIGC6 小时前
更新 / 安装 Nvidia Driver 驱动 - Ubuntu - 2
linux·运维·ubuntu
DLR-SOFT7 小时前
Windows远程访问Ubuntu的方法
linux·运维·ubuntu
秦jh_7 小时前
【Linux网络】应用层协议HTTP
linux·运维·服务器·网络·网络协议·tcp/ip·http
何怀逸8 小时前
安装 Docker
运维·docker·容器
杰克逊的日记8 小时前
运维体系架构规划
运维·架构