Fix compatibility on non-git project folders when git is installed on the system #399
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.
Hi, I'm not a python person so not sure best way to add test coverage for this, but to kick off a discussion here's the code change.
We run our CI through Jenkins, and to support job fanout our build process involves doing a git checkout on one node, caching the application files, and then subsequent nodes will restore code from that cache and run a subset of our tests. (We currently have a job fanout of around 50.) To reduce the size of the cached blob, we are excluding our .git folder from the cache.
This leads to us hitting a problem uploading our coverage files, because the GitVersioningSystem:
is_available
if git is installed on the system (which it is because we reuse our worker base images)get_network_root
it fails becausegit rev-parse --show-toplevel
is erroring outfatal: not a git repository
list_relevant_files
it therefore raisesCan't determine root folder
and blows up the stack:I'm Patching It Live (thanks for the perl oneliner help, ChatGPT) to get it working for us, and can confirm that this change does successfully prevent GitVersioningSystem from being used, and NoVersioningSystem is treating us fine with just the
Path.cwd()
check.