]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Added a comment: gitlab post-receive hook
authorac_w <ac_w@web>
Thu, 6 May 2021 15:38:32 +0000 (11:38 -0400)
committeradmin <admin@branchable.com>
Thu, 6 May 2021 15:38:32 +0000 (11:38 -0400)
doc/forum/Best_way_to_setup_LDAP_authentication___63__/comment_2_adcd5b2ca8e443a58a29d1a39e99a9fe._comment [new file with mode: 0644]

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 (file)
index 0000000..3602056
--- /dev/null
@@ -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/<group_hash>/<repo_hash>.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/<group_hash>/<repo_hash>.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://<wiki_url>/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/<group_hash>/<repo_hash>.git/custom_hooks`
+
+- `chmod +x /var/opt/gitlab/git-data/repositories/@hashed/<group_hash>/<repo_hash>.git/custom_hooks/post-receive`
+
+"""]]