hydra
hydra copied to clipboard
scmdiff: Hardcode `--git-dir`
The newest version of git refuses to work on repositories not owned by
the current user. This leads to issues with the /api/scmdiff
endpoint:
May 27 11:16:05 myhydra hydra-server[923698]: fatal: unsafe repository ('/var/lib/hydra/scm/git/57ea036ec7ecd85c8dd085e02ecc6f12dd5c079a6203d16aea49f586cadfb2be' is owned by someone else)
May 27 11:16:05 myhydra hydra-server[923698]: To add an exception for this directory, call:
May 27 11:16:05 myhydra hydra-server[923698]: git config --global --add safe.directory /var/lib/hydra/scm/git/57ea036ec7ecd85c8dd085e02ecc6f12dd5c079a6203d16aea49f586cadfb2be
May 27 11:16:05 myhydra hydra-server[923701]: warning: Not a git repository. Use --no-index to compare two paths outside a working tree
May 27 11:16:05 myhydra hydra-server[923701]: usage: git diff --no-index [<options>] <path> <path>
I used the same solution that was used in NixOS/nix#6440.
Fixes #1214
Thanks for looking into this! Will apply locally to see if that fixes the issue for latest nixpkgs unstable as well.
I forgot to report back, this fixes the issue for me.
Can you maybe write a test for this? I think this would probably fit into t/Hydra/Controller/API/checks.t
.
But the test…
But the test…
I'm sorry about that. I tried to write one, but I couldn't make it work. 😕