当前位置:   article > 正文

【DEVOPS】gitChecker快速使用指南

【DEVOPS】gitChecker快速使用指南

1. 前言

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

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

2. gitChecker简介

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

3. 快速应用

################ 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44

4. 相关

  1. Github - SVNChecker
  2. Gitee - gitChecker
  3. 【DEVOPS】借助SvnChecker实现SVN提交日志规范的落地
  4. 《SVNChecker_Overview_V1_0官方文档.pdf》
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/903604
推荐阅读
相关标签
  

闽ICP备14008679号