Browse code

Allow custom local code

Robert Cranston authored on 13/04/2020 18:15:30
Showing 3 changed files

... ...
@@ -6,8 +6,9 @@ Installs [gitolite][], creates a [dedicated user][] to run it (defaults to
6 6
 `git`), prepares for [administering gitolite directly on the server][], allows
7 7
 (explicit) [user created repos][] with [multiple `OWNERS`][] and `user/USER/*`
8 8
 [personal branches][] for `USERS`, allows users to run [`symbolic-ref`][] (e.g.
9
-to change `HEAD`, the default branch), and prepares for [integration with a
10
-webserver][] (including acting as a [`git-http-backend`][] replacement).
9
+to change `HEAD`, the default branch), prepares for [integration with a
10
+webserver][] (including acting as a [`git-http-backend`][] replacement), and
11
+allows [custom local code][].
11 12
 
12 13
 [`ansible-role-gitolite`]: https://git.rcrnstn.net/rcrnstn/ansible-role-gitolite
13 14
 [Ansible]: https://docs.ansible.com/ansible
... ...
@@ -22,6 +23,7 @@ webserver][] (including acting as a [`git-http-backend`][] replacement).
22 23
 [`symbolic-ref`]: https://git-scm.com/docs/git-symbolic-ref
23 24
 [integration with a webserver]: https://gitolite.com/gitolite/gitweb-daemon.html
24 25
 [`git-http-backend`]: https://git-scm.com/docs/git-http-backend
26
+[custom local code]: https://gitolite.com/gitolite/non-core.html#using-the-gitolite-admin-repo-to-manage-non-core-code
25 27
 
26 28
 ## Try out
27 29
 
... ...
@@ -83,7 +83,7 @@
83 83
         # or you can use this, which lets you put everything in a subdirectory
84 84
         # called "local" in your gitolite-admin repo.  For a SECURITY WARNING
85 85
         # on this, see http://gitolite.com/gitolite/non-core.html#pushcode
86
-        # LOCAL_CODE                =>  "$rc{GL_ADMIN_BASE}/local",
86
+        LOCAL_CODE                =>  "$rc{GL_ADMIN_BASE}/local",
87 87
 
88 88
     # ------------------------------------------------------------------
89 89
 
... ...
@@ -109,3 +109,21 @@
109 109
         permissions: 'rwX'
110 110
         default: yes
111 111
         state: 'present'
112
+
113
+    - name: "Get local custom code directory"
114
+      command: "gitolite query-rc LOCAL_CODE"
115
+      register: gitolite_query_local_code
116
+      changed_when: False
117
+
118
+    - name: "Set local code direcory facts"
119
+      set_fact:
120
+        gitolite_post_compile_dir: "{{ gitolite_query_local_code.stdout }}/triggers/post-compile"
121
+        gitolite_hooks_dir: "{{ gitolite_query_local_code.stdout }}/hooks/common"
122
+
123
+    - name: "Create local code directories"
124
+      file:
125
+        path: "{{ item }}"
126
+        state: 'directory'
127
+      loop:
128
+        - "{{ gitolite_post_compile_dir }}"
129
+        - "{{ gitolite_hooks_dir }}"