Browse code

Use git-multihook

Robert Cranston authored on 14/04/2020 04:16:48
Showing 3 changed files

... ...
@@ -8,7 +8,8 @@ Installs [gitolite][], creates a [dedicated user][] to run it (defaults to
8 8
 [personal branches][] for `USERS`, allows users to run [`symbolic-ref`][] (e.g.
9 9
 to change `HEAD`, the default branch), prepares for [integration with a
10 10
 webserver][] (including acting as a [`git-http-backend`][] replacement, and
11
-serving repos without the `.git` suffix), and allows [custom local code][].
11
+serving repos without the `.git` suffix), allows [custom local code][], and
12
+prepares for [easy usage][`git-multihook`] of [custom local hooks][].
12 13
 
13 14
 [`ansible-role-gitolite`]: https://git.rcrnstn.net/rcrnstn/ansible-role-gitolite
14 15
 [Ansible]: https://docs.ansible.com/ansible
... ...
@@ -24,6 +25,8 @@ serving repos without the `.git` suffix), and allows [custom local code][].
24 25
 [integration with a webserver]: https://gitolite.com/gitolite/gitweb-daemon.html
25 26
 [`git-http-backend`]: https://git-scm.com/docs/git-http-backend
26 27
 [custom local code]: https://gitolite.com/gitolite/non-core.html#using-the-gitolite-admin-repo-to-manage-non-core-code
28
+[`git-multihook`]: https://git.rcrnstn.net/rcrnstn/git-multihook
29
+[custom local hooks]: https://gitolite.com/gitolite/cookbook#adding-other-non-update-hooks
27 30
 
28 31
 ## Try out
29 32
 
... ...
@@ -4,3 +4,9 @@ gitolite_user_name: "git"
4 4
 gitolite_user_group: "{{ gitolite_user_name }}"
5 5
 gitolite_user_home: "/home/{{ gitolite_user_name }}"
6 6
 gitolite_webserver_user_name: "www-data"
7
+gitolite_deps_dir: "{{ gitolite_user_home }}"
8
+gitolite_deps_git_multihook:
9
+  - "https://git.rcrnstn.net/rcrnstn/git-multihook"
10
+gitolite_deps: "{{
11
+  gitolite_deps_git_multihook
12
+}}"
... ...
@@ -133,3 +133,20 @@
133 133
         src: "update-gitweb-access-list"
134 134
         dest: "{{ gitolite_post_compile_dir }}/update-gitweb-access-list"
135 135
       notify: 'gitolite compile'
136
+
137
+    - name: "Clone dependencies"
138
+      git:
139
+        repo: "{{ item }}"
140
+        dest: "{{ gitolite_deps_dir }}/{{ item | basename }}"
141
+      loop: "{{ gitolite_deps }}"
142
+
143
+    - name: "Symlink 'git-multihook'"
144
+      file:
145
+        src: "{{ gitolite_deps_dir }}/git-multihook/git-multihook"
146
+        dest: "{{ gitolite_hooks_dir }}/git-multihook"
147
+        state: 'link'
148
+
149
+    - name: "Run 'git-multihook'"
150
+      command: "{{ gitolite_hooks_dir | quote }}/git-multihook update"
151
+      register: result
152
+      changed_when: result.stdout != ""