chunked: report TOCDigest for converted layers

even if we validated the full layer, report the TOC Digest as well so
the upper layer can use both.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2024-02-09 11:12:02 +01:00
parent 394685cfa0
commit 9343f9f792
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
1 changed files with 2 additions and 4 deletions

View File

@ -1612,7 +1612,6 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff
stream := c.stream
var uncompressedDigest digest.Digest
tocDigest := c.tocDigest
if c.convertToZstdChunked {
fd, err := unix.Open(dest, unix.O_TMPFILE|unix.O_RDWR|unix.O_CLOEXEC, 0o600)
@ -1668,8 +1667,7 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff
// the file was generated by us and the digest for each file was already computed, no need to validate it again.
c.skipValidation = true
// since we retrieved the whole file and it was validated, do not use the TOC digest, but set the uncompressed digest.
tocDigest = ""
// since we retrieved the whole file and it was validated, set the uncompressed digest.
uncompressedDigest = diffID
}
@ -1699,7 +1697,7 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff
Artifacts: map[string]interface{}{
tocKey: toc,
},
TOCDigest: tocDigest,
TOCDigest: c.tocDigest,
UncompressedDigest: uncompressedDigest,
}