gitlab版本:12.3.1
一個push動作,先后會執行【pre-receive】【update】【post-receive】
先執行
/opt/gitlab/embedded/service/gitaly-ruby/git-hooks
中的鈎子腳本(shell),其中的腳本會進一步執行
/opt/gitlab/embedded/service/gitaly-ruby/gitlab-shell/hooks
中的腳本(ruby腳本),其中的腳本會進一步檢測執行對應項目的custom_hooks【在<>.git/custom_hooks】
/var/opt/gitlab/git-data/repositories/@hashed/d4/73/d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35.git/custom_hooks
custom_hooks/post-receive
#!/bin/bash echo "開始文件夾同步" CADENCE_DIR=/opt/cadence git --work-tree=$CADENCE_DIR checkout -f echo "文件夾同步完成"
/opt/gitlab/embedded/service/gitaly-ruby/gitlab-shell/hooks/post-receive 文件中添加如下代碼通過push查看正在操作的倉庫
print "gitlab-shell ruby " puts gl_repository puts repo_path puts key_id puts refs puts push_options
