]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/forum/Best_way_to_setup_LDAP_authentication___63__/comment_2_adcd5b2ca8e443a58a29d1a39e99a9fe._comment
Added a comment: gitlab post-receive hook
[git.ikiwiki.info.git] / doc / forum / Best_way_to_setup_LDAP_authentication___63__ / comment_2_adcd5b2ca8e443a58a29d1a39e99a9fe._comment
1 [[!comment format=mdwn
2  username="ac_w"
3  avatar="http://cdn.libravatar.org/avatar/a76f89f70fffde5fbdacaa2a0438d8d9"
4  subject="gitlab post-receive hook"
5  date="2021-05-06T15:38:16Z"
6  content="""
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 :
15 ```bash
16 #!/bin/sh
17 git log -1 --format=format:%ae HEAD | grep -e '@web$' -e 'ikiwiki' ||  wget \"https://<wiki_url>/ikiwiki.cgi?do=ping\" -O -
18 ```
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`
26 """]]