As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 4fc02372 authored by Wouter D'Haeseleer's avatar Wouter D'Haeseleer Committed by Jacob Vosmaer
Browse files

Just symlink all hooks found in the gitlab-shell project

Make it possible to place whatever hooks you want inside the hook
folder of the gitlab-shell and they will be symlinked as well. The
symlinks are created when:

* running the support/rewrite-hooks.sh
* Creating a new repo in gitlab

So basically it makes the hooks folder a skeleton for all other projects
parent fbaf8d8c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -182,6 +182,9 @@ class GitlabProjects
private
def create_hooks_to(dest_path)
"ln -s #{File.join(ROOT_PATH, 'hooks', 'update')} #{dest_path}/hooks/update"
symlink_cmds = Dir[File.join(ROOT_PATH, 'hooks', '*')].sort.map do |hook|
"ln -s #{hook} #{dest_path}/hooks/"
end
symlink_cmds.join(' && ')
end
end
Loading
Loading
@@ -101,7 +101,7 @@ describe GitlabProjects do
it "should receive valid cmd" do
valid_cmd = "cd #{tmp_repo_path} && git init --bare"
valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update #{tmp_repo_path}/hooks/update"
valid_cmd << " && ln -s #{ROOT_PATH}/hooks/update #{tmp_repo_path}/hooks/"
gl_projects.should_receive(:system).with(valid_cmd)
gl_projects.exec
end
Loading
Loading
Loading
Loading
@@ -6,8 +6,10 @@
home_dir="/home/git"
src=${1:-"$home_dir/repositories"}
function create_link_in {
ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update"
function create_links_in {
for gitlab_shell_hooks in ${home_dir}/gitlab-shell/hooks/* ; do
ln -s -f "$gitlab_shell_hooks" "$1/hooks/"
done
}
for dir in `ls "$src/"`
Loading
Loading
@@ -15,12 +17,12 @@ do
if [ -d "$src/$dir" ]; then
if [[ "$dir" =~ ^.*\.git$ ]]
then
create_link_in "$src/$dir"
create_links_in "$src/$dir"
else
for subdir in `ls "$src/$dir/"`
do
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
create_link_in "$src/$dir/$subdir"
create_links_in "$src/$dir/$subdir"
fi
done
fi
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment