about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-29 07:33:11 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-29 07:37:22 -0700
commit2d9515ab089287516fb7c0048f7fffbacf1d5c36 (patch)
treeb475528888ab1b1bce671ec57b05a3aa58c3b412
parentfix(cgit): ensure permissions are set correctly (diff)
downloadworld-2d9515ab089287516fb7c0048f7fffbacf1d5c36.tar.gz
feat(cgit): exclude some repositories
There are a few repositories that I want to have active in gerrit but I
don't want to list in cgit.

Change-Id: I341801cddba0909d5c32d2653c8cc5eb8aae94ed
Reviewed-on: https://cl.fcuny.net/c/world/+/124
Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to '')
-rw-r--r--modules/services/cgit/default.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/services/cgit/default.nix b/modules/services/cgit/default.nix
index 1c07049..9d7cb9a 100644
--- a/modules/services/cgit/default.nix
+++ b/modules/services/cgit/default.nix
@@ -56,10 +56,17 @@ in {
         script = ''
           mkdir -p /var/lib/cgit/cache
           tmplist=$(mktemp)
+
           # as per https://gerrit-review.googlesource.com/Documentation/rest-api.html#output we need to remove `)]}' from the response
           repos=$(${pkgs.curl}/bin/curl -s -H "Content-Type: application/json" "https://cl.fcuny.net/projects/?state=ACTIVE"|sed "s/^)]}'//"|${pkgs.jq}/bin/jq -r 'to_entries | .[] | .value | .id')
+
+          # list of repositories that I still want to be active in gerrit but I don't want to list here
+          exclude_repos="password-store|All-Projects|All-Users|homelab"
+
           for repo in ''${repos}; do
-            echo "''${repo}.git" >> $tmplist
+            if [[ ! $exclude_repos ~= $repo ]]; then
+              echo "''${repo}.git" >> $tmplist
+            fi
           done
           mv $tmplist /var/lib/cgit/cache/projects.list
           # TODO(fcuny): this should run as the git user