GitInput: Include deepClone option in the cache key

Without this commit, two jobsets using the same repository as input,
but different `deepClone` options, end up incorrectly sharing the same
"checkout" for a given (`uri`, `branch`, `revision`) tuple.  The
presence or absence of `.git` is determined by the jobset execution
order.

This patch adds the missing `isDeepClone` boolean to the cache key.

The database upgrade script empties the `CachedGitInputs` table, as we
don't know if existing checkouts are deep clones.  Unfortunately, this
generally forces rebuilds even for correct `deepClone` checkouts, as
the binary contents of `.git` are not deterministic.

Fixes #510
This commit is contained in:
Damien Diederen
2021-06-15 10:31:42 +02:00
parent b6921c2006
commit df7dab1291
4 changed files with 28 additions and 5 deletions

View File

@ -182,7 +182,7 @@ sub fetchInput {
# TODO: Fix case where the branch is reset to a previous commit.
my $cachedInput;
($cachedInput) = $self->{db}->resultset('CachedGitInputs')->search(
{uri => $uri, branch => $branch, revision => $revision},
{uri => $uri, branch => $branch, revision => $revision, isdeepclone => defined($deepClone) ? 1 : 0},
{rows => 1});
addTempRoot($cachedInput->storepath) if defined $cachedInput;
@ -223,6 +223,7 @@ sub fetchInput {
{ uri => $uri
, branch => $branch
, revision => $revision
, isdeepclone => defined($deepClone) ? 1 : 0
, sha256hash => $sha256
, storepath => $storePath
});