• 如何在GitLab版本 12.6.0-ee 中配置全局git钩子?(The gitlab-shell hooks have been migrated to Gitaly)


    在/opt/gitlab/embedded/service/gitlab-shell/hooks 目录下pre-receive显示

    #!/bin/sh
    echo "The gitlab-shell hooks have been migrated to Gitaly, see https://gitlab.com/gitlab-org/gitaly/issues/1226"
    exit 1
    

      所以pre-receive变位置了

    但是全局的配置暂时还是没有生效,

    单个库的配置还是和以前一样:

    <repositories>.git 下面新建custom_hooks

     然后在custom_hooks 里面新建自定义的hook:

    set -x
    z40=0000000000000000000000000000000000000000
    while read oldrev newrev refname; do
      echo 'old version:'${oldrev}
      echo 'new version:'${newrev}
      echo 'branch:'${refname}
      branch="$(echo $refname|awk -F '/' '{print $3}')"
       if [ "$newrev" = $z40 ]
            then
            # Handle delete
            :
            else
    		if [ "$oldrev" = $z40 ]
    		then
    				# New branch, examine all commits
    				range="$newrev"
    		else
    				# Update to existing branch, examine new commits
    				range="$oldrev..$newrev"
    		fi
    		# Check for dev/test merged commit
    		release_commit=$(git rev-list -n 1  --grep '.git into' "$range")
    		if [ -n "$release_commit" ]
    		then
                echo >&2 "Found [$branch merged] commit, push rejected!!!"
                exit 1
    		fi
        fi
    done
    echo >&2 "prevent branch merged by $branch check passed"
    set +x
    

      

      

  • 相关阅读:
    注册算法入门
    call传参之通过堆栈
    winhex注意
    输入字符串长度
    integer promotion
    网页flash兼容浏览器代码
    逆向工程——注册篇
    esp定律的一点说明
    base64
    意外
  • 原文地址:https://www.cnblogs.com/lambertwe/p/14442602.html
Copyright © 2020-2023  润新知