From bb013ddcd016e2836e0aac05f5317fdef23789fa Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 30 May 2022 13:33:07 -0700 Subject: feat(gerrit): install the gerrit hook Create a few scripts that are used to trigger the hook when a patchset is created. Change-Id: Ibcfdb76b3e0ca29b9adc4c2719a8f81170818788 Reviewed-on: https://cl.fcuny.net/c/world/+/172 Reviewed-by: Franck Cuny --- modules/services/gerrit/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules') diff --git a/modules/services/gerrit/default.nix b/modules/services/gerrit/default.nix index 485bd58..a56dc7e 100644 --- a/modules/services/gerrit/default.nix +++ b/modules/services/gerrit/default.nix @@ -1,6 +1,17 @@ { config, pkgs, lib, ... }: let cfg = config.my.services.gerrit; + + my-gerrit-hook = name: + pkgs.writeShellScript "my-gerrit-hook" '' + exec -a ${name} ${pkgs.tools.gerrit-hook}/bin/gerrit-hook "$@" + ''; + + gerritHooks = pkgs.runCommandNoCC "gerrit-hooks" { } '' + mkdir -p $out + ln -s ${my-gerrit-hook "patchset-created"} $out/patchset-created + ''; + oauth = pkgs.fetchurl { url = "https://github.com/davido/gerrit-oauth-provider/releases/download/v3.5.1/gerrit-oauth-provider.jar"; @@ -43,6 +54,7 @@ in { log.jsonLogging = true; log.textLogging = false; sshd.advertisedAddress = "git.fcuny.net:29418"; + hooks.path = "${gerritHooks}"; cache.web_sessions.maxAge = "3 months"; plugins.allowRemoteAdmin = false; change.enableAttentionSet = true; -- cgit 1.4.1