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.
Go_modules creates a few temporary directories as part of the FileUpdater process. Unfortunately, we do not clean up these temporary directories up after using them, which can lead to the issue of running out of disk space. This branch was a failed attempt at cleaning up the temporary directories.
There are two spots that we create temporary directories during a go_modules update:
dependabot-core/go_modules/lib/dependabot/go_modules/file_updater.rb
Line 66 in 35032ea
go_module_updater
during theupdate_files
step (in_repo_path
is in SharedHelpers and yields a temporary directory)dependabot-core/go_modules/lib/dependabot/go_modules/file_updater/go_mod_updater.rb
Line 84 in 35032ea
Attempting to remove the temporary directories immediately after either of these steps will cause failures further down the line because when we finish updating the Go files, the
update_dependency_files
function utilizes thevendor_updater
in common whichcd
s into each temporary directorydependabot-core/go_modules/lib/dependabot/go_modules/file_updater.rb
Lines 45 to 48 in 35032ea
Unfortunately, as d6fd635 indicates, attempting to remove the temporary directories (even with
force=true
) at the end of theupdate_dependency_files
function still fails to actually remove the directories, indicating there may be an open handle preventing the folders from being removed.I have not tried overriding the
vendor_updater
class for go_modules, but that could help in resolving when the temporary directories are no longer needed.Another approach that's being tried to save on disk space during a go_modules updates is using a cache between all modules, instead of using
in_repo_path
and redownloading modules multiple times.