Commit Graph

10 Commits

Author SHA1 Message Date
Nalin Dahyabhai 7d5f1e1ca9 tarFilterer: always flush after writing
Always call the nested TarWriter's Flush() method after writing file
contents.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-20 11:19:27 -04:00
Nalin Dahyabhai 6c82e7eac0 commit: add --source-date-epoch and --rewrite-timestamp flags
Add a --source-date-epoch flag, defaulting to $SOURCE_DATE_EPOCH if set,
which sets the created-on date and the timestamp for the new history
entries, but does not default to modifying the timestamps on contents in
new layers.

Add a --rewrite-timestamp flag, which "clamps" timestamps in the new
layers to not be later than the --source-date-epoch value if both
the --rewrite-timestamp and --source-date-epoch flags were set.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-04 13:02:26 -04:00
Nalin Dahyabhai fdfd2237d2 containerImageRef.NewImageSource: merge the tar filters
Merge the two tar filters, if we need two, that we use when committing
an image.  Try to improve passing of error information from the writing
end of a pipe to the reader, so that it can be reported better.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-05-02 17:27:38 -04:00
Daniel J Walsh 8d5d763213
Fix stutters
Podman adds an Error: to every error message. So starting an error
message with "error" ends up being reported to the user as

Error: error ...

This patch removes the stutter.

Also ioutil.ReadFile errors report the Path, so wrapping the err message
with the path causes a stutter.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-19 07:11:44 -04:00
Sascha Grunert ce384684c0
Switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-07 11:41:47 +02:00
Nalin Dahyabhai 0bfbd3edb7 newTarDigester: zero out timestamps in tar headers
When digesting tar streams, zero out timestamps in headers before
digesting them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2020-08-22 13:16:19 -04:00
Nalin Dahyabhai 3835460c3b Use pipes for copying
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>
2020-08-21 12:34:00 -04:00
Nalin Dahyabhai bee80f0e36 tarFilterer: handle multiple archives
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>
2020-07-28 15:51:36 -04:00
Nalin Dahyabhai aad1fc5878 CompositeDigester: add the ability to filter tar streams
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>
2020-07-17 12:07:39 -04:00
Nalin Dahyabhai ebf6f518d0 Use content digests in ADD/COPY history entries
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
2019-08-16 20:16:40 +00:00