Closed jordilin closed 9 months ago
Hi Jordi, and thanks for the heads-up! I think we should be able to arrange to provide a gitconfig for use by the tests. We might be able to use git config
commands inside of the temporary repositories we're creating and make sure they don't write to $HOME.
If that doesn't work then an environment variable should be able to handle it. I believe git supports $XDG_CONFIG_HOME so that might be another option.
https://gitlab.com/garden-rs/garden/-/blob/main/tests/integration/setup.sh?ref_type=heads#L24 is where we should be able to
git config user.name Garden
git config user.email garden@localhost
and then we won't interact with $HOME at all.
I knew this sounded familiar.. we had first run into this when setting up the .gitlab-ci.yml
but the fix was regulated to just that entry point. Now we're fixing it in the tests directly. I should probably rewrite that shell script into a rust function in tests/common/mod.rs.
Thanks Jordi!
Thanks @davvid - this fixed it :+1:
NixOS builds in sandboxed environments using
nixbld
users and/homeless-shelter
as a$HOME
. Those build users do not have.gitconfig
setup, so git operations fail witherror: could not lock config file /homeless-shelter/.gitconfig: No such file or directory
. Complete output below after issuingnix build
Possible approaches I can think of:
GIT_CONFIG
andGIT_CONFIG_NOSYSTEM
so git commands make use of it. Believe envGIT_CONFIG
is deprecated these days though./home/test
, such as https://github.com/davvid/garden/blob/main/tests/eval_test.rs#L201, so I'd set it up globally asconst HOME: &'static str = "/home/test";
and use that as a reference./homeless-shelter
(although that home does not actually exist) so using that would certainly fix all assertions and does not assume a home under a/home
path