summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-11-02 10:40:48 +0000
committerRémy Coutable <remy@rymai.me>2016-11-02 10:40:48 +0000
commit808d49978cfaec49474993add3b153ad86ed880b (patch)
tree7a9ae99ecfdf1434e5ecfa3b459b00595d0b3eff /lib
parentd733a966e472a2a0377c5758657bba6228a57080 (diff)
parentaf5322e90b47e830e7713482854ddf6450a0d8c1 (diff)
downloadgitlab-ce-808d49978cfaec49474993add3b153ad86ed880b.tar.gz
Merge branch 'create_hooks_rake' into 'master'
Add Rake task to create/repair GitLab Shell hooks symlinks ## What does this MR do? Adds a Rake task wrapper around `gitlab-shell` `bin/create_hooks` script. This makes it easier for an administrator to repair hooks symlinks without worrying about where repository data is located, etc. Just run this task and it takes care of everything based on current configuration. ## Are there points in the code the reviewer needs to double check? No. ## Why was this MR needed? `bin/create_hooks` was not well-documented. It requires parameters specifying where repository data is located. It also needs to be run by the `git` user. Wrapping it in a Rake task allows us to take current configuration in to account and makes it easier on the administrator. See merge request !5634
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/gitlab/shell.rake15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index 210899882b4..58761a129d4 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -63,11 +63,11 @@ namespace :gitlab do
# Launch installation process
system(*%W(bin/install) + repository_storage_paths_args)
-
- # (Re)create hooks
- system(*%W(bin/create-hooks) + repository_storage_paths_args)
end
+ # (Re)create hooks
+ Rake::Task['gitlab:shell:create_hooks'].invoke
+
# Required for debian packaging with PKGR: Setup .ssh/environment with
# the current PATH, so that the correct ruby version gets loaded
# Requires to set "PermitUserEnvironment yes" in sshd config (should not
@@ -102,6 +102,15 @@ namespace :gitlab do
end
end
end
+
+ desc 'Create or repair repository hooks symlink'
+ task create_hooks: :environment do
+ warn_user_is_not_gitlab
+
+ puts 'Creating/Repairing hooks symlinks for all repositories'
+ system(*%W(#{Gitlab.config.gitlab_shell.path}/bin/create-hooks) + repository_storage_paths_args)
+ puts 'done'.color(:green)
+ end
end
def setup