Prevent tests from using the user and system git config#934
Open
Eijebong wants to merge 1 commit intotaskcluster:mainfrom
Open
Prevent tests from using the user and system git config#934Eijebong wants to merge 1 commit intotaskcluster:mainfrom
Eijebong wants to merge 1 commit intotaskcluster:mainfrom
Conversation
jcristau
approved these changes
Apr 15, 2026
Contributor
jcristau
left a comment
There was a problem hiding this comment.
Alternatively should we set GIT_CONFIG_GLOBAL=/dev/null (and possibly GIT_CONFIG_SYSTEM) for the tests?
This prevents tests from asking to sign dummy commits on that repo if there's a global gpgsign config set. This also has the nice side effect of having the same tests not pollute the user git config with random safe directories (since run_task calls `git config --global` which tests exercise).
53319c3 to
7be2a7b
Compare
jcristau
reviewed
Apr 15, 2026
| os.environ["GIT_CONFIG_NOSYSTEM"] = "1" | ||
| # run-task writes to the global git config, so point it at a real | ||
| # (writable) empty file instead of ~/.gitconfig. | ||
| git_global = tempfile.NamedTemporaryFile(prefix="taskgraph-gitconfig-") |
Contributor
There was a problem hiding this comment.
Might want to move that to a (autouse/session-scope?) fixture so you can delete the file at the end?
Contributor
Author
There was a problem hiding this comment.
AFAIK it'll get deleted at the end when it gets GC'ed on interpreter exit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This prevents tests from asking to sign dummy commits on that repo if
there's a global gpgsign config set. This also has the nice side effect
of having the same tests not pollute the user git config with random
safe directories (since run_task calls
git config --globalwhich testsexercise).