3 avatar="http://cdn.libravatar.org/avatar/a76f89f70fffde5fbdacaa2a0438d8d9"
4 subject="gitlab post-receive hook"
5 date="2021-05-06T15:38:16Z"
7 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:
9 - 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))
11 - `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))
13 - create `/var/opt/gitlab/git-data/repositories/@hashed/<group_hash>/<repo_hash>.git/custom_hooks/post-receive` with the following content :
17 git log -1 --format=format:%ae HEAD | grep -e '@web$' -e 'ikiwiki' || wget \"https://<wiki_url>/ikiwiki.cgi?do=ping\" -O -
20 (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)
22 - `chown -R git:root /var/opt/gitlab/git-data/repositories/@hashed/<group_hash>/<repo_hash>.git/custom_hooks`
24 - `chmod +x /var/opt/gitlab/git-data/repositories/@hashed/<group_hash>/<repo_hash>.git/custom_hooks/post-receive`