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.
What does this PR change? What problem does it solve?
The PR is currently in a request for comment state.
Up to now the
check
command has to create a temporary cache to ensure that it does not miss bitrot at the repository storage. However, this has the downside that a host may have to store two copies of the repository cache: one for regular usage and one for the check command.This PR adds support for the cache to verify its content and thereby allows the
check
command to use an already existing cache, which as a bonus will be repaired by redownloading locally damaged files if necessary.The CLI now has an
--temporary-cache
option in addition to--no-cache-verify
(which replaces--with-cache
)--with-cache
at the momentIt would probably be possible (although hacky) to let check detect that a cache already exists and then automatically use a cache if it exists and create a temporary cache otherwise. The current solution in this PR to use a normal cache be default can break some use cases where a separate host is used to run
check
for all repositories and there is not enough space to keep all caches.Using the normal cache also has the potential downside that
check
will download all metadata of a repository and thus could increase the size of the local cache. However, if the host runsprune
from time to time, then this won't be a problem as prune behaves in the same way.When verifying an already existing cache blob there are a number of corner cases that can appear:
The last case is necessary to gracefully handle incompletely uploaded files which should allow the check command to still access and verify the file if possible.
Was the change previously discussed in an issue or on the forum?
No.
Checklist
changelog/unreleased/
that describes the changes for our users (see template).gofmt
on the code in all commits.