From: ac_w Date: Thu, 6 May 2021 15:38:32 +0000 (-0400) Subject: Added a comment: gitlab post-receive hook X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/1461e2a3c9f0a4d0726ba8e0066c8c85f267b3ff Added a comment: gitlab post-receive hook --- diff --git a/doc/forum/Best_way_to_setup_LDAP_authentication___63__/comment_2_adcd5b2ca8e443a58a29d1a39e99a9fe._comment b/doc/forum/Best_way_to_setup_LDAP_authentication___63__/comment_2_adcd5b2ca8e443a58a29d1a39e99a9fe._comment new file mode 100644 index 000000000..3602056fd --- /dev/null +++ b/doc/forum/Best_way_to_setup_LDAP_authentication___63__/comment_2_adcd5b2ca8e443a58a29d1a39e99a9fe._comment @@ -0,0 +1,26 @@ +[[!comment format=mdwn + username="ac_w" + avatar="http://cdn.libravatar.org/avatar/a76f89f70fffde5fbdacaa2a0438d8d9" + subject="gitlab post-receive hook" + date="2021-05-06T15:38:16Z" + content=""" +Concerning the post-receive hook that I mentioned in the previous comment, it turned out I didn't have to bother with webhooks. Even though it's a bit out of the scope of this topic, here is how to do it: + +- Find the hashed name of the repository in the Admin Area of gitlab. ([see details](https://docs.gitlab.com/ee/administration/repository_storage_types.html#from-project-name-to-hashed-path)) + +- `mkdir /var/opt/gitlab/git-data/repositories/@hashed//.git/custom_hooks` ([see details](https://github.com/gitlabhq/gitlabhq/blob/667c0a909bde1cf71f21d8ec9768e98b1c489030/doc/hooks/custom_hooks.md)) + +- create `/var/opt/gitlab/git-data/repositories/@hashed//.git/custom_hooks/post-receive` with the following content : + +```bash +#!/bin/sh +git log -1 --format=format:%ae HEAD | grep -e '@web$' -e 'ikiwiki' || wget \"https:///ikiwiki.cgi?do=ping\" -O - +``` + +(without the shebang it doesn't work, also I had to remove the `/dev/stdout` part otherwise the shell complains git can't write to it) + +- `chown -R git:root /var/opt/gitlab/git-data/repositories/@hashed//.git/custom_hooks` + +- `chmod +x /var/opt/gitlab/git-data/repositories/@hashed//.git/custom_hooks/post-receive` + +"""]]