From 2d9515ab089287516fb7c0048f7fffbacf1d5c36 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 29 May 2022 07:33:11 -0700 Subject: 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 --- modules/services/cgit/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/services') 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 -- cgit 1.4.1