Use the copier package to rework how we handle ADD and COPY.
When evaluating cache for content that's being copied/added in, switch
from (digest the data, check for a cache entry, then maybe copy the data
and create the new layer) to (copy the data and create the new layer,
digesting as we go, check for a cache entry, either commit or discard
the new layer).
Use the copier package for ADD, COPY, and for ensuring that a specified
directory exists in the working container's rootfs.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When processing .dockerignore files, we produce mini-archives for each
individual item being copied as part of a directory tree, so if we pass
them through a tarFilterer, it needs to not give up when it hits the end
of the first archive that it sees.
Add a flag to the tarFilterer that it sets when it closes the writing
end of the pipe that it's reading, and if the flag isn't set when the
reader finds an EOF, have the reader gear up to read another archive
instead of just refusing to process any more data.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Rework CompositeDigester so that it can handle type "".
Add a newTarFilterer() inspired by imagebuilder's, that we'll be able to
use to adjust headers before digesting them.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Use digests of the added content in history entries that we create for
ADD and COPY instructions, tightening up cache checking just a little
bit more.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #1792
Approved by: TomSweeneyRedHat