gitlab hooks配置
1、邮件格式过滤
pre-recieive
rev_type=commit
# Only check the first commit information due to a lot of committer email is incorrect in exist git repo
committer_email=$(git log ${oldrev}..${newrev} --pretty=format:%ce)
for email in ${committer_email};do
email_user="${email%@}"
email_domain=${email##@}
query_sql="select email from users where state = 'active' and email ~* '${email_user}@'"
sql_result=psql -t -h 127.0.0.1 -U autotools -d gitlabhq_production -c "${query_sql}"
break
done
allow_domain_list="domain1 domain2 domain3 "
if [[ "$sql_result" == "" || ! ${allow_domain_list} =~ (^|[[:space:]])${email_domain}($|[[:space:]]) ]];then
echo "--rejected: $email is incorrect committer email,committer email MUST be gitlab account."
exit 1
fi
2、主备库同步配置
配置在主库下:
路径/var/opt/gitlab/git-data/repositories/..hooks
添加新的文件post-receive.mirror
!/bin/bash
LogName="/var/opt/gitlab/script/logs/post-receive.log"
NowDate=date
GitBackDir="ip"
GitFilePath=pwd
RemoteGitFilePath="${GitFilePath/*repositories//}"
echo "=====Mirror repo $RemoteGitFilePath_bx to address:$GitBackDirat $NowDate=====" >> $LogName
echo "git@ip:${RemoteGitFilePath}" >>$LogName 2>&1
git push --mirror git@${GitBackDir}:${RemoteGitFilePath} || echo "Failed To Push Mirror">>$LogName 2>&1
将文件post-receive.mirror引入post-receive文件中
system 'dir=pwd;$dir/hooks/post-receive.mirror'
gitlab hooks配置的更多相关文章
- Gerrit与Gitlab同步配置replication&其他配置
一.Gerrit与Gitlab同步配置 当配置好gerrit环境后,还需要与现有gitlab库进行同步配置,否则会影响现有开发与打包流程. 1.安装gerrit replication插件 unzip ...
- Jenkins中使用GitLab的配置
1. 概述 在Jenkins中从GitLab上拉取代码进行打包或测试. 2. 安装 Jenkins和GitLab默认已经安装好,安装过程此处不再赘述. 在Jenkins上安装Git和Gitlab插件, ...
- 【GitLab】gitlab上配置webhook后,点击测试报错:Requests to the local network are not allowed
gitlab上配置webhook后,点击测试报错: Requests to the local network are not allowed 操作如下: 报错: 错误原因: gitlab 10.6 ...
- 本地docker搭建gitlab, 并配置ldap认证
基于Docker在Mac OS X系统中的部署和设置GitLab的具体过程如下: 1. 安装Docker for Mac (参见https://docs.docker.com/docker-for ...
- gitlab发送邮件配置
在使用gitlab过程中,通常需配置邮件来实现代码管理服务器向成员(member)发送邮件.本文将实现gitlab中邮件配置 1.编辑 /etc/gitlab/gitlab.rb,修改配置邮件,这里以 ...
- CentOS gitlab 安装配置
CentOS gitlab 安装配置 2018-11-02 11:23:09 Visit 5 在/etc/yum.repos.d 目录下创建文件gitlab-ce.repo,使用国内的安装源 b ...
- [ci]gitlab安装配置(含gitlab邮件配置)
gitlab安装配置 参考: https://www.unixhot.com/article/48 原则:简单维护为准,故yum安装gitlab 1,gitlab安装 2,gitlab邮箱配置 1,g ...
- 4、git和gitlab的配置(1)
4.0.服务器说明: 服务器名称 ip地址 controller-node1 172.16.1.90 4.1.git介绍: 1.git分布式图: 2.git区域: 3.四种状态: 上面的操作在工作目录 ...
- Centos 6.5 GitLab安装配置搭建详细过程
GitLab搭建详细过程 一.前提 系统:Centos 6.5 软件版本:gitlab-7.8.4 Selinux:关闭 防火墙规则:先清空(搭建好了后续自己添加相关放行规则) 二.yum源配置和 ...
随机推荐
- vue 父子组件之间传参
父组件中有子组件 msg 为父组件向子组件传的内容, 子组件向父组件传参数 子组件:this.$emit("shownumber",[this.num]);//this.$emi ...
- TCP/IP 笔记 - 传输控制协议
与UDP不同,TCP提供面向连接的.可靠的.基于字节流的传输层协议,且提供差错纠正. TCP传输的概念 对与分组丢失和比特差错的处理方法,最直接的方法是重发分组,直到它被正确接收. 这需要一种方法来判 ...
- HDFS-Architecture剖析
1.概述 从HDFS的应用层面来看,我们可以非常容易的使用其API来操作HDFS,实现目录的创建.删除,文件的上传下载.删除.追加(Hadoop2.x版本以后开始支持)等功能.然而仅仅局限与代码层面是 ...
- docker storage driver
docker默认有2种方式用于持久化数据,volumes和bind mounts,也可以使用tmpfs,其中使用volume是持久化数据的最好方式,volume由docker控制管理,使用docker ...
- Django集成OpenLDAP认证
本文详细介绍了django-auth-ldap的使用方法,参数含义,并提供了示例代码 版本说明 Django==2.2 django-auth-ldap==1.7.0 集成过程 Django集成LDA ...
- Filebeat的Registry文件解读
你可能没有注意但很重要的filebeat小知识 Registry文件 Filebeat会将自己处理日志文件的进度信息写入到registry文件中,以保证filebeat在重启之后能够接着处理未处理过的 ...
- WEB安全:Tomcat 只可通过域名访问,禁止通过 IP 访问
服务器为什么要禁止通过IP直接访问? 1.若公布于外网的服务器IP地址未备案,就有可能被工信部查封.这样备案的域名也会无法访问. 2.如果AppScan通过ip访问扫描,会有“发现内部ip泄露模式”的 ...
- openssl rsa/pkey
openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html openssl rsa和openssl pkey分别是RSA密钥的处理工具和 ...
- c# 生成验证码图片
/// <summary> /// 生成验证码图片 /// </summary> /// <returns></returns> public byte ...
- asp.net通过后台代码给前台设置css样式,下拉列表在js中的取值
后台根据不同的用户登陆隐藏或显示前台div标签 前台: 将div声明成服务器端控件 <div id="div1" runat="server">.. ...